Example #1
0
        private void UpdatePriceChart(PriceSeries priceData)
        {
            // Create a new series and append Open, High, Low, Close data
            _ohlcDataSeries = new OhlcDataSeries <DateTime, double>();
            _ohlcDataSeries.Append(priceData.TimeData, priceData.OpenData, priceData.HighData, priceData.LowData, priceData.CloseData);
            PriceData            = (IOhlcDataSeries <DateTime, double>)(UseDiscontinuousDateTimeAxis ? _ohlcDataSeries.ToDiscontinuousSeries(Calendar) : _ohlcDataSeries);
            PriceData.SeriesName = priceData.Symbol;

            // Create a series for the 200 period SMA which will be plotted as a line chart
            Sma200Series            = (IXyDataSeries <DateTime, double>)PriceData.ToMovingAverage(200);
            Sma200Series.SeriesName = "200 SMA";

            // Create a series for the 50 period SMA which will be plotted as a line chart
            Sma50Series            = (IXyDataSeries <DateTime, double>)PriceData.ToMovingAverage(50);
            Sma50Series.SeriesName = "50 SMA";

            // Update the chart type and timeframe with current settings
            UpdateChartType(_chartType);
        }