Apr 23rd, 2014
979
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. study("TheLark: Choppiness Index", overlay=false)
2.
3. //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
4. // //
5. // CHOPPINESS INDEX BY THELARK //
6. // ~ 4-23-14 ~ //
7. // //
8. // •/• //
9. // //
11. // //
12. //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
13.
14. length = input(14, title="Length")
15. doavg = input(true,title="Do Average?")
16. avg = input(4, title="Average Length")
17. l1 = input(61.8, title="Extreme Chop")
18. l2 = input(50.0, title="Midline")
19. l3 = input(38.2, title="Trending")
20.
21. str = sum(tr,length)
22. ltl = lowest(low <= close[1] ? low : close[1],length)
23. hth = highest(high >= close[1] ? high : close[1],length)
24. height = hth - ltl
25. chop = 100 * (log10(str / height) / log10(length))
26.
27. plot(chop, color=#42B0FF, linewidth=2)
28. plot(doavg ? sma(chop,avg) : na, color=white)
29. hli1 = plot(l1, color=gray)
30. hli2 = plot(l2, color=gray)
31. hli3 = plot(l3, color=gray)
32.
33. fill(hli1,hli2,black,80)
34. fill(hli2,hli3,#C8D974,80)