This ProBuilder code snippet demonstrates how to count the number of bars on a chart that occur within a specified time range and display this count on the chart. The example focuses on counting bars between 09:00:00 and 23:00:00.
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
Explanation of the Code:
This snippet is useful for traders or analysts who want to track the number of bars during specific trading hours or any other activities that are time-bound on their charts.
Check out this related content for more information:
https://www.prorealcode.com/topic/bar-counting-to-help-analysing/#post-180696
Visit Link