Hi zhangshuo,
Well there are a number of problems with using the strategy tester in MT4. In a perfect world one set of parameters that work on all pairs in all time frames would be nice. However, life is a little more complicated than that and some pairs trend better than others so are good for trend trading, USDJPY and EURJPY.
Other pairs are more volatile and are better for trading breakouts. So you need to carry out some form of testing to find what works with what. You can do a quick & dirty test using “open prices only” to get some ball park numbers for your EA’s parameters. But if you wanted to be sure that your prized EA was a winner then you have to test it on historic every tick data to be sure you stand a chance of it working at all in the future.
Optimising, using every tick takes about two weeks for every test on my PC, but Open prices only takes only a few minutes.
So to cut a long story short, the changes I made were to get the EA to test as well on every tick data as it had on open prices only data. So once you had your “ball park” parameters they would give similar results without waiting two weeks.
To that end in my previous posts I mentioned that letting trades complete was better than cutting them short. Example, you are in a long trade and there is a pullback and you get a short signal.
Normally most EA’s might open the short and close the long trade, but my testing has proved to me that often the short trade then failed and the trend continued with out you. So now I don’t always close all longs if I get a short signal.
Also I found that todays market is very volatile and a trailing stop can often get hit. So now I only trail my stops once on every new bar.
Also when we were developing this strategy we were opening a limit order and if it was not triggered we would update it with new entry value, stop and take profit values on the next bar. But unfortunately you can’t update the lot size, so it was decided to delete the limit order and create a new one on every new bar. As this system was for day bars then the number of cancelled orders was not to bad. I have found H4 is the best timeframe though.
So in order to achieve an EA that could be backtested quickly using open prices only I had to move all the trading code, trailing stops etc inside the trading code loop, so nothing happened between bars. Oh I did just add an exit check to close any trades if the moving averages had re-crossed, all within the trading loop. Which now only runs once every four hours on a H4 chart. Or once a day on a D1 chart.
There are other benefits to this approach. Say you were trailing your stop on a moving average normally. As the stock moves higher during the four hour period normally your stop would follow. Not so my stop, as it sits and waits for four hours before moving up. But during that four hours a spike takes out your stop and your trade, but not mine, as it was patiently waiting at a lower level for the bar to complete before moving up.
So in essence there are no real changes just modifications to make testing easier and the EA more robust.
Sorry for such a long answer.
Regards, Trader9.