Hi, I am looking for a bar counting code that would print under each bar its number starting from the beginning of the session. It helps a lot when studying price action. I know it is available on Ninja.
Thanks in advance.
Maurice
There you go:
x = barindex
drawtext("#x#",barindex,low - range)
return
It does work on my platform.
Did you put it ON your chart (not below)?
Sorry, what do you mean exactly. I have a Dax chart 5 min the I go to indicators and I create a new one. I paste your code and I get the attached picture
I understood what you meant and it works but may I ask a question. How to start the counting lets say at 9 am each day until 11PM for example?
Because it starts the counting on a 5 min chart on 28 oct.
Thank a lot for your help.
There you go:
Once Tally = 0
If OpenTime = 090000 Then
Tally = 0
Endif
If (OpenTime >= 090000) And (OpenTime <= 230000) Then
Tally = Tally + 1
drawtext("#Tally#",barindex,low - range)
Endif
return
Link to above code added as Log 309 here …
Snippet Link Library
Dear Roberto,
Your program works beautifully. Just a question if I a may (without abusing of your patience) the position of the figures is quite strange, sometimes very low sometimes very close to the bar. Is there any way to fix some distance below the low of the bar?
All the best.
Maurice
There’s no instruction to anchor the text on a fixed point of the chart (it’s in the pipeline, though), but this could help display them at a better distance. Replace line 7 with:
drawtext("#Tally#",barindex,lowest[5](low) - highest[5](range))
changing periods (I used 5) from 2 to any number (I suggest it to not be greater than 50) could let you better fine tune the output.
Thank you, it is a lot better.
Hi Maurice,
How did you manage to get this bar count to show on the main chart as opposed to a panel at the bottom?
I keep having the same issue as you did with it only showing at the bottom of the chart and not on the chart itself.
Thanks
Jay
You have to add it by going on the price menu on the top left of the chart and then add an indicator
Thanks for responding, Maurice.
It embarrasses me to say that it took a lot longer than I expected to figure out how to do it even after you telling me how!
BTW this is great for watching PA in the Al Brooks format.
Jay