Thank you very much for answering so promptly
Yes its a modified moving average with minimal lag created by Allen Hull. Here is a website that describes it more detail incuding the formula for it:
http://www.istockanalyst.com/article/viewarticle/articleid/3019836Its the only moving average that tracks prices well enough to be profitable with just crossovers without any further filtering. All you need is a stop.
The easiest formula I found is from the website, with n being the number of periods:
HMA(n) = WMA(2*WMA(n/2) – WMA(n)),sqrt(n))
with n/2 and sqrt(n) being rounded to the nearest whole number
The easiest way to program an HMA crossover program if there is no compiled HMA indicator for the predetermined periods(36 and 18) to me is this:
function run()
{
var *ClosePrice = series(priceClose());
var *WMA8 = series(WMA(ClosePrice,8));
var *WMA16 = series(WMA(ClosePrice,16));
var *WMA18 = series(WMA(ClosePrice,18));
var *WMA36 = series(WMA(ClosePrice,36));
var *HMA16= series(WMA(2*WMA8() - WMA16(),4));
var *HMA36 = series(WMA(2*WMA18() - WMA36(),6));
if(crossUnder(HMA16,HMA36))
enterShort();
if(crossOver(HMA16,HMA36))
enterLong();
}
The problem is these expressions: series(WMA(2*WMA8() - WMA16(),4));
Zorro doesn't want to put expression (2*WMA8()-WMA16() as the series veriable for the function WMA. I tried breaking it up several different ways but no success.
For an indicator I would assume it would look something like this:
HMA(Period) = WMA(2*WMA(int(Period/2)) – WMA(Period)),int(sqrt(Period))) but again the syntax is not acceptable
Same with this variation:
Value1 = 2 * series(WMA(*Data, int(Period));
Value2 = series(WMA(*Data, Period));
Value3 = series(WMA((Value1 - Value2), int(sqrt(Period));
return Value3;
}
The reason I wanted an HMA in the indicators is because I often use it in other functions like MACD. I really think its a worthwhile indicator and I think many others would find it useful when they play around with it. I would greatly appreciate any advice on getting my simple crossover program to work and if its possible getting an HMA indicator in Zorro so its as simple to use as a WMA for people like me. Thanks again.