Wonder if you Ninja .NET developers out there can help me translate the following TS code to Ninja
Inputs: Price(Close), Length1(13), Length2(34), Length3(89), UpLevel(35), MidLevel(0), LwrLevel(-35); Value1 = jthma(Price,Length1); Value2 = jthma(Price,Length2); Value3 = jthma(Price,Length3); if Value1 > Value1[1] then Plot1(UpLevel,"UpLevel", Green) else Plot1(UpLevel,"UpLevel", Red); if Value2 > Value2[1] then Plot2(MidLevel,"MidLevel" ,Green) else Plot2(MidLevel,"MidLevel" ,Red); if Value3 > Value3[1] then Plot3(LwrLevel,"LwrLevel" ,Green) else Plot3(LwrLevel,"LwrLevel" ,Red);
The jthma function is:
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;
Many thanks
NM
Comment