Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study("DMI SUPER SPECIAL TOP SECRET INDICATOR", shorttitle="DMI")
- DMILen = input(14, title="DI length")
- ADXLen = input(14, title="DI length")
- magicValue = input(22.5)
- dmi(len) =>
- up = change(high)
- down = -change(low)
- truerange = rma(tr, len)
- plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
- minus = fixnan(100 * rma(up < down and down > 0 ? down : 0, len) / truerange)
- [plus, minus]
- adx(DMILen, ADXLen) =>
- [plus, minus] = dmi(DMILen)
- sum = plus + minus
- adxVal = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), ADXLen)
- [adxVal, plus, minus]
- [avg, up, down] = adx(DMILen, ADXLen)
- upPlot = plot(up,color=green,title="+DI")
- downPlot = plot(down,color=blue,title="-DI")
- plot(avg, color=orange,title="ADX")
- fillColor = up > down ? green : red
- //fill(upPlot, downPlot, color=fillColor, transp=50)
- horizontal = plot(series=magicValue, color=purple, style=line, transp=25)
- tValue = magicValue > up and down > up ? black : green
- tValue2 = magicValue > down and down < up ? black : blue
- fill(horizontal, upPlot, color=tValue, transp=50)
- fill(horizontal, downPlot, color=tValue2, transp=50)
- barcolor(fillColor)
- bgcolor(fillColor)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement