re. Back testing times seem to be wrong, it also seems to ignores OnStart

Created at 27 May 2016, 14:01
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!
ChasBrownTH's avatar

ChasBrownTH

Joined 20.05.2015

re. Back testing times seem to be wrong, it also seems to ignores OnStart
27 May 2016, 14:01


I apologize if this was covered already, but I tried to search and found nothing relevant.

If I put 

     Print("Hello World"); 

in OnStart it shows up in the Log file when forward trading, as it should. 

But the same Print statement does nothing in Back-testing, which is pretty odd? In fact the whole back testing Log file seems to start 'late' and ignore some early events that ought to be published in there.

I added "Hello World" to check what was happening, because some of my variables also do not work in Back-testing.

Also in back tests the Server.TIme gets set to the last day of the test period, not the date and time of the actual past event. Is there a way to get the time of the past event, for example at each Tick ? Back testing sees the correct time of Trades, but nothing else seems to work, making further time related actions impossible, although they work in 'Forward' time.

For example I have tried using:

    Print("TimeIs: ", MarketSeries.OpenTime.Last(0));

to get the time of a past Bar, but it does not work.

Try it yourself:

    OnTick { Print("ServerTime is: ", Server.Time.ToString()); } just produces 'nonsense' not related to the past event, but generally just the last date of the test period, which is quite useless since we know that already.

Am I doing something stupid or just plain wrong? I admit am still a bit of a newcomer to cAlgo and also C#,

Is there a 'fixable' reason why Back-testing seems to ignore OnStart and Server.TIme is wrong? 


@ChasBrownTH
Replies

ChasBrownTH
27 May 2016, 14:43

RE:

ChasBrownTH said:

How very bizarre, but neither of these 'errors' happens with a blank New Robot.

Therefore it has to be something 'odd' or 'broken' in my Robot, OOooooops ! 

I shall review every line, but what on earth could cause the Log file to get truncated and Server.Time to get mangled?

My apologies to Spotware for reporting a non existent error, and my thanks to them for helping me find 'the error of my ways'. ;)

Mea Culpa, so time for me to go and find my hair shirt I think, plus the flail! ;)


@ChasBrownTH