thinkscript DMIEC

thinkscript DMIEC
# DMI EMA Color

declare lower;

input length = 13;
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(Color.DARK_GREEN);
"DI-".SetDefaultColor(Color.RED);
ADX.SetDefaultColor(Color.BLACK);

AddCloud("DI+", "DI-", Color.GREEN, Color.PINK);

评论

此博客中的热门博文

流水线交易法

异常价格变动