Indicator output

Created at 09 May 2018, 18:24
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!
CT

ctid386599

Joined 26.03.2018

Indicator output
09 May 2018, 18:24


[Output("Result")]
public IndicatorDataSeries Result { get; set; }

public override void Calculate(int index)
{
     if(x>y)
            Result[index] =y;
}

From the above example, I want to only populate new values of Results at  a given if condition. That means  not everx  index position.

Is there a way to not use Result[index] but use say Result.Insert(), etc

Thanks


@ctid386599
Replies

... Deleted by UFO ...

PanagiotisCharalampous
10 May 2018, 09:18

Dear Trader,

In the places where you don't want to place any value, just use double.NaN.

Let me know if this helps you.

Best Regards,

Panagiotis


@PanagiotisCharalampous

ctid386599
10 May 2018, 11:07

RE:

Dear Panagiotis,

Unfortunately that won't work for me because if I use a robot to fetch the last value it might be NAN. I got a way todo it but the problem is that IndicatorDataSeries is always the length of index. mine is now shorter and plotted  far away to the left. I have to scroll so far backwards to find the plot. is there a way to allign a chart to the right?

Thanks

 


@ctid386599

PanagiotisCharalampous
10 May 2018, 11:11

Hi,

A workaround is to use another collection for the purpose of reading from the cBot. Use Results with double.NaN for display and another collection with your values for the cBot.

Best Regards,

Panagiotis


@PanagiotisCharalampous