hidden series created by createdataseries not work, but mark as output work!

Created at 11 Apr 2020, 22:37
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!
CO

contact.bitq

Joined 11.04.2020

hidden series created by createdataseries not work, but mark as output work!
11 Apr 2020, 22:37


Hi, I follow this API to create a hidden series

 

without success.

here my code:

// -------------------------------  Indicator Code ----------------------------------------
// Don't mark this data series as [Output]
public IndicatorDataSeries BreakState { get; set; }

protected override void Initialize()
{
  BreakState = CreateDataSeries();
}

public override void Calculate(int index)
{
  BreakState[index] = 1; // Fixed value = 1 for testing
}

public int getLastBreakState()
    {
      var a = BreakState.LastValue; // ====> a is always NaN
      return a;
    }

// -------------------------------- Inside cBot file: ---------------------------------
private MyAboveIndicator myAboveIndicator;

// cBot onStart()
myAboveIndicator= Indicators.GetIndicator<MyAboveIndicator>(
   // with Some of my params here
);

// cBot onTick()
int indicatorState = myAboveIndicator.getLastBreakState(); // ===> It's always NaN, expected: Must be 1

 

I must mark my data series as Output, then it work normally.

Without marking as output, it always NaN.

 

Is this a bug of cAlgo API ??


@contact.bitq
Replies

PanagiotisCharalampous
13 Apr 2020, 08:56

Hi contact.bitq,

You need to explain more clearly what do you mean when you say they do not work. What did you expect to happen and what happens instead? Also please provide the complete indicator code.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

contact.bitq
13 Apr 2020, 09:12

RE:

PanagiotisCharalampous said:

Hi contact.bitq,

You need to explain more clearly what do you mean when you say they do not work. What did you expect to happen and what happens instead? Also please provide the complete indicator code.

Best Regards,

Panagiotis 

Join us on Telegram

 

Thanks, the minimal code above is enough to understand the case.

But I will create a minimal reproduction complete code and post it here ASAP :)


@contact.bitq