How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Feature Request FAQ Help & Wiki Twitter

# The Lark: Directional Movement Index

802 2
An open source version of the DMI             . Mostly published for other scripters to modify.
Typical useage: http://www.investopedia.com/articles/technical/02/050602.asp
```study(title="TheLark: Directional Movement Index", shorttitle="DMI_LK", overlay=false)

//•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
//                                             //
//        OPEN SOURCE DMI BY THELARK           //
//                 ~ 8-3-14 ~                 //
//                                             //
//                     •/•                     //
//                                             //
//                                             //
//•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//

// 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-")```
Ravil'Nuriev
Here you are:

United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia

한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter