TickConsolidator(100) will create a TradeBar from 100 ticks.

How does TickConsolidator (or AggregateBar) know when it has 100 ticks and it needs to create a new TradeBar?

I've looked at the TickConsolidator (and AggregateBar) code and I don't see how it knows when it is done aggregating the current bar after 100 ticks and creates a new TradeBar on the next tick.

I do see the maxCount variable but I don't see it being used anywhere within TickConsolidator. Where is the tick counter?

Why am I asking? I want to calculate TradeBar.Open to be the average of all prices from the first 50 ticks (instead of the first tick of the trade bar). And calculate the TradeBar.Close to be the average of all prices from the last 50 ticks (instead of the last tick of the trade bar).

So then, if N= 100 then

TickConsolidator(N)

TradeBar.Open = Average of all Tick Prices from the first N/2 ticks.

TradeBar.Close = Average of all Tick Prices from the last N/2 ticks.

 

 

Author