# TheLark: Directional Movement Index Oscillator

4165 views
A modified DMI, This turns the standard DMI into an Oscillator. The DMI cross signal is the same, but as an OSC you get the added benefits or finding divergences, etc. The added WIlder's Average Line (blue) can help you see if a short term trend is getting less interesting.
```study(title="TheLark: Directional Movement Index Oscillator", shorttitle="DMI-OSC_LK", overlay=false)

//•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
//                                             //
//        DMI OSCILLATOR  BY THELARK           //
//                 ~ 8-3-14 ~                  //
//                                             //
//                     •/•                     //
//                                             //
//                                             //
//•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//

// Wells Wilders MA
wwma(l,p) =>
wwma = (nz(wwma[1]) * (l - 1) + p) / l

// Inputs
DMIlength = input(14)
Avglength = input(2)

// 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(DMIlength, tr)
PlusDI = 100 * wwma(DMIlength,plusDM) / ATR
MinusDI = 100 * wwma(DMIlength,minusDM) / ATR
osc = PlusDI - MinusDI
col = osc >= 0 ? #99EF0E : #FF0064
// Plots
plot(osc,color=col, style=histogram, linewidth=2)
plot(wwma(Avglength,osc), color=#0EAAEF,title="DI+")```

## Kommentare

Thank you so much for this!
Antworten
very nice one bro, can u make histogram of yours like this one, would be awesome

Antworten
Mlnklkm
@Mlnklkm, Hi, thanks for your comment. I'll look into it as I have time. Currently I am fairly busy but I strongly suggest you look into pine script yourself and give it a try! It's very rewarding to learn, and not too difficult if you are not doing anything tricky (this should be straight forward) ;)

Don't hesitate to private message me if you have any questions about pine!
Antworten