Getting online ticks and aggregated trades

To get the online tick data, it is necessary to redefine the OnNewTrade(MarketDataArg arg) method

public class SampleTick:Indicator
    {
        protected override void OnCalculate(int bar, decimal value)
        {
        }

        protected override void OnNewTrade(MarketDataArg arg)
        {
        }
    }

API also allows getting aggregated trades. For this, it is necessary to redefine the OnCumulativeTrade(CumulativeTrade arg) method

public class SampleTick:Indicator
    {
        protected override void OnCalculate(int bar, decimal value)
        {
        }

        protected override void OnCumulativeTrade(CumulativeTrade arg)
        {
        }
    }

Example of realization of the indicator, which outputs the delta of cumulative trades of the volume of more than 3 lots:

public class SampleCumulativeTrades : Indicator
{
    protected override void OnCalculate(int bar, decimal value)
    {
    }
    protected override void OnCumulativeTrade(CumulativeTrade arg)
    {
        if (arg.Volume < 3) return;
        this[CurrentBar - 1] += arg.Volume * (arg.Direction == TradeDirection.Buy ? 1 : -1);
    }
}