//Update of indicator created by @USGEARS //@version=2 study(title="DMI Stochastic", shorttitle="DMI Stoch", overlay=true) // Wells Wilders MA wwma(l,p) => wwma = (nz(wwma[1]) * (l - 1) + p) / l // Inputs DMIlength = input(10, title = "DMI Length") Stolength = input(3, title = "DMI Stochastic Length") os = input (10, title = "Oversold") ob = input (90, title = "Overbought") // DMI Osc 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 // DMI Stochastic Calc hi = highest(osc, Stolength) lo = lowest(osc, Stolength) clr = blue Stoch = sum((osc-lo),Stolength) / sum((hi-lo),Stolength) *100 crossUp = Stoch[1] < os and Stoch > os ? 1 : 0 crossDo = Stoch[1] > ob and Stoch < ob ? 1 : 0 if crossUp clr := green if crossDo clr := red // plot(Stoch, color = clr, title = 'Stochastic', linewidth = 2, style = columns, transp=2) //plot (ob, color = gray, linewidth = 1, title = 'Over Bought') //plot (os, color = gray, linewidth = 1, title = 'Over Sold') plotshape(crossUp, title="Crossing Up Signal", style=shape.arrowup, location=location.belowbar, color=green, transp=0) plotshape(crossDo, title="Crossing Down Signal",style=shape.arrowdown, location=location.abovebar, color=red, transp=0)