Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Monthly exponential moving average Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
ehop
Posted : Monday, September 22, 2008 1:01:28 PM
Registered User
Joined: 11/30/2004
Posts: 33
Can you help me develop a pcf where C <= the 3 month exp moving average and C5 was >= the 3 month exp moving average
Bruce_L
Posted : Monday, September 22, 2008 1:04:37 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Is C5 also a monthly Value?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ehop
Posted : Monday, September 22, 2008 1:35:53 PM
Registered User
Joined: 11/30/2004
Posts: 33

No.  I'm looking at C 5 days ago on the monthly.

Bruce_L
Posted : Monday, September 22, 2008 2:01:48 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following:

C <= .500488758553275 * (C + .5 * (C21 + .5 * (C42 + .5 * (C63 + .5 * (C84 + .5 * (C105 + .5 * (C126 + .5 * (C147 + .5 * (C168 + .5 * (C189)))))))))) AND C5 >= .500488758553275 * (C5 + .5 * (C26 + .5 * (C47 + .5 * (C68 + .5 * (C89 + .5 * (C110 + .5 * (C131 + .5 * (C152 + .5 * (C173 + .5 * (C194))))))))))

It should probably be noted that the calculation of the 3-Period Exponential Moving Average on a Monthly Chart has no data in common when calculating the current value and the value 5-Days Ago. You may wish to review the following:

How to create a Personal Criteria Forumula (PCF)
PCF Formula Descriptions
Cascades of Moving Averages
Handy PCF example formulas to help you learn the syntax of PCFs!

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ehop
Posted : Monday, September 22, 2008 3:44:58 PM
Registered User
Joined: 11/30/2004
Posts: 33
Bruce - Thanks so much for the info.

How would the formula differ if I just wanted to see C crossing its 3 month exp moving average with C1 (or C21) being less than its 3 exp moving average?
Bruce_L
Posted : Monday, September 22, 2008 3:55:51 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following:

C >= .500488758553275 * (C + .5 * (C21 + .5 * (C42 + .5 * (C63 + .5 * (C84 + .5 * (C105 + .5 * (C126 + .5 * (C147 + .5 * (C168 + .5 * (C189)))))))))) AND C21 < .500488758553275 * (C21 + .5 * (C42 + .5 * (C63 + .5 * (C84 + .5 * (C105 + .5 * (C126 + .5 * (C147 + .5 * (C168 + .5 * (C189 + .5 * (C210))))))))))

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ehop
Posted : Monday, September 22, 2008 4:24:13 PM
Registered User
Joined: 11/30/2004
Posts: 33
Bruce -Thanks again.  This seems to work fine.

Going forward, how would I modify this formula to test other periods (4 month exp ma instead of 3 month exp ma) and if I wanted to test the L, H, or O instead of the C would I just change the C in the formula to L, H, or O?
Bruce_L
Posted : Monday, September 22, 2008 4:40:10 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Personal Criteria Formulas are always based on the twenty minute delayed daily data. If your formulas are based entirely on the Open, High, Low, Close and Volumes of monthly bars, it is possible to convert them manually. I'll put the daily version followed by the monthly equivalent:

For the Open, multiply the days ago parameter by 21 and add 20 to get the monthly version.

O = O20
O1 = O41
O2 = O62

For the High, H is replaced by MAXH21 and if there is a days ago parameter in the daily version, multiply it by 21 and separate it from MAXH21 with a '.'.

H = MAXH21
H1 = MAXH21.21
H2 = MAXH21.42

The Low is treated very much like the High. L is replaced by MINL21 and if there is a days ago parameter in the daily version, multiply it by 21 and separate it from MINL21 with a '.'.

L = MINL21
L1 = MINL21.21
L2 = MINL21.42

The Close is probably the simplest. Just multiply the days ago parameter in the daily version by 21 to get the monthly version.

C = C
C1 = C21
C2 = C42

Volume is an interesting case. To get the actual Volume for a monthly bar (in Blocks of 420), you would need to multiply the Average Volume by 21. So V would be replaced by AVGV21 and if there is a days ago parameter in the daily version, multiply it by 21 and separate it from MINL21 with a '.' just like with the High and Low. But add *21 to the end of each monthly version whether or not there is a days ago parameter.

V = AVGV21*21
V1 = AVGV21.21*21
V2 = AVGV21.42*21

That said, if you are just comparing one Volume to another, there really isn't a reason to multiply it by 21 at all:

AVGV21*21 > AVGV21.21*21

Will return the same result as:

AVGV21 > AVGV21.21

Things can get a lot more complicated for monthly versions of some indicators. In same cases, it is not possible to write a monthly version (a monthly TSV for example).

Changing the Period of a multiple day per bar Exponential Moving Average formula in TeleChart involves rewriting the formula completely. The basic technique is outlined in bustermu's Monday, September 05, 2005 9:32:18 AM ET post in the Cascades of Moving Averages topic.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ehop
Posted : Monday, September 22, 2008 7:28:09 PM
Registered User
Joined: 11/30/2004
Posts: 33

Bruce - How is the 3 month exp moving average being calculated?

Bruce_L
Posted : Tuesday, September 23, 2008 9:35:10 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
A 3-Period Exponential Moving Average child indicator of Price on the Chart is calculated by starting with the oldest data point required for the chart calculations (this can unfortunately be as recent as 3-bars prior to the left-edge of the Chart for an EMA3 - but can be a lot more depending on the other Indicators Plotted). It takes this Price (the Closing Price once every 21-days when the Moving Average is applied to Price on a monthly Chart) and uses it as the starting value of the Exponential Moving Average. All values of the EMA besides the first are calculated by taking the previous value of the Moving Average times (period-1)/(period+1) plus the value of whatever is being averaged times 2/(period+1).

If you create a Custom Indicator using XAVGC3 (with no additional Smoothing), the calculations would be similar except they would always use 5 times the period data points for calculating each Moving Average value instead of starting with a variable number of bars to the left-edge of the chart that depends on what other indicators are also being charted.

It should be noted that the PCFs provided start with the most recent value and move backward when making their calculations instead. The most recent term is given a weight of 2/(period+1) that has been adjusted for unity and all older terms a weight of (period-1)/(period+1) versus the term that came before it (was 1-bar newer) in the formula.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.