DataSeries Type behaviour

Created at 20 Jul 2024, 10:07
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
TB

tbbusinge

Joined 03.07.2024

DataSeries Type behaviour
20 Jul 2024, 10:07


Does the DataSeries type always ensure that the data in the series is up to date with market Data. And also does the indexing change, as in is zero the latest bar, or the oldest bar in history.
I would love some clarification on this as it is not clear in the documentation. Thanks for any help offered.


@tbbusinge
Replies

firemyst
21 Jul 2024, 13:19

The highest index should have the latest value. The indexes in the series also coincide with the bar numbers on the chart.

You can test this yourself by reading the first value, the last value, and comparing against values on the chart.

In layman's terms, if the latest value was kept at index 0, cTrader would have to constantly rewrite the DataSeries updating all the indexes, which is very inefficient. Whereas, just tacking on the last value to the DataSeries List object is the most efficient way - the entirety of the list doesn't have to be constantly updated with each new bar.


@firemyst

tbbusinge
30 Jul 2024, 09:47 ( Updated at: 30 Jul 2024, 11:45 )

RE: DataSeries Type behaviour

firemyst said: 

The highest index should have the latest value. The indexes in the series also coincide with the bar numbers on the chart.

You can test this yourself by reading the first value, the last value, and comparing against values on the chart.

In layman's terms, if the latest value was kept at index 0, cTrader would have to constantly rewrite the DataSeries updating all the indexes, which is very inefficient. Whereas, just tacking on the last value to the DataSeries List object is the most efficient way - the entirety of the list doesn't have to be constantly updated with each new bar.

Understood, thanks for the reply.
Kindly take a look at my latest query if you have the time.

 


@tbbusinge