Timing functions in strategy tester

Back to topics list To post a new topic, please log in or register
avatar
14
jt27 2016.05.03 23:53
 

I was hoping someone could help me understand the strategy tester a little better (newbie here).  I've am using the OnTimer() function in my EA basically as follows:

 - Every 1 second the OnTimer() function gets called

 - I do stuff in that function

 - After 10 iterations of that function (after 10 seconds elapse) I write a Comment() in the terminal window.

When I run my EA in a live terminal it works just fine, the Comment appears after 10 seconds, but when I run the EA in the strategy tester that Comment never appears.  Does the strategy tester not execute the built in time-based functions?  Is it simply executing tick data sequentially with no regard for how much time actually elapsed between those ticks?

 

Also, this should probably be another thread, but is there a built in function to place a trailing stop?  Or does that have to be done programatically? 

avatar
119
Doerk 2016.05.04 00:29 #
 

The tester does not support OnTimer(). Use OnTick(), check if you are in tester mode (IsTesting()), count your time using GetTickCount() for realtime or TimeCurrent() for simulated time and call OnTimer from there.

Trails have to be programmed.  

avatar
14
jt27 2016.05.04 01:20 #
 
Doerk:
Doerk:

The tester does not support OnTimer(). Use OnTick(), check if you are in tester mode (IsTesting()), count your time using GetTickCount() for realtime or TimeCurrent() for simulated time and call OnTimer from there.

Trails have to be programmed.  


Thank you.  So if I were to get a timestamp of each tick using one of those methods, are you saying those timestamps will work when I am in the tester? 

avatar
119
Doerk 2016.05.04 01:43 #
 
Yep. Assuming you are not interested in the real time, use TimeCurrent() which is synchronized with the incoming ticks.
avatar
14
jt27 2016.05.04 04:31 #
 
Doerk:
Yep. Assuming you are not interested in the real time, use TimeCurrent() which is synchronized with the incoming ticks.

So will the tester execute the ticks on the same timeline as they actually happened?  For example, if there were 289mS between two ticks as they occurred in real life, will the tester place 289mS between those ticks when I run my EA through it?

 

Thanks again. 

avatar
119
Doerk 2016.05.04 07:37 #
 

Your idea is right, but unfortunately not the reality. The tester interpolates (guesses) the timing, and thats the main reason, why you can easy make a million percents in tester while the same EA is a loser in reality. To achieve such an accuracy, you will have to buy real tick data somewhere else and test with those.

And for your next question: Take a look at Dukaskopy, they provide a tool and real historical backtest data.

Back to topics list  

To add comments, please log in or register