StockFetcher Forums · Filter Exchange · Hull Moving Average<< 1 2 >>Post Follow-up
tomm1111
198 posts
msg #71641
Ignore tomm1111
modified
2/22/2009 4:18:06 AM

Here is a 8, 21 period hull moving average crossover. Go long when diff crosses above 0 and short when it crosses below. Below is an excerpt from Alan Hull's web page. The creator of the hull moving average.

"The Hull Moving Average solves the age old dilemma of making a moving average more responsive to current price activity whilst maintaining curve smoothness. In fact the HMA almost eliminates lag altogether and manages to improve smoothing at the same time."

Fetcher[
/* 8, 21 Period Hull Moving Average Crossover */
set{fast1,cwma(close,4)}
set{fast2,2 * fast1}
set{fast3,cwma(close,8)}
set{valfast,fast2 - fast3}
set{fastavg,cwma(valfast,3)}

set{slow1,cwma(close,11)}
set{slow2,2 * slow1}
set{slow3,cwma(close,21)}
set{valslow,slow2 - slow3}
set{slowavg,cwma(valslow,5)}

set{diff,fastavg - slowavg}

draw fastavg on plot price
draw slowavg on plot price
draw diff
draw diff line at 0

show stocks where the close is above 1
and volume is above 100000
and not otcbb

add column fastavg
add column slowavg
add column diff
]



chetron
2,817 posts
msg #71642
Ignore chetron
modified
2/22/2009 10:20:13 AM

SORRY TOMM, BUT THE ERROR VERSION RESULTS LOOK BETTER TO ME.



tomm1111
198 posts
msg #71644
Ignore tomm1111
modified
2/22/2009 1:15:09 PM

I found an error in the code. I corrected it. Up too late last night. :o)







tomm1111
198 posts
msg #71646
Ignore tomm1111
2/22/2009 1:51:04 PM

I agree. I will see what else I can come up with.

tomm1111
198 posts
msg #71647
Ignore tomm1111
modified
2/22/2009 1:59:56 PM

Here is another one. A 5, 14 period hull moving average crossover. It is quicker to react than the 8, 21 day crossover.

Fetcher[
/* 5, 14 Hull Moving Average Crossover */
set{fast1,cwma(close,3)}
set{fast2,2 * fast1}
set{fast3,cwma(close,5)}
set{valfast,fast2 - fast3}
set{fastavg,cwma(valfast,3)}

set{slow1,cwma(close,7)}
set{slow2,2 * slow1}
set{slow3,cwma(close,14)}
set{valslow,slow2 - slow3}
set{slowavg,cwma(valslow,4)}

set{diff,fastavg - slowavg}

draw fastavg on plot price
draw slowavg on plot price
draw diff
draw diff line at 0

show stocks where the close is above 1
and volume is above 100000
and not otcbb

add column fastavg
add column slowavg
add column diff
]



tomm1111
198 posts
msg #71649
Ignore tomm1111
modified
2/22/2009 2:43:30 PM

One more. This is a ema(3), 14 period hull moving average.

Fetcher[
/* ema(3), 14 Period Hull Moving Average Crossover */
set{slow1,cwma(close,7)}
set{slow2,2 * slow1}
set{slow3,cwma(close,14)}
set{valslow,slow2 - slow3}
set{slowavg,cwma(valslow,4)}

set{diff,ema(3) - slowavg}

draw ema(3) on plot price
draw slowavg on plot price
draw diff
draw diff line at 0

show stocks where the close is above 1
and volume is above 100000
and not otcbb

add column fastavg
add column slowavg
add column diff
]



tomm1111
198 posts
msg #71656
Ignore tomm1111
modified
2/23/2009 12:12:41 AM

Last one. I changed the hull moving average period to 5 and used a wma(2) of itself for the signal. This is about as smooth as it's going to get.

(Basically, what this shows is trade in the direction of the 5 period hull. Can be used as confirmation to exit trades.)

Fetcher[
/* 5 Period Hull Moving Average with a Hull WMA(2) signal */
set{fast1,cwma(close,3)}
set{fast2,2 * fast1}
set{fast3,cwma(close,5)}
set{valfast,fast2 - fast3}
set{fastavg,cwma(valfast,3)}
set{mvavg,cwma(fastavg,2)}

set{diff,fastavg - mvavg}

draw fastavg on plot price
draw mvavg on plot price
draw diff
draw diff line at 0

show stocks where the close is above 1
and volume is above 100000
and not otcbb
]



tomm1111
198 posts
msg #71657
Ignore tomm1111
2/23/2009 12:43:54 AM

I found the following excerpt from Alan Hull himself on a forum (stockmeetingplace.com).



HMA Construction...
The HMA is not that closely related to linear regression - the square root of the sum of the squares, etc. It is designed along geometric lines to remove lag without having to shorten the period and compromise smoothing. Hence, when compared to a line of linear regression of the same period, the HMA has superior smoothing.

HMA Application...
Because the HMA was designed to remove lag, don't use it to generate crossover trading signals. Instead you trade the turning points of the HMA...as it turns up - buy and as it turns down - sell. I actually prefer to use 2 separate HMAs with different periods - one for entry and one for exit. Tune the periods by backtesting on each financial instrument you wish to trade, ie. curve fit it in each case. Apply it to daily or weekly charts...it really doesn't matter which timeframe you use it over.

Enjoy,
Alan Hull

chetron
2,817 posts
msg #71661
Ignore chetron
2/23/2009 6:48:31 AM

well that explains why my previous edit was triggering on the turn around, as opposed to the crossover. thanx tomm.

chetron
2,817 posts
msg #71662
Ignore chetron
modified
2/23/2009 6:59:01 AM

ALSO TOMM, BE CAREFUL OF USING "S1" OR EVEN "R1" AS A CUSTOM VARIABLE, BECAUSE THESE ARE RESERVED FOR PIVIOT POINTS. I USUALLY THROW ON A "V" BEFORE MY VARIABLES TO MAKE SURE I DON'T GET SAND BAGGED.

I HAVEN'T SEEN ANY MATH ISSUES, BUT IF YOU ASK SF TO DRAW YOUR "S2", IT DRAWS THE PIVOT, AS OPPOSED TO CHANGE THE VARIABLE TO VS2, IT DRAWS YOUR "MATH".

ADD S2 AND R2 TO THE LIST

HTH



StockFetcher Forums · Filter Exchange · Hull Moving Average<< 1 2 >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2016 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus