
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have a class that I use to check for a new bar. I initiate a timer in OnInit with the iTime function. Then in OnTick I check to see if the timer still corresponds with the time of the current bar.
Yesterday I noticed a weird behavior in the Strategy Tester (ST), which doesn’t happen in real trading (I think). After adding some information to the log I noticed that I get some errors about the history getting updated if I run the ST for the first time after starting the terminal. On the second run there doesn’t seem to be a problem.
This is part of the log you get when you run the code below for the first time:
0 19:57:20 2016.01.03 22:05 Clock test EURUSD.lmx,M1: +++ OnInit
0 19:57:22 2016.01.03 22:05 Clock test EURUSD.lmx,M1: +++ Error = 4066
0 19:57:22 2016.01.03 22:05 Clock test EURUSD.lmx,M1: +++ Timer = 1451858400
0 19:57:22 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === OnTick 1
0 19:57:22 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === Error = 4073
0 19:57:22 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === Current = 0
0 19:57:22 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === OnTick 2
0 19:57:22 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === Error = 0
0 19:57:22 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === Current = 1451858400
When you start the ST for a second time (without closing the terminal) you get this:
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: +++ OnInit
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: +++ Error = 0
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: +++ Timer = 1451858400
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === OnTick 1
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === Error = 0
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === Current = 1451858400
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === OnTick 2
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === Error = 0
0 19:57:24 2016.01.03 22:05 Clock test EURUSD.lmx,M1: === Current = 1451858400
Now why would the history not be up to date before the test is actually started? And if it’s not up to date then why does iTime return a valid value the first time it’s called, and then return a 0 on the second time? I’m on build 950 by the way.