An open source version of the DMI. Mostly published for other scripters to modify.
Typical useage: www.investopedia.com...hnical/02/050602.asp
Typical useage: www.investopedia.com...hnical/02/050602.asp
study(title="TheLark: Directional Movement Index", shorttitle="DMI_LK", overlay=false) //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•// // // // OPEN SOURCE DMI BY THELARK // // ~ 8-3-14 ~ // // // // •/• // // // // https://www.tradingview.com/u/TheLark // // // //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•// // This is an open source version of the DMI or Directional Movement Index that is provided by Trading View. // I made this mostly for other scripters to be able to modify and use, but it also helps with transparency, // and proves that TV uses the correct Wells Wilder MA, and DMI. // More to come from me and modified DMI's :) // Wells Wilders MA wwma(l,p) => wwma = (nz(wwma[1]) * (l - 1) + p) / l // Inputs length = input(14) // Calc hiDiff = high - high[1] loDiff = low[1] - low plusDM = (hiDiff > loDiff) and (hiDiff > 0) ? hiDiff : 0 minusDM = (loDiff > hiDiff) and (loDiff > 0) ? loDiff : 0 ATR = wwma(length, tr) PlusDI = 100 * wwma(length,plusDM) / ATR MinusDI = 100 * wwma(length,minusDM) / ATR DX = (PlusDI + MinusDI > 0) ? 100 * (abs(PlusDI - MinusDI) / (PlusDI + MinusDI)) : 0 // Plots plot(wwma(length,DX),color=#FF006E,title="DX") plot(PlusDI, color=#0EAAEF,title="DI+") plot(MinusDI,color=orange,title="DI-")