SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

How do I extract the latest OHLC datapoint from renderableSeries.DataSeries?

I need to extract all open, high, low & close values for the last candlestick in the chart. It is a real-time chart, so values are changing constantly.

  • You must to post comments
0
0

Hi there,

something like this:

var ohlcDataSeries = renderableSeries.DataSeries as OhlcDataSeries<DateTime, double>;
int count = ohlcDataSeries.Count;
DateTime date = ohlcDataSeries.XValues[count - 1];
double open = ohlcDataSeries.OpenValues[count - 1];
double high = ohlcDataSeries.HighValues[count - 1];
double low = ohlcDataSeries.LowValues[count - 1];
double close = ohlcDataSeries.CloseValues[count - 1]; // Note: CloseValues == YValues

That should do it!

If you want to be notified when data changes, you can subscribe to the SciChartSurface.Rendered event, or just get this value out when the data is appended.

Are you trying to create a latest price indicator on the axis? If so see the answer to your other post… 🙂

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.