MattParticipant
Junior
Hi,
Is it possible to get the countdown to bar close for range bars, displayed on the vertical axis as per normal candlesticks?
Thanks
Hi, here you have:
defparam drawonlastbaronly=true
box=5
if islastbarupdate then
rangeNow=high-low
NextChange=box-rangeNow
distUp=high-close
distDn=close-low
countUp=distUp+NextChange
countDn=distDn+NextChange
drawtext("Dist.Up: #countUp#",barindex+2,max(open[1],close[1]))
drawtext("Dist.Dn: #countDn#",barindex+2,min(open[1],close[1]))
drawsegment(barindex,close+countUp,barindex+5,close+countUp)
drawsegment(barindex,close-countDn,barindex+5,close-countDn)
endif
return
MattParticipant
Junior
Thanks Ivan.
That’s very clever. My mistake though, I wasn’t specific enough.
I’m actually using range bars with:Ā Box Size Method = Ticks (100)
Is there any way to count the ticks and display it counting down from 100, 99, 98, etc?
Btw, is it possible to display on the Y-axis or only the chart area?
Thanks! 🙌
Ok, so it will be like this:
defparam drawonlastbaronly=true
boxTicks=75
box=boxTicks*ticksize
if islastbarupdate then
rangeNow=high-low
NextChange=box-rangeNow
distUp=high-close
distDn=close-low
countUp=distUp+NextChange
countDn=distDn+NextChange
ticksUp = countUp/ticksize
ticksDn = countDn/ticksize
drawtext("Dist.Up: #ticksUp#",barindex+2,max(open[1],close[1]))
drawtext("Dist.Dn: #ticksDn#",barindex+2,min(open[1],close[1]))
drawsegment(barindex,close+countUp,barindex+5,close+countUp)
drawsegment(barindex,close-countDn,barindex+5,close-countDn)
endif
return
JSParticipant
Senior
Hi Matty,
If you are already using the “Countdown to bar Close” setting, this counter will change to a “tick” counter when you use a “tick” graph…
When using, for example, a 100 tick graph, the counter will count down the ticks from 100 to 0…
(Right click on the Y-axis and check “Display countdown to bar close”…)