Made changes, currently looks like this:
// HMA PriceSeries( NumericSeries ), Period( NumericSimple );
var HMA(var* Data,int Period)
{
var * WMA = series(*Data, Period);
var * halvedLength;
var * sqrRootLength;
var * Value1;
var * Value2;
var* Value3;
if ((ceiling(Period / 2) - (Period / 2)) <= 0.5) then
halvedLength = ceiling(Period / 2)
else
halvedLength = floor(Period / 2);
if ((ceiling(sqrt(Period)) - sqrt(Period)) <= 0.5) then
sqrRootLength = ceiling(sqrt(Period))
else
sqrRootLength = floor(sqrt(Period));
Value1 = 2 * series(WMA(*Data, halvedLength));
Value2 = series(WMA(*Data, Period));
Value3 = series(WMA((Value1 - Value2), sqrRootLength));
return Value3;
}
For the ceiling and floor functions any ideas on whether I can code it using
int(period/2) and int((sqrt(period)) instead of halvedlength and sqrRootLength?