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 |

Price Hedley Momentum Divergence Indicator Topic Rating:
Previous Topic · Next Topic Watch this topic · Print this topic ·
davemc
Posted : Sunday, June 26, 2005 2:11:11 PM
Registered User
Joined: 12/19/2004
Posts: 17
I am looking for a custom indicator for Hedley's Momentum Divergence Indicator. His TradeStation EasyLanguage Code is:

(with setting = 15 bars; 40 bars is intermediate-term setting)

Input: FastMA(12), SlowMA(26), MacdMA(9), Input2(15), BuyZone(30), SellZone(90);

Value1=IFF(Highest(MACD(Close,FastMA,SlowMA),Input2)- Lowest(MACD(Close,FastMA,SlowMA),Input2)<>0, Highest(MACD(Close,FastMA,SlowMA),Input2) - Lowest(MACD(Close,FastMA,SlowMA),Input2),50);

Value2=IFF(Highest(close,Input2) - Lowest(close,Input2)<>0,Highest(close,Input2) - Lowest(close,Input2),50);

Plot2(100*(MACD(Close,FastMA,SlowMA) - Lowest(MACD(Close,FastMA,SlowMA) - Lowest(MACD(Close,FastMA,SlowMA),Input2))/Value1,"MACD%");

Plot3(BuyZone, "BuyZone");

Plot4(SellZone, "SellZone");

Thanks for the Help,
Dave McBurney
Doug_H
Posted : Sunday, June 26, 2005 2:29:13 PM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
Dave:

I feel like I've heard of this indicator, but I cannot find any reference to it here in the forums. I also cannot seem to locate any definition or description of it out on the web. The information you gave would be helpful to someone who understands TradeStation EasyLanguage...which I don't. I will bring this to the attention of one of my colleagues who has far superior knowledge of formulas. He may be able to understand the information you've provided above.

- Doug
Teaching Online!
bustermu
Posted : Sunday, June 26, 2005 2:47:08 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Doug,

The name is Price Headley.

Thanks,
Jim Murphy
Doug_H
Posted : Sunday, June 26, 2005 3:04:44 PM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
Thanks, bustermu. I knew we had stuff in here about this topic...and I never thought to try an alternate spelling. Thanks for your help.

To davemc:

Do a search on Headley (that's the correct spelling) here in the forum (click the search button above). Two topics in particular may provide the information you're looking for: one on Acceleration Bands, and the other on Help with a PCF.

- Doug
Teaching Online!
davemc
Posted : Sunday, June 26, 2005 5:56:05 PM
Registered User
Joined: 12/19/2004
Posts: 17
Sorry, I should have supplied more info. along with the formula, and I definitely should have checked spelling

Anyways, Headley states that since MACD plots its levels relative to each stock's price, he created the MACD Momentum Divergence indicator to normalize Momentum readings across all stocks within a range of 0 to 100, with 0 showing the weakest momentum and 100 the highest, so that a higher priced stock will not have a higher Momentum reading than a lower priced stock that is showing the exact same MACD pattern. There are two lines plotted, an intermediate divergence time frame of 40 bars and a short term divergence time frame of 15 bars. The intermediate filters out short term whipsaws. His concept is that when the Momentum line has turned up, but the price trend line falls underneath the momentum line, a bullish divergence is formed and vice versa for a bearish divergence. This indicator is used with acceleration bands for buy and sell signals.

davemc
Doug_H
Posted : Sunday, June 26, 2005 6:32:17 PM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
Thanks for the detailed clarification, davemc. This formula is still beyond my capabilities, so as promised, I have forwarded it to a colleague. Hopefully he'll be able to reply sometime tomorrow, even if it's to say it may take a little longer. I encourage you to click the Watch This Topic link found at the top right of this topic you started. That way, you'll get an email notification whenever a reply is posted.

- Doug
Teaching Online!
davemc
Posted : Monday, June 27, 2005 7:56:05 AM
Registered User
Joined: 12/19/2004
Posts: 17
Doug,

Thanks for the reply, I appreciate the quick help that is available on this board.

Dave
Bruce_L
Posted : Monday, June 27, 2005 8:40:52 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I've never used the language, so I could be missing something, but the TradeStation EasyLanguage Code seems either sloppy or incomplete.

Input: Includes MacdMA(9) (never used).
Value1: Calculates the MACD Range over 15 periods.
Value2: Calculates the Price Range over 15 perios (never used).
Plot2: Calculates and plots the 15-Period Stochastic of MACD and labels it MACD%.
Plot3: Draws a line at 30% and labels it Buy Zone.
Plot4: Draws a line at 90% and labels it Sell Zone.

The example I've found of Price Headley's Momentum Divergence Indicator seems to plot both a Close% and a MACD%, while the code only seems to draw the MACD%.

In any case, a Stochastic of a MACD is not going to be done reasonably in TeleChart. You will want to read Market Trend Cycle PCFs? and possibly set up both the long formula representing an actual Stochastic of a MACD and the various approximations to see why (the formula you want would be even longer since it is a 15-Period Stochastic instead of 10). Here is how to set up an approximation of Price Headley's Momentum Divergence Indicator using the method producing the best approximation in that thread (no smoothing since Headley's version doesn't seem to have it):

Select Chart Template | Add Indicator | Indicator
-Visible: Checked
-Center Zero Line: Unchecked
-Plot Using Price Scale: Unchecked
-Indicator Formula:

700 * (XAVGC12 - XAVGC26 - AVG(XAVGC12.1,14) + AVG(XAVGC26.1,14)) / (ABS(XAVGC12 - XAVGC26 - XAVGC12.1 + XAVGC26.1) + ABS(XAVGC12 - XAVGC26 - XAVGC12.2 + XAVGC26.2) + ABS(XAVGC12 - XAVGC26 - XAVGC12.3 + XAVGC26.3) + ABS(XAVGC12 - XAVGC26 - XAVGC12.4 + XAVGC26.4) + ABS(XAVGC12 - XAVGC26 - XAVGC12.5 + XAVGC26.5) + ABS(XAVGC12 - XAVGC26 - XAVGC12.6 + XAVGC26.6) + ABS(XAVGC12 - XAVGC26 - XAVGC12.7 + XAVGC26.7) + ABS(XAVGC12 - XAVGC26 - XAVGC12.8 + XAVGC26.8) + ABS(XAVGC12 - XAVGC26 - XAVGC12.9 + XAVGC26.9) + ABS(XAVGC12 - XAVGC26 - XAVGC12.10 + XAVGC26.10) + ABS(XAVGC12 - XAVGC26 - XAVGC12.11 + XAVGC26.11) + ABS(XAVGC12 - XAVGC26 - XAVGC12.12 + XAVGC26.12) + ABS(XAVGC12 - XAVGC26 - XAVGC12.13 + XAVGC26.13) + ABS(XAVGC12 - XAVGC26 - XAVGC12.14 + XAVGC26.14)) + 50

Maybe somebody else can come up with somethng better (and I'll do some additional research and tests as well). The only chart to which I've compared the approximation is a MSFT chart ending 7/19/01 that is easily found using Google. The big swings are all there, but the match is far from exact.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
davemc
Posted : Thursday, December 1, 2005 3:15:07 PM
Registered User
Joined: 12/19/2004
Posts: 17
Bruce_L,

In revisiting this thread, which I had completely forgotten about until rereading Headley's book, I realized that I had missed a line of TradeStation Code.

The code I posted was:

(with setting = 15 bars; 40 bars is intermediate-term setting)

Input: FastMA(12), SlowMA(26), MacdMA(9), Input2(15), BuyZone(30), SellZone(90);

Value1=IFF(Highest(MACD(Close,FastMA,SlowMA),Input2)- Lowest(MACD(Close,FastMA,SlowMA),Input2)<>0, Highest(MACD(Close,FastMA,SlowMA),Input2) - Lowest(MACD(Close,FastMA,SlowMA),Input2),50);

Value2=IFF(Highest(close,Input2) - Lowest(close,Input2)<>0,Highest(close,Input2) - Lowest(close,Input2),50);

Plot2(100*(MACD(Close,FastMA,SlowMA) - Lowest(MACD(Close,FastMA,SlowMA) - Lowest(MACD(Close,FastMA,SlowMA),Input2))/Value1,"MACD%");

Plot3(BuyZone, "BuyZone");

Plot4(SellZone, "SellZone");

But it should include the line:

Plot1(100*(close-Lowest(close,Input2))/Value2,"Close%");

which should be inserted between the Value2 and Plot2 code.

Thanks for any help,
davemc

Bruce_L
Posted : Thursday, December 1, 2005 4:33:42 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I can write a formula for Plot2, but switching symbols takes too long to be practical (the version I've written is 15,449 characters long not counting spaces).

On the other hand, Plot1 is simple. It is a 15-Period Stochastic of Price with SK=1 and SD=1 (no need for a Custom Indicator). Its presence however changes creating the indicator in TeleChart from impractical to impossible because Plot1 and Plot2 would not be on the same scale.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
gacp
Posted : Friday, July 27, 2012 9:12:44 PM
Registered User
Joined: 1/29/2005
Posts: 1

Given the pane overlay function in TC2000, how do I scale both MACD and Stochastics to be on a 0 to 100 scale to derive the Price Headley Momentum Divergence Indicator? Thanks.

Bruce_L
Posted : Monday, July 30, 2012 9:20:41 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

 You would probably not want to plot them in the same scale. Since we still can't do a Stochastic of MACD in TC2000 (it can be done in StockFinder), about the closest we can do is align the zero line of the MACD with the fifty line of the Stochastic.

Add the MACD to the same pane as the Stochastic but do not plot it in the same Scale. Then click on the MACD and select Scaling so you can change the Scale Method to Center on 0.



-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.