Hello, Please post code, I started looking at the problem, in theory how it could be done.
The difference between a time based chart and the tick chart is the timebase.
So gathering up the ticks in each time period ‘bar’ chosen would be one way to go.
If this was done going forward from when bar=0, that would be fast, as the chart has to do that when building, may take a bit extra time initially dependant on units chosen.
At the same time, do a cumulative count of the ticks over the relative time period bars that were being covered as you go.
When enough time period bars reached to be able to calculate the sum for the average , then change technique
Going forward from there, to maintain the sum value, is to add the new time period bars number of ticks and subtract the first time period bars number of ticks.
Adding a value and subtracting a value would be a lot faster than looping through all the values every time one is added.
From additional needed variables point of view, the tick count per period bar and a way to index the bar, keep track of the 1st bar of the summation range.
Other things that came to mind are:
If no ticks fall in a time period bar, how is that treated. In a timebased chart these I believe are ignored, and are not treated as bars.
How would the average line be plotted, from the period bars, or the ticks within that range.
Any way that’s as far as I got with it, apart from the test code to count the ticks every 60seconds.
Regards
once count=0
if openminute[1] <> openminute then
count = 0
endif
count = count +1
if count = 1 then
drawtext(count[1],barindex[1] ,count[1]+5)
endif
return count