Type : Function, Name : jtHMA
Inputs: price(NumericSeries), length(NumericSimple);
Vars: halvedLength(0), sqrRootLength(0);
if ((ceiling(length / 2) — (length / 2)) <= 0.5) then
halvedLength = ceiling(length / 2)
else
halvedLength = floor(length / 2);
if ((ceiling(SquareRoot(length)) — SquareRoot(length)) <= 0.5) then
sqrRootLength = ceiling(SquareRoot(length))
else
sqrRootLength = floor(SquareRoot(length));
Value1 = 2 * WAverage(price, halvedLength);
Value2 = WAverage(price, length);
Value3 = WAverage((Value1 — Value2), sqrRootLength);
jtHMA = Value3;
Type : PaintBar, Name : Hull Moving Average
Inputs: Price(Close), Length(21), upColor(Blue), downColor(Red);
Value1 = jtHMA(Price, Length);
{ Color criteria }
if Value1 > Value1[1] then
PlotPB(h, l, o, c, «HMA_PB», upColor)
else if Value1 < Value1[1] then
PlotPB(h, l, o, c, «HMA_PB», downColor) ;