This is not a provided indicator from Ninja.
Has anyone developed an indicator using the WildersAverage function?
The following code is from ThinkOrSwim that achieves the result I am trying to do with Ninja:
input length = 14;
def hiDiff = high - high[1];
def loDiff = low[1] - low;
def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
def ATR = WildersAverage(TrueRange(high, close, low), length);
def "DI+" = 100 * WildersAverage(plusDM, length) / ATR;
def "DI-" = 100 * WildersAverage(minusDM, length) / ATR;
def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
plot "DX" = DX;
plot "30-Line" = 30;
NOTE: This is very similar to the Ninja provided DM and ADX indicators coding but I am having trouble incorporating the WilderAverage to it.
Thank you for any help that can be provided.

Comment