Click or drag to resize


The S# supports 6 candle types:

  • TimeFrameCandle - the candle on the basis of the time interval (timeframe). You can specify both popular segments (minute, hour, day) and customized. For example, 21 seconds, 4.5 minutes, etc
  • RangeCandle - the candle of the price range. A new candle is created when there is an order with the price goes outside the permissible limits. The acceptable limit is generated every time based on the price of the first trade.
  • VolumeCandle - the candle is produced as long as the total of orders not exceeded the volume. If the new trade exceeds allowable volume, it gets in the new candle.
  • TickCandle - the same as the VolumeCandle, only limited to the number of trades instead of the volume.
  • PnFCandle - point and figure chart candle.
  • RenkoCandle - Renko candle.

How to work with candles is shown in the SampleCandle example, which is located in the Samples/OpenECry/SampleOEC folder.

The TimeFrameCandle and RangeCandle charts are on the following figures:

sample timeframecandles
sample rangecandles

The CandleManager creating and start of data receiving

  1. First, you need to create the candles manager CandleManager, which is by subscribing to the ConnectorCandleSeriesProcessing event, will receive candles:

    _trader = new RithmicTrader(this.Path.Text);
    _candleManager = new CandleManager(_trader);
    Note Note

    If for candles getting the source with another procedure used instead of the Connector connector, you must implement the StockSharp.Algo.CandlesIExternalCandleSource interface and pass the implementation to CandleManagerSources.

  2. Next, you must subscribe to the CandleManagerProcessing event, which informs about a new value for the handling:

    _candleManager.Processing += DrawCandle;
    private void DrawCandle(CandleSeries series, Candle candle)
        wnd.Chart.Draw((ChartCandleElement)wnd.Chart.Areas[0].Elements[0], candle);
    Note Note
    To display candles the graphical component Chart is used.
  3. You must declare exactly which candles are required for the algorithm and start data receiving through CandleManagerStart:

    switch (type)
        case CandleTypes.TimeFrame:
            series = new CandleSeries(typeof(TimeFrameCandle), security, TimeFrame.Value.Value.TimeOfDay);
        case CandleTypes.Tick:
            series = new CandleSeries(typeof(TickCandle), security, VolumeCtrl.Text.To<int>());
        case CandleTypes.Volume:
            series = new CandleSeries(typeof(VolumeCandle), security, VolumeCtrl.Text.To<decimal>());
        case CandleTypes.Range:
            series = new CandleSeries(typeof(RangeCandle), security, PriceRange.Unit);
            throw new ArgumentOutOfRangeException();

    The CandleManagerProcessing event will start be called after this phase.

Working with candles

Next Steps