BACKTESTING

 

I wonder if anyone can help me with a backtesting problem. It is well recognised that backtesting using the MT4 strategy tester requires 'better' historic data than that which your broker provides. A Google search shows several articles giving advice on how to improve the data within MT4. Most follow these steps:


  1. Download a new copy of MT4, but do not start the terminal.
  2. Go to the history folder in the new installation and delete all the files and folders there.
  3. Start the new copy of MT4, close the default charts, and open a demo account with the broker.
  4. Go to tools|options|charts and set the max bars in history and max bars in chart to 99999999999999 and 99999999999999; close MT4.
  5. Download some 'reliable' M1 data; usually Alpari is recommended, but for the last few months the Alpari history center has not been providing data.
  6. Unzip the downloaded file(s) and copy them to the history folder in your new MT4 installation. Make sure that the files are correctly named (e.g. EURUSD1.hst).
  7. Start MT4 and open the appropriate chart in offline mode (e.g. File|Open offline|EURUSD M1).
  8. If you want to back-test in time-frames other than M1, convert the M1 data to larger time-frames using the built in script called period_converter; drag period_converter to your offline chart, select the appropriate period (# of minutes, so M5 would be 5, H1 would be 60, D1 would be 1440, etc) and wait
  9. Once you have completed this process, away you go with strategy tester.

Variations on this advice are to import the data into the history centre. As above to step 6, then:


7. Open the history center (F2, or Tools|History Center.

8. Open the pair you are interested in by double clicking, so you end up, for example, on EURUSD 1 Minute (M1).

9. If there is any data show there, select the first line, press and hold shift, click on the last line so all lines are highlighted, then click on the delete button.

10. Press the import button, navigate to where you placed your downloaded file by using the browse function, and click on OK once your data is shown in the window.

11. When the data is imported, close the history center, then proceed as per #7 above.


A further variation I have encountered is to delete your demo account with your broker after step 4 (in Navigator, right click your account name and select delete from the list); do not ever open another demo or live account in this installation of MT4 as if you do your offline data will be over-written by teh broker's data.


The problems I have encountered with this are as follows (with the solutions I have attempted in brackets):


  • When I rename it as, for example, EURUSD1.hst, it is not recognised in the History Center. (the solution I have found with this is to open the file with Notepad, the save as All Files type. This means it can be found by the history center, but it still does not read the data. Therefore, if you say to the History Center that you are looking for all files type, it will recognise and import from the original .txt file).
  • When I come to open offline at step 7 on the first list above, M1 is not listed as an option. This is either following the advice in the first list, or after importing the data into the History Center as per the second list. (I have found no solution to this problem).

Basically, despite this advice being repeated in several blogs and on several websites, it does not work for me. I have tried just about every variation of the above, and some more, but have not managed to get above 25% modeling quality.


Can anyone tell me where I'm going wrong? Someone must know how to back-test using MT4 strategy tester and get 90% modeling quality!


Thanks

 

What is driving your requirement for increasing the modelling quality? Why precisely do you need it?

Just so I can try to give you an appropriate answer.


CB

 
fantasy:

I wonder if anyone can help me with a backtesting problem. It is well recognised that backtesting using the MT4 strategy tester requires 'better' historic data than that which your broker provides.


Well recognised by who? That's what some recommendations say, but IMO that's wrong.


The best data is the one that's coming from the broker you are dealing with, and not from any other source. The source might be "perfect" but if it's different from your broker's, you lose.

 
cloudbreaker:

What is driving your requirement for increasing the modelling quality? Why precisely do you need it?

Just so I can try to give you an appropriate answer.


CB

I don't know about Fantasy, but the reason I was reading this thread is because every site you go to where people are sharing EA code and back-testing results, 90% model quality is the "gold standard" -- if you can't achieve that, then your results are held to be unreliable.


RS

 

IF Bactesting shows good results, and trying the EA on Demo gives bad results, using same historical data and Demo trading of same Broker, what does that mean?

EA not good, OR Backtesting is nonsense?

 
RhythmStar:

I don't know about Fantasy, but the reason I was reading this thread is because every site you go to where people are sharing EA code and back-testing results, 90% model quality is the "gold standard" -- if you can't achieve that, then your results are held to be unreliable.


RS

My opinion (which is why I asked the question to the poster of this thread) is that the above statement is nonsense and here's why:

- Modeling is invention of tick data where none exist to fill the gaps between known checkpoints.

- Depending upon how an EA works, tick data may or may not be necessary for testing.

- With those EAs which require tick data, modeled data is in any case only useful to perform FUNCTIONAL testing.

- For BACKTESTING to have any chance of being representative, it should be real data from whatever broker service you wish to use, and at a level of granularity appropriate to your EA's needs.

- Now you might imagine why I raise my eyebrows each time someone seems to "need" a high modeling quality score without really understanding why. I don't really think the words "modeling" and "quality" should be used together in this way. :-)


CB

 

Here is a very detailed article on downloading and importing quality minute data into MetaTrader. This article has a link to high quality real Alpari tick data.


Make sure you don't just click the "download" button on MetaTrader in the History Center because the data from MetaTrader is not good.


How To Set Up MetaTrader History Data And Get 90% Backtesting Quality

 
thetrademachine wrote >>

Here is a very detailed article on downloading and importing quality minute data into MetaTrader. This article has a link to high quality real Alpari tick data.

Make sure you don't just click the "download" button on MetaTrader in the History Center because the data from MetaTrader is not good.

How To Set Up MetaTrader History Data And Get 90% Backtesting Quality

Just followed this referenced article step by step.

Ended up with new MT install etc. and 7 pairs history data on all periods in years 2001..2006

Strategy tester states no history data. This is incorrect regards the 7 pairs and history center confirms that many years are there (from M1 upwards to W1)

I saw a post which stated to uncheck the use date checkbox. The "MACD Sample" EA could be tested then, with 89.28% Modelling quality. Control pts and every tick models worked.

Again, if make one change which is to select a date range, the result is no history data. It is unreasonable to test 6 years each time - especially on my very old/slow machine...

All I'm after is a clean environment just for testing.

Can someone point me in the direction of a way to have a only for optimization testing MT install as described/or as like, that detailed in http://thetrademachine.com/blog/2009/09/29/set-up-metatrader-history-data-get-90-backtesting-quality/

Thanks.


btw, in ...\tester\history there is a ZERO byte .fxt file for each of the pairs I have asked the tester to use. Is this a clue??

 

I was reading a thread about changes in MT5, and Stringo made this point as to why there will not likely be exact tick data modelling anytime soon:

Now we don't keep fxt-files. Our generating algorithm is faster than file reading

https://www.mql5.com/en/forum/16/page2

 

My own thoughts on this subject:


1. 'Modeling Quality' - from my own experimentation I have come to the conclusion that 'Modeling Quality' means absolutely squat and can be safely ignored; please see my thread How to choose Timeframe in the Tester? An experiment. Bottom line - the interpolated data stream is almost the same regardless of the time-frame being chosen, hence is also the same regardless of 'Modeling Quality' used (25% and 90% gives the SAME result). The important thing is to choose 'Every Tick' under model and that's it.


2. Server Connection while Testing - regarding being connected or not connected to the server while optimizing, the best method is NOT to delete the account, but to enter a bogus proxy server:

MT4 menu > Options > Server Tab > tick 'enable proxy server' > press 'Proxy...' button > enter a bogus proxy server such as 1.1.1.1 > restart MT4. This method keeps MT4 disconnected from the server but Testing will still retain the Market and Account properties that the broker had the last time MT4 was connected. Deleting the account sometimes brings weird Market and Account properties that have nothing to do with the broker. If one want's to update market properties, un-ticking 'enable proxy server' will cause MT4 to reconnect and refresh it's Market and Account properties.


3. Data used - for EA's that are affected by the tick level it's extremely important to have non-indicative data, hence do not use the 'download' button but use the 'scroll back' method to download actual broker data. Problem with that is that with most brokers u can only get 2 months of data this way which is hardly enough for anything.


4. There is a method for back-testing on actual tick data, but it's not straight forward and terminal.exe must be changed in order to make it work (which might or might not be illegal - don't know). Anyway, you can check it out here: http://eareview.net/tick-data. I can tell u this method works, but it's complicated and slow. Use at your own risk.


What I would like to know is does anybody have any experience with OTHER testing platforms. I find MT4's testing platform extremely limited and would really like to hear any opinions people have on other platforms.

 
this is a very good thread ,thanks
Reason: