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 , ...