Click or drag to resize

Chart

For a candles graphic display, you can use the special Chart component, which draws candles as follows: (see Chart components):

sample candleschart

The candles, coming from the CandleManager, then passed to the ChartHelperDraw method for displaying.

The current candle changes will be displayed when the candle is passed from the Processing event to draw on the graph.

If you want to display the finished candles, check the State property of candle that came:

C#
// _chart - StockSharp.Xaml.Chart
// a new chart area
_private ChartArea _areaComb;
private ChartCandleElement _candleElement;
...
var series = new CandleSeries(typeof(TimeFrameCandle),_security,TimeSpan.FromMinutes(_timeframe));

_candleElement = new ChartCandleElement() { FullTitle = "Candles" };
Chart.AddElement(_areaComb, _candleElement, series);

...

candleManager.Processing += CandleManagerOnProcessing;

...

private void CandleManagerOnProcessing(CandleSeries candleSeries, Candle candle)
{
    if (candle.State == CandleStates.Finished) 
    {
       var chartData = new ChartDrawData();
       chartData.Group(candle.OpenTime).Add(_candleElement, candle);
       Chart.Draw(chartData);
    }
}
See Also

Other Resources