Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study("Trend Strength by LDA")
- ADXlength = input(9, title="ADX period")
- DMIlength = input(9, title="DMI Length")
- dirmov(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(down > up and down > 0 ? down : 0, len) / truerange)
- [plus, minus]
- adx(DMIlength, ADXlength) =>
- [plus, minus] = dirmov(DMIlength)
- sum = plus + minus
- adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), ADXlength)
- [adx, plus, minus]
- [ADX, up, down] = adx(DMIlength, ADXlength)
- ADXLDA= (ADX-15)*2.5
- adxcolor= up>down?green: red
- plot(ADXLDA, color=adxcolor, title="Trend Strength")
- plot (ADXLDA, color=adxcolor , style= histogram, linewidth= 4)
- plot(0, color=black, title="Chop Zone")
- plot(20, color=green, title="Mendoza Line", linewidth=1)
- plot(80, color=red, title=" Extreme Zone", linewidth=1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement