LLP
Member
Hi guys, please help to modify this DMI official TOS code into:
D+ crosses above D- = Breakout
1. Show BREAKOUT like STOCH-FULL code,
2. Show OPTIONABLE breakout on price like Exponential code.
D+ crosses above D- = Breakout
1. Show BREAKOUT like STOCH-FULL code,
2. Show OPTIONABLE breakout on price like Exponential code.
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2008-2023
#
declare lower;
input length = 14;
input averageType = AverageType.WILDERS;
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 = MovingAverage(averageType, TrueRange(high, close, low), length);
plot "DI+" = 100 * MovingAverage(averageType, plusDM, length) / ATR;
plot "DI-" = 100 * MovingAverage(averageType, minusDM, length) / ATR;
def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
plot ADX = MovingAverage(averageType, DX, length);
"DI+".SetDefaultColor(GetColor(1));
"DI-".SetDefaultColor(GetColor(8));
ADX.SetDefaultColor(GetColor(5));
Attachments
Last edited: