Empty index locations not comparing to double.NaN correctly

Created at 30 Sep 2014, 08:38
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

Empty index locations not comparing to double.NaN correctly
30 Sep 2014, 08:38


When checking for an empty value on an alternate symbol series, indicator or indicatordataseries.

The comparison:

if (the_series[index] == double.NaN)

Always returns FLASE. Even where printing the same result to the log shows "NaN".

How do I correctly calculate the start index of a given series on the time series I am displaying? (particularly with indicators only function being .Result)


@WhiteSage
Replies

Spotware
30 Sep 2014, 09:23

You can check value for NaN using the following code snippet:

if (double.IsNaN(the_series[index]))
...

 


@Spotware

WhiteSage
30 Sep 2014, 09:52

Ah wonderful. Thank you!


@WhiteSage