Why is DataSeries read only?

Created at 25 Jun 2015, 13:23
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!
WhiteSage's avatar

WhiteSage

Joined 02.02.2014

Why is DataSeries read only?
25 Jun 2015, 13:23


Occasionally I'll want to have a data series that works like IndicatorDataSeries and has the same indexing, is used for internal values and is not displayed, but DataSeries is read only. Why is it read only and how can I have an array that is exactly like IndicatorDataSeries (uses the same indexes) but can have values assigned from code and can be passed to an Indicator for processing?


@WhiteSage
Replies

Spotware
25 Jun 2015, 14:57

Dear Trader,

DataSeries is used to represent market price series. Therefore the you cannot set a value in the DataSeries array. However you by default, when you reference an indicator you already pass DataSeries as a parameter. We would like to suggest you to copy the values of DataSeries passed as parameter into an IndicatorDataSeries array and then make modifications into the values.  


@Spotware

WhiteSage
25 Jun 2015, 16:15

Suppose I have some series that are used for calculation and not final display, is it possible to have it in a data series that has native indexing?
When creating a non output IndicatorDataSeries

private IndicatorDataSeries Test;

I am unable to create a new instance as its an 'abstract class', and I am unable to assign to it ( 'Object reference not set to an instance of an object.' )


@WhiteSage

WhiteSage
25 Jun 2015, 16:40

A better way of putting my question is: Can I use an IndicatorDataSeries and hide it? Or have a buffer object that behaves the same way regarding indexes?


@WhiteSage

WhiteSage
25 Jun 2015, 16:47

Found it! Sorry, didn't realise it was in the documentation.

series = CreateDataSeries();

Another question answer by myself ;)
Thanks spotware, you guys are so patient!


@WhiteSage