Advertisement
JustUncleL

Renko Timer R0.2 by JustUncleL

Dec 8th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. //@version=3
  2. study(title="Renko Timer R0.2 by JustUncleL", shorttitle="TIMER",overlay=true)
  3.  
  4. //
  5. // author : justuncleL
  6. //
  7. // Description:
  8. //
  9.  
  10. //
  11. tm = floor(time/60000)
  12. pjcnt = time % 60000
  13.  
  14. v = 0.0
  15. v := pjcnt==0? open : nz(v[1])
  16.  
  17. //
  18. plot(v>0?v:na,color=change(tm)?na:blue,linewidth=2,transp=10)
  19.  
  20. //
  21. //
  22.  
  23. minlen = input(2,minval=1,title="Min Bricks to Swing Confirm")
  24. maxlen = input(10,minval=1,title="Max Bricks to Swing Confirm")
  25.  
  26. // Initialise up and down counters counters
  27. up = 0
  28. down = 0
  29. // Check is this the 1st green after red? or is this already going up count up bars, otherwise zero count
  30. up := close[1]<open[1] and close>open? 1 : up[1]>0 and close>open? up[1]+1 : 0
  31. // Check is this the 1st red after green? or is this already going down count down bars, otherwise zero count
  32. down := close[1]>open[1] and close<open? 1 : down[1]>0 and close<open? down[1]+1 : 0
  33.  
  34. long = pjcnt==0 and up[1]>0 and up[1]>=minlen and up[1]<=maxlen and up[2]==pjcnt[1] //and up>0
  35. short = pjcnt==0 and down[1]>0 and down[1]>=minlen and down[1]<=maxlen and down[2]==pjcnt[1] //and down>0
  36.  
  37. // - Plot Alerts
  38. plotarrow(long?1:na, title="BUY Arrow", colorup=lime, maxheight=60, minheight=50, transp=20,offset=0)
  39. plotarrow(short?-1:na, title="SELL Arrow", colordown=red, maxheight=60, minheight=50, transp=20,offset=0)
  40. //
  41. alertcondition(long,message="LONG", title="LONG Alarm")
  42. alertcondition(short,message="SHORT", title="SHORT Alarm")
  43.  
  44. // debugs
  45. //plotshape(tm,location=location.bottom)
  46. //plotshape(pjcnt,location=location.bottom,color=black)
  47. //plotshape(up[1],location=location.bottom,color=green)
  48. //plotshape(down[1],location=location.bottom,color=red)
  49. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement