Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 6/25/2005 Posts: 441
|
i think this is the formula WMA (2 x WMA(Price,Integer(Period/2)) - WMA(Price,Period),Integer(SquareRoot(Period)))
lets say 5 and 30 peiod
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following:
5-Period Hull Moving Average:
(30 * C + 27 * C1 - 7 * C3 - 4 * C4 - C5) / 45
30-Period Hull Moving Average:
(1725 * C + 2970 * C1 + 3762 * C2 + 4128 * C3 + 4095 * C4 + 3690 * C5 + 3285 * C6 + 2880 * C7 + 2475 * C8 + 2070 * C9 + 1665 * C10 + 1260 * C11 + 855 * C12 + 450 * C13 + 45 * C14 - 360 * C15 - 610 * C16 - 736 * C17 - 769 * C18 - 740 * C19 - 680 * C20 - 620 * C21 - 560 * C22 - 500 * C23 - 440 * C24 - 380 * C25 - 320 * C26 - 260 * C27 - 200 * C28 - 140 * C29 - 80 * C30 - 40 * C31 - 16 * C32 ) / 27900
You may be interested in the following:
Hull Moving Average
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/25/2005 Posts: 441
|
thank you very much Bruce!! soryy for the late respond your massage.
|
|
Registered User Joined: 5/17/2006 Posts: 493
|
can you give a formula for a 18 period hull moving average?
thanks
|
|
Registered User Joined: 5/17/2006 Posts: 493
|
Bruce,
Do you have a formula for a 10 period hull moving average, don't worry about the 18 period above.
|
|
Registered User Joined: 5/17/2006 Posts: 493
|
actually, if you can do the 18 also, I'd appreciate it as well
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
georgematus, Please try the following:
10-Period Hull Moving Average:
(240 * C + 343 * C1 + 328 * C2 + 214 * C3 + 100 * C4 - 14 * C5 - 62 * C6 - 66 * C7 - 48 * C8 - 30 * C9 - 12 * C10 - 3 * C11) / 990
18-Period Hull Moving Average:
(1008 * C + 1632 * C1 + 1905 * C2 + 1860 * C3 + 1530 * C4 + 1200 * C5 + 870 * C6 + 540 * C7 + 210 * C8 - 120 * C9 - 298 * C10 - 362 * C11 - 350 * C12 - 300 * C13 - 250 * C14 - 200 * C15 - 150 * C16 - 100 * C17 - 50 * C18 - 20 * C19 - 5 * C20) / 8550
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/17/2006 Posts: 493
|
thanks Bruce, one last thing, I was wondering if you can duplicate the following tradestation formula, basically the hull moving average will change colors green to red in a down trend or red to green in an uptrend. I know we cant have this indicator change colors but can we create a pcf that would indicate when it would change colors, here's the tradestation formula
{ Color criteria } if (Value1 > Value1[1]) then SetPlotColor[colourDeltaBar](1, upColour) else if (Value1 < Value1[1]) then SetPlotColor[colourDeltaBar](1, downColour);
or
inputs: price(Close), jthmaLength( 21 ), upColour(Green), downColour(Red); variables: Avg(0), colour(0); Avg = jthma( price, jthmaLength ) ; if Avg > Avg[1] then colour = upColour; if Avg < Avg[1] then colour = downColour;
I would like the pcf to use the 10 period hma as you gave me.
thanks
|
|
Registered User Joined: 5/17/2006 Posts: 493
|
Bruce,
So basically, a pcf that shows when it turns form red to green and a pcf that shows when it turns from green to red. Can you do it both for the 10 period and 18 period. I'm just using the colors as an example from the above tradestation formula.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I don't use or understand the programming language used by Tradestation. That said, my best guess is that it uses the up color when the Hull Moving Average is increasing and the down color when the Hull Moving Average is decreasing. That means if the current HMA - previous HMA > 0 it is one color and if the current HMA - previous HMA < 0 it is another color. As far as I can tell, the code does not understand the trichotomy principle and take into account the remote possibility that the current HMA - previous HMA = 0. The previous HMA is just the current HMA with 1 added to all of the days ago parameters.
HMA10 Positive Net Change:
(240 * C + 343 * C1 + 328 * C2 + 214 * C3 + 100 * C4 - 14 * C5 - 62 * C6 - 66 * C7 - 48 * C8 - 30 * C9 - 12 * C10 - 3 * C11) / 990 - (240 * C1 + 343 * C2 + 328 * C3 + 214 * C4 + 100 * C5 - 14 * C6 - 62 * C7 - 66 * C8 - 48 * C9 - 30 * C10 - 12 * C11 - 3 * C12) / 990 > 0
This simplifies to:
240 * C + 103 * C1 - 15 * C2 - 114 * C3 - 114 * C4 - 114 * C5 - 48 * C6 - 4 * C7 + 18 * C8 + 18 * C9 + 18 * C10 + 9 * C11 + 3 * C12 > 0
HMA10 Negative Net Change:
240 * C + 103 * C1 - 15 * C2 - 114 * C3 - 114 * C4 - 114 * C5 - 48 * C6 - 4 * C7 + 18 * C8 + 18 * C9 + 18 * C10 + 9 * C11 + 3 * C12 < 0
HMA18 Positive Net Change:
1008 * C + 624 * C1 + 273 * C2 - 45 * C3 - 330 * C4 - 330 * C5 - 330 * C6 - 330 * C7 - 330 * C8 - 330 * C9 - 178 * C10 - 64 * C11 + 12 * C12 + 50 * C13 + 50 * C14 + 50 * C15 + 50 * C16 + 50 * C17 + 50 * C18 + 30 * C19 + 15 * C20 + 5 * C21 > 0
HMA18 Negative Net Change:
1008 * C + 624 * C1 + 273 * C2 - 45 * C3 - 330 * C4 - 330 * C5 - 330 * C6 - 330 * C7 - 330 * C8 - 330 * C9 - 178 * C10 - 64 * C11 + 12 * C12 + 50 * C13 + 50 * C14 + 50 * C15 + 50 * C16 + 50 * C17 + 50 * C18 + 30 * C19 + 15 * C20 + 5 * C21 < 0
You may wish to review the following:
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/17/2006 Posts: 493
|
thanks again Bruce, you're awesome, one last thing, how do I create a pcf that will show me when it goes from HMA18 Positive Net Change: to HMA18 Negative Net Change:
and from HMA18 Negative Net Change: to HMA18 Positive Net Change:
I'm basically just looking to see when it changes from one to another.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
georgematus, Please try the following:
HMA10 Net Change xUp Zero:
240 * C + 103 * C1 - 15 * C2 - 114 * C3 - 114 * C4 - 114 * C5 - 48 * C6 - 4 * C7 + 18 * C8 + 18 * C9 + 18 * C10 + 9 * C11 + 3 * C12 > 0 AND 240 * C1 + 103 * C2 - 15 * C3 - 114 * C4 - 114 * C5 - 114 * C6 - 48 * C7 - 4 * C8 + 18 * C9 + 18 * C10 + 18 * C11 + 9 * C12 + 3 * C13 <= 0
HMA10 Net Change xDown Zero:
240 * C + 103 * C1 - 15 * C2 - 114 * C3 - 114 * C4 - 114 * C5 - 48 * C6 - 4 * C7 + 18 * C8 + 18 * C9 + 18 * C10 + 9 * C11 + 3 * C12 < 0 AND 240 * C1 + 103 * C2 - 15 * C3 - 114 * C4 - 114 * C5 - 114 * C6 - 48 * C7 - 4 * C8 + 18 * C9 + 18 * C10 + 18 * C11 + 9 * C12 + 3 * C13 >= 0
HMA18 Net Change xUp Zero:
1008 * C + 624 * C1 + 273 * C2 - 45 * C3 - 330 * C4 - 330 * C5 - 330 * C6 - 330 * C7 - 330 * C8 - 330 * C9 - 178 * C10 - 64 * C11 + 12 * C12 + 50 * C13 + 50 * C14 + 50 * C15 + 50 * C16 + 50 * C17 + 50 * C18 + 30 * C19 + 15 * C20 + 5 * C21 > 0 AND 1008 * C1 + 624 * C2 + 273 * C3 - 45 * C4 - 330 * C5 - 330 * C6 - 330 * C7 - 330 * C8 - 330 * C9 - 330 * C10 - 178 * C11 - 64 * C12 + 12 * C13 + 50 * C14 + 50 * C15 + 50 * C16 + 50 * C17 + 50 * C18 + 50 * C19 + 30 * C21 + 15 * C21 + 5 * C22 <= 0
HMA18 Net Change xDown Zero:
1008 * C + 624 * C1 + 273 * C2 - 45 * C3 - 330 * C4 - 330 * C5 - 330 * C6 - 330 * C7 - 330 * C8 - 330 * C9 - 178 * C10 - 64 * C11 + 12 * C12 + 50 * C13 + 50 * C14 + 50 * C15 + 50 * C16 + 50 * C17 + 50 * C18 + 30 * C19 + 15 * C20 + 5 * C21 < 0 AND 1008 * C1 + 624 * C2 + 273 * C3 - 45 * C4 - 330 * C5 - 330 * C6 - 330 * C7 - 330 * C8 - 330 * C9 - 330 * C10 - 178 * C11 - 64 * C12 + 12 * C13 + 50 * C14 + 50 * C15 + 50 * C16 + 50 * C17 + 50 * C18 + 50 * C19 + 30 * C21 + 15 * C21 + 5 * C22 >= 0
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/28/2011 Posts: 120
|
QUOTE (Bruce_L) Please try the following:
5-Period Hull Moving Average:
(30 * C + 27 * C1 - 7 * C3 - 4 * C4 - C5) / 45
Hull Moving Average
No mention of C2 ? Is this correct ?
-Jason
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes it is correct. The C2 term is the same in both front weighted moving averages. So when you subtract one of the front moving averages from the other front weighted moving average it disappears from the resulting formula.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |