Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. study("Trend Strength by LDA")
  2. ADXlength = input(9, title="ADX period")
  3. DMIlength = input(9, title="DMI Length")
  4.  
  5. dirmov(len) =>
  6. up = change(high)
  7. down = -change(low)
  8. truerange = rma(tr, len)
  9. plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
  10. minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
  11. [plus, minus]
  12.  
  13. adx(DMIlength, ADXlength) =>
  14. [plus, minus] = dirmov(DMIlength)
  15. sum = plus + minus
  16. adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), ADXlength)
  17. [adx, plus, minus]
  18.  
  19. [ADX, up, down] = adx(DMIlength, ADXlength)
  20. ADXLDA= (ADX-15)*2.5
  21. adxcolor= up>down?green: red
  22. plot(ADXLDA, color=adxcolor, title="Trend Strength")
  23. plot (ADXLDA, color=adxcolor , style= histogram, linewidth= 4)
  24.  
  25. plot(0, color=black, title="Chop Zone")
  26. plot(20, color=green, title="Mendoza Line", linewidth=1)
  27. plot(80, color=red, title=" Extreme Zone", linewidth=1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement