Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- study(title="Renko Timer R0.2 by JustUncleL", shorttitle="TIMER",overlay=true)
- //
- // author : justuncleL
- //
- // Description:
- //
- //
- tm = floor(time/60000)
- pjcnt = time % 60000
- v = 0.0
- v := pjcnt==0? open : nz(v[1])
- //
- plot(v>0?v:na,color=change(tm)?na:blue,linewidth=2,transp=10)
- //
- //
- minlen = input(2,minval=1,title="Min Bricks to Swing Confirm")
- maxlen = input(10,minval=1,title="Max Bricks to Swing Confirm")
- // Initialise up and down counters counters
- up = 0
- down = 0
- // Check is this the 1st green after red? or is this already going up count up bars, otherwise zero count
- up := close[1]<open[1] and close>open? 1 : up[1]>0 and close>open? up[1]+1 : 0
- // Check is this the 1st red after green? or is this already going down count down bars, otherwise zero count
- down := close[1]>open[1] and close<open? 1 : down[1]>0 and close<open? down[1]+1 : 0
- long = pjcnt==0 and up[1]>0 and up[1]>=minlen and up[1]<=maxlen and up[2]==pjcnt[1] //and up>0
- short = pjcnt==0 and down[1]>0 and down[1]>=minlen and down[1]<=maxlen and down[2]==pjcnt[1] //and down>0
- // - Plot Alerts
- plotarrow(long?1:na, title="BUY Arrow", colorup=lime, maxheight=60, minheight=50, transp=20,offset=0)
- plotarrow(short?-1:na, title="SELL Arrow", colordown=red, maxheight=60, minheight=50, transp=20,offset=0)
- //
- alertcondition(long,message="LONG", title="LONG Alarm")
- alertcondition(short,message="SHORT", title="SHORT Alarm")
- // debugs
- //plotshape(tm,location=location.bottom)
- //plotshape(pjcnt,location=location.bottom,color=black)
- //plotshape(up[1],location=location.bottom,color=green)
- //plotshape(down[1],location=location.bottom,color=red)
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement