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
סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יכולים להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?
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-")