I'm trying to implement a basic counter for the number of bars that I'm in a trade for.
The data originally imported into quote manager was tick data for bid and ask.
My chart is using 1hr bars with extended mode and bar magnifier switched on.
The CalcBar() method appears to be called each intra-hour-bar tick and not each 1hr bar.
Ideally I'd like to do something like:
Code: Select all
protected override void CalcBar()
if (this.StrategyInfo.MarketPosition > 0)
if(_barCount == x)
// exit trade or do something
But this is called each tick and not just each hour bar, so the counter gets over-incremented.
What's the best way of actually counting the number of bars I'm in a trade using the bar resolution of the actual chart?