How do I reset the blockcount variable to zero at the start of a new bar?
Here is the code:
/// //initialize the blockcount variable
int blockcount = 0;
protected override void OnMarketData(MarketDataEventArgs e)
{
//Increment blockcount each time a trade of 1000 shares or greater comes in
if (e.MarketDataType == MarketDataType.Last && e.Volume >=5)
{
blockcount++ ;
}
}
protected override void OnBarUpdate()
{
Blocks.Set(blockcount);
}
Comment