TheLark

The Lark: Directional Movement Index

An open source version of the DMI. Mostly published for other scripters to modify.
Typical useage: www.investopedia.com...hnical/02/050602.asp
Skrip open-source

Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Inggin menggunakan skrip ini pada chart?
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-")