protected override void OnUpdate(UpdateArgs args)
if (args.Reason == UpdateReason.HistoricalBar)
// get current 'order book' snapshot
var dom = this.Symbol.DepthOfMarket.GetDepthOfMarketAggregatedCollections(new GetLevel2ItemsParameters()
AggregateMethod = AggregateMethod.ByPriceLVL,
LevelsCount = this.InputLevelsCount,
CalculateCumulative = true,
CustomTickSize = this.InputCustomTicksize
SetValue(dom.Asks.Last().Cumulative, 0);
SetValue(-dom.Bids.Last().Cumulative, 1);