Wrong Prices when using MarketSeries.OpenTime.GetIndexByExactTime()

Created at 12 Feb 2014, 13:18
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!
JO

jobenb

Joined 07.10.2013

Wrong Prices when using MarketSeries.OpenTime.GetIndexByExactTime()
12 Feb 2014, 13:18


 Hi

The values I am getting from using the index obtained from MarketSeries.OpenTime.GetIndexByExactTime() and looping through and inspecting OpenTime[index] is VERY different from what I can see on the chart.

It all seems incorrect and needs urgent rectification! Please let me know when this will be fixed.

Here are the results:

Using OpenTime.GetIndexByExactTime():

15minute
EURUSD
09-Jan-14 1:30PM Open Price 1.36717
09-Jan-14 1:45PM Close Price 1.36718  

Actual Chart:

09-Jan-14 1:30PM Open Price 1.36331
09-Jan-14 1:45PM Close Price 1.35527 


@jobenb
Replies

Spotware
12 Feb 2014, 14:22

We can not reproduce the described problem. Please send us the code code which can show the issue. 


@Spotware

jobenb
12 Feb 2014, 15:06 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Spotware said:

We can not reproduce the described problem. Please send us the code code which can show the issue. 

Sorry, but I can't share the whole robot for confidentiality purposes, however I can share the piece of code producing the incorrect values:
 

int i;

            double minimumQualifyingResearchPipValue = MinimumQualifyingResearchPips * Symbol.PipSize;
            
            cAlgo.API.Internals.MarketSeries barSeries = MarketData.GetSeries(TimeFrame.Minute15);

            i = barSeries.OpenTime.GetIndexByExactTime(DateTime.Parse("09-Jan-14 1:30PM"));
            double eventOpenPrice = MarketSeries.Open[i];

            i = barSeries.OpenTime.GetIndexByTime(DateTime.Parse("09-Jan-14 1:45PM"));
            double eventClosePrice = MarketSeries.Close[i];

            string WhyIsTheAboveNotWorking = "Please fix it!";

 

The code above is in a private method called from OnTick();

 


@jobenb

Spotware
12 Feb 2014, 15:12

Do you execute this code in backtesting or in real time?


@Spotware

jobenb
12 Feb 2014, 15:16 ( Updated at: 21 Dec 2023, 09:20 )

Here is some more pictures...

 


@jobenb

jobenb
12 Feb 2014, 15:18

I execute it in Real Time... and running it through the VS2013 debugger.


@jobenb

jobenb
12 Feb 2014, 15:22

Currently running FxPro cAlgo Version 1.16.34221


@jobenb

Spotware
12 Feb 2014, 15:42 ( Updated at: 21 Dec 2023, 09:20 )

Please make sure that timezone of cBot corresponds to the time shift in cTrader terminal


@Spotware

jobenb
13 Feb 2014, 12:52 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Spotware said:

Please make sure that timezone of cBot corresponds to the time shift in cTrader terminal

Thank you very much. All is good now! :-)


@jobenb