| Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 12/11/2004 Posts: 5
|
I am looking for help in writing a PCF to get an average value greater than zero, for the 60 day moving average of the MACD which normally is AVGC12-AVGC26. Would the following PCF work. (AVG(AVGC12-AVGC26),60)>0. Thanks.
|
|

 Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
This should work for you:
(AVG(AVGC12,60) - AVG(AVGC26,60)) > 0
- Craig Here to Help!
|
|

 Worden Trainer
Joined: 10/1/2004 Posts: 4,308
|
asplus:
I'm not a whiz on MACD formulas, but I know the syntax you wrote would not be correct. Try the following formula to see if it yields what you want.
Avg(AvgC12,60)- Avg(AvgC26,60)>0
I welcome input from others if this formula doesn't look quite right.
- Doug Teaching Online!
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
I'm guessing that "asplus" may not have realized that the "industry standard" MACD is actually the difference of two Exponential Moving Averages (XMA's), so the formula for the 12,26 MACD is: XAvgC12-XAvgC26
The standard signal line (from Gerald Appel) is a 9-day XMA of the 12,26 MACD ... but of course any of these param's can be changed. And, of course, a Simple MA can be used instead if desired. However the SMA's tend to be more "choppy" and sometimes have significant signal lag when compared to the standard XMA types.
So, I thot I'd offer this additional info just in case :~)
To get a 60-day XMA of the exponential MACD, you have to be a little careful, since there is a wierd bug in the current version that calls for nested XMA's to keep the innermost term the highest one ... otherwise the accuracy of the result is significantly affected in many cases. The formula you provided (with an X in front of each Avg) *should* work properly, once the bug is fixed. However, to get an accurate result for a 60-day XMA signal-line of a true XMA-based 12,26 MACD being greater than zero, the formula needs to be:
XAVG(XAVGC60,12) - XAVG(XAVGC60,12) > 0
Please note that this is a legit "transform" - it is mathematically OK to change the order of the nesting of the two MA's ... in fact you can do it with mixed MA types as well if you want.
If you plot this as a CI (without the >0) on a chart with an internal 12,26,60 MACD exponential signal line, you'll see they line up nicely.
However this form, which *should* be identical, does not plot the same way (or give the same "hits" as a PCF):
XAVG(XAVGC12,60) - XAVG(XAVGC12,60) > 0
A complete explanation can be found at: http://www.worden.com/training/default.aspx?g=posts&t=699
|
|
Registered User Joined: 12/11/2004 Posts: 5
|
Thanks for all the replies and your help but wouldnt the following XAVG(XAVGC60,12) - XAVG(XAVGC60,12) > 0 (suggested by Tanstaafl)equal to zero as both sections are 12 periods.
|
|

 Worden Trainer
Joined: 10/1/2004 Posts: 4,308
|
I suspect his last 12 was meant to be a 26.
- Doug Teaching Online!
|
|

 Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Yes, he is subtracting two identical items. It must be a typo. Are you using simple or exponential averages in your MACD on the chart?
- Craig Here to Help!
|
|
Registered User Joined: 12/11/2004 Posts: 5
|
I am using exponential averages in my MACD. With this, all I am trying to do is find strong stocks from my list that have their MACD above the zero line more often than not. Thanks.
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
OOPS ... sorry about that ... a typo, indeed. The correct version is:
XAvg(XAvgC60,12) - XAvg(XAvgC60,26)
That yields an accurate model of the 60-day XMA Signal line of the 12,26 XMA-based MACD.
Jim Dean
|
|
|
Guest-1 |