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?
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?
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?
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.
To add comments, please log in or register