Create DataSeries inside cbot

Created at 22 Oct 2015, 20: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!
aimerdoux's avatar

aimerdoux

Joined 07.06.2015

Create DataSeries inside cbot
22 Oct 2015, 20:07


hi, currently i have seen that is only possible to create data series inside of indicators as is display up next:

private IndicatorDataSeries series;
protected override void Initialize()
{
    series = CreateDataSeries();
}
public override void Calculate(int index)
{
    series[index] = (MarketSeries.Close[index] + MarketSeries.Open[index]) / 2;
}

 

can you plkease explain me how to do this inside of a cbot?


@aimerdoux
Replies

Spotware
22 Oct 2015, 20:26

Dear Trader,

Please have a look at the following code snippet:

            MarketSeries data = MarketData.GetSeries(TimeFrame.Hour);
            DataSeries series = data.Close;
            int index = series.Count - 1;

            double close = data.Close[index];
            double high = data.High[index];
            double low = data.Low[index];
            double open = data.Open[index];

We hope this helps you.


@Spotware

aimerdoux
24 Oct 2015, 04:37

thank you very much really helpful :)


@aimerdoux

croucrou
29 Jun 2017, 16:24

But this series is read only.

How to create a series based on e.g. my calculations?


@croucrou