 Feb 28th, 2014
2,553
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. study(title = "TheLark Laguerre RSI",overlay=false)
2.
3. //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
4. // //
5. // LAGUERRE RSI BY THELARK //
6. // ~ 2-17-14 ~ //
7. // //
8. // •/• //
9. // //
11. // //
12. //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
13.
14. // Averages, and the way they are compared and calculated make up a large amount
15. // of the indicators out there, so the fun thing about new averages, is how they
16. // open up a whole new group of indicators.
17. // This is Laguerre RSI. You'll notice it acts a little different than your normal RSI,
18. // and it can be traded in different ways. It can be used as a switch, or to view bursts
19. // of momentum. Combine with your style and see if you notice anything. It might just
20. // be what you were looking for! Stay tuned for more scripts & ideas by following me on TradingView.
21.
22. //setups
23. h = high
24. l = low
25. c = close
26. //inputs
27. g = input(0.75, title="Gamma")
28. ob = input(0.80,title="Over Bought")
29. os = input(0.20,title="Over Sold")
30. smooth = input(1,minval=1,title="Smoothing (1 = off)")
31. coloring = input(true,type=bool,title="3 colors?")
32. //calc
33. p = c
34. L0 = ((1 - g)*p)+(g*nz(L0))
35. L1 = (-g*L0)+nz(L0)+(g*nz(L1))
36. L2 = (-g*L1)+nz(L1)+(g*nz(L2))
37. L3 = (-g*L2)+nz(L2)+(g*nz(L3))
38. cu = (L0>L1?L0-L1:0)+(L1>L2?L1-L2:0)+(L2>L3?L2-L3:0)
39. cd = (L0<L1?L1-L0:0)+(L1<L2?L2-L1:0)+(L2<L3?L3-L2:0)
40. //plots
41. lrsi=ema((cu+cd==0?-1:cu+cd)==-1?0:(cu/(cu+cd==0?-1:cu+cd)), smooth)
42. hline(ob)
43. hline(os)
44. col1 = lrsi > lrsi and lrsi > os ? #00FF7B : lrsi < lrsi and lrsi < ob ? #FF3571 : lrsi == lrsi ? #ECA700 : #ECA700
45. col2 = lrsi > lrsi and lrsi > os ? #00FF7B : lrsi < lrsi and lrsi < ob ? #FF3571 : lrsi < os ? #FF3571 : lrsi > ob ? #00FF7B : lrsi == lrsi ? #ECA700 : #ECA700
46. col = coloring ? col1 : col2
47. plot(lrsi, color=col, linewidth=2,style=line)