Open live account Rule based trading platfom and supporting community

Go Back   StrategyBuilderFX > Main Discussion Forum > General discussions
Register FAQ MQL Files Calendar Mark Forums Read

Community Navigation

MT4 Mobile Trader
Mobile trading (m-trading) — controlling of trading account via mobile devices such a cellular phone or a PDA (Personal Digital Assistant).Wireless access technologies and GPRS provide access to the Internet.




Search Forums
 
» Advanced Search

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Old 03-11-2005, 10:57:53 PM   #1
vishwamv
Registered User
 
vishwamv's Avatar
 
Join Date: Oct 2004
Posts: 147
Rep Power: 11 vishwamv is a glorious beacon of light vishwamv is a glorious beacon of light vishwamv is a glorious beacon of light vishwamv is a glorious beacon of light vishwamv is a glorious beacon of light vishwamv is a glorious beacon of light
Re: MT4 Backtesting F.A.Q.

Hi

Iam having a doubt in importing the SBFX mt4 data,
I selected F2 and selected the EURUSD currency on 5M and downloaded the chart into Excel, similarly downloaded for 15M values into excel, there seems to be difference in either of Open,High,Low,Close values

Eg:

5M Data:
08:00 1.2070 1.2071 1.2068 1.2069
08:05 1.2068 1.2069 1.2067 1.2067
08:10 1.2066 1.2067 1.2065 1.2066
08:15 1.2065 1.2067 1.2065 1.2066
08:20 1.2065 1.2066 1.2064 1.2065
08:25 1.2064 1.2066 1.2064 1.2064
08:30 1.2065 1.2065 1.2063 1.2064


15M Data:
08:00 1.2070 1.2071 1.2065 1.2066
08:15 1.2065 1.2067 1.2064 1.2064
08:30 1.2065 1.2066 1.2062 1.2062

If you compare values of 08:00,08:15,08:30 on both time frame there is difference of 1/2pips , sometimes its more than couple of pips difference....In this case how can we do the backtest using history data....

Please see, i just pressed F2 on SBFX MT4 platform and saved it as csv file and opened in excel i find this difference...

Can some one help me how i can get the same consistent data across various time frame....
Am i missing something in downloading history data,

Pls do clarify me
Cheers
Vp
vishwamv is offline   Reply With Quote
Old 07-11-2005, 04:50:08 PM   #2
lorraine
Registered User
 
Join Date: Oct 2005
Posts: 24
Rep Power: 0 lorraine is on a distinguished road
Re: MT4 Backtesting F.A.Q.

I downloaded the MT4 files for 2005 from Alpari. All of the file names (.hst) are the same for each currency M1_currencyname. Do I import all of the files in the currency they are for without needing to shange the .hts name? Will this overwrite the previous history I imported. Thank you
lorraine is offline   Reply With Quote
Old 16-01-2006, 10:55:21 PM   #3
Barry
Registered User
 
Join Date: Sep 2004
Posts: 3
Rep Power: 0 Barry is a glorious beacon of light Barry is a glorious beacon of light Barry is a glorious beacon of light Barry is a glorious beacon of light Barry is a glorious beacon of light Barry is a glorious beacon of light
Re: MT4 Backtesting F.A.Q.

mcboogs,
Thanks very much for the trouble you took to write up this FAQ, I do a lot of back-testing in MT4, and I found it very valuable. Good work!
Barry is offline   Reply With Quote
Old 04-12-2005, 07:07:47 PM   #4
billworld
Registered User
 
Join Date: Oct 2005
Posts: 86
Rep Power: 5 billworld is on a distinguished road
Re: MT4 Backtesting F.A.Q.

I just came accross the following post at http://www.strategybuilderfx.com/for...postcount=1859

-----
Be aware that the Alpari historical data was for the MT3 platform, which means that the Open/Close prices are the midpoint of the spread (ie, open/close = (bid+ask)/2). The Highs are the Ask prices and the Lows are the Bid prices. This is how the bars are formed for MT3. This is not how the bars are formed for MT4. MT4 bars are based solely on the Bid prices.
-----

Thought I'd get this important point included in this thread for feedback and/or clarification on the accuracy of the imported data for backtesting purposes in MT4.

Bill


Quote:
Originally Posted by mcboogs
Section 2: Downloading/Importing/Converting 1M Data


(2) Download the 1M data from Alpari's Databank in whatever currency[ies] you're going to test on.

(3) Import the data into MT4 using the History Center. Go to Tools => History Center [or push F2]. Make sure you import it in proper currency and in the M1 timeframe. You don't want EURUSD data being important into USDCAD for instance.

(4) Convert the data using the period converter script included in MT4 [you only have 1M bars right now]. You have to open offline charts to do this.
-Go to the File Menu, then Open Offline, select the 1M data of the currency you need to convert. A chart will pop up with that data.
-Then drag & drop the period_converter script onto the offline chart. The ExtPeriodMultiplier int that you can modify is the multiplier you are applying to the chart. So making it 5, will convert 1M data into 5M data.
-For simplicity's sake, you need to run the period converter with the following integers to get all the backtesting timeframes: 5,15,30,60,240, and 1440.
billworld is offline   Reply With Quote
Old 25-12-2005, 08:07:37 PM   #5
Maratha
Registered User
 
Join Date: Nov 2005
Posts: 10
Rep Power: 0 Maratha is on a distinguished road
Re: MT4 Backtesting F.A.Q.

I could get the data in 1m format in MT4...I'm running the period converter script on 1m data...how do I know when the script has completed the conversion?
Maratha is offline   Reply With Quote
Old 15-05-2006, 01:43:21 PM   #6
dr_gaines
Registered User
 
dr_gaines's Avatar
 
Join Date: Apr 2006
Posts: 21
Rep Power: 0 dr_gaines is on a distinguished road
Re: MT4 Backtesting F.A.Q.

Quote:
Originally Posted by mcboogs
I decided to write up this little tutorial, because backtesting different systems comes up very often in threads on this forum. There seems to be a lot of confusion about reliability issues and how to go about achieving the most accurate possible results. I am not a programming or trading guru, but I believe I can provide a helpful little FAQ on backtesting using MT4.
Good backtesting is important when considering a system-trading approach, because you want to have some idea of the feasibility of your idea before you go live with it [at least I do]. If you're backtesting with a 50% model quality, eh... you can't really be sure what's going on. If you have a 90% modeling quality, you can have more confidence on how your system actually would have performed.


+=========================+
|MCBoogs' MT4 Backtesting FAQ v1.0 |
+=========================+

Contents:
- Section 1: Is MT4 Backtesting Reliable?
- Section 2: Downloading/Importing/Converting 1M Data
- Section 3: Configuring the Backtester
- Section 4: Other Issues


Section 1: Is MT4 Backtesting Reliable?

This question often gets pretty heated and people even get to the point of flaming each other about it. Backtesting in MT4 can be reliable, but its reliability is contingent upon the data you are backtesting on. Demo account data that is streamed in through a demo account broker has gaps, holes, and is basically not suitable for testing.
When backtesting, you want to use the EVERY TICK MODEL and have accurate 1M data to get the most accurate test possible. The 1M data is important, because the EVERY TICK MODEL uses whatever the smallest available timeframe available is and "fakes" the movement of price within the smallest available bars. Having 1M data allows for the fractal interpolation within bars to occurs only within the very narrow range of 1M bars.
The easiest [and only] solution to this is to use good 1M data. The most complete data you can get [at least for free] is from Alpari's Databank. They have data in MT native format, on the 1M timeframe back through mid 2004. However, setting up the data for use requires some doing.


---------------------------------------------------------------------------


Section 2: Downloading/Importing/Converting 1M Data

(1) You need to modify MT4 to allow for more bars. Go into the Tools Menu, then go to Options [or just hit C+O]. Go into the charts tab and put in 9999999999999 for bars in history. MT4 will default to whatever it's maximum is.

[Note: The reason MT4 has a limited bar count to begin with is because more bars (particularly when used in backtesting models) means MT4 is going to eat up more HD space.]

(2) Download the 1M data from Alpari's Databank in whatever currency[ies] you're going to test on.

(3) Import the data into MT4 using the History Center. Go to Tools => History Center [or push F2]. Make sure you import it in proper currency and in the M1 timeframe. You don't want EURUSD data being important into USDCAD for instance.

(4) Convert the data using the period converter script included in MT4 [you only have 1M bars right now]. You have to open offline charts to do this.
-Go to the File Menu, then Open Offline, select the 1M data of the currency you need to convert. A chart will pop up with that data.
-Then drag & drop the period_converter script onto the offline chart. The ExtPeriodMultiplier int that you can modify is the multiplier you are applying to the chart. So making it 5, will convert 1M data into 5M data.
-For simplicity's sake, you need to run the period converter with the following integers to get all the backtesting timeframes: 5,15,30,60,240, and 1440.

[NOTE: you can also convert 1M data to timeframes not native to MT4 if you want to do some indicator analysis or something on another timeframe.]

Congratulations, you have now imported and converted data into MT4. Now, for the sake of illustrating one of my earlier points, open up a currency you have imported data on. Look at the difference in the bars from the downloaded data as opposed to data streamed in from a Demo broker [So, if you downloaded 1M data from July 04 to August 05, look at the chart at August 05's end and September 05's beginning]. You will notice that the bars (on every time frime if you have converted them properly) from your downloaded time period will be more complete.


------------------------------------------------------------------


Section 3: Configuring the Backtester

Now that you've succesfully imported complete data, there are a few more things you need to do to run a reliable backtest.

(1) Check the recalculate option the next time you run a backtest, because you need the backtester to utilize your shiny new happy data (which it won't do unless you tell it). Anytime you import new data, you need to recalculate (I recalculate every few tests just to feel safe, maybe its a reflection of internal confidence problems, but that's for another FAQ).

(2) Check the use date option and set the date range only over a time period where you have good reliable data. This way you're only backtesting the good stuff. It will be reflected in the modeling quality percentage.

(3) Make sure the model is set to EVERY TICK. If you're not, all this hard work we just did was for nothing. I addressed why we do this earlier in the FAQ.


------------------------------------------------------------------------


Section 4: Other Issues

MT4 is a work in progress, sometimes there are strange bugs that crop up in backtesting. However, usually when you think you have a bug on your hands, there is something wrong with your code. I can't emphasize enough how important debugging is. If you have problems, check your code first because it's probably the problem. If you really think you have a legit bug on your hands, post it to the MT4 forums.
Because you are not actually backtesting on every tick that happened [you are dealing with an interpolation on 1M data], it is still not a perfect reproduction of what actually happened in the markets. Because of this, 1M and 5M scalping EAs that get in and out of trades really quickly will run into some problems just because of this limitation. The longer timeframe you are trading on, the less likely your testing is to be hampered by this.
Well, that's all I can think of now. I read this over, I think I made everything clear and have the steps outlined correctly. If you notive a mistake, let me know, and I'll correct it in my next version of the MT4 Backtesting FAQ.


Acknowledgements:
I learned most of what I know about MT4 and trading in general from these forums and others like it. Thanks to all the people who contribute that have provided me with useful tidbits of information. There are too many names [and some of them are weird, have lots of numbers in them, etc.] to list, but a serious thanks to all the StrategyBuilder contributors out there.
Best of luck in the markets everyone.


Will there ever be a simulator. A simulator would help a lot.

Dr. Gaine$
dr_gaines is offline   Reply With Quote
Old 29-06-2006, 06:09:46 PM   #7
eng_zidan
Registered User
 
Join Date: Jun 2006
Posts: 3
Rep Power: 0 eng_zidan is on a distinguished road
Re: MT4 Backtesting F.A.Q.

Quote:
Originally Posted by mcboogs
I decided to write up this little tutorial, because backtesting different systems comes up very often in threads on this forum. There seems to be a lot of confusion about reliability issues and how to go about achieving the most accurate possible results. I am not a programming or trading guru, but I believe I can provide a helpful little FAQ on backtesting using MT4.
Good backtesting is important when considering a system-trading approach, because you want to have some idea of the feasibility of your idea before you go live with it [at least I do]. If you're backtesting with a 50% model quality, eh... you can't really be sure what's going on. If you have a 90% modeling quality, you can have more confidence on how your system actually would have performed.


+=========================+
|MCBoogs' MT4 Backtesting FAQ v1.0 |
+=========================+

Contents:
- Section 1: Is MT4 Backtesting Reliable?
- Section 2: Downloading/Importing/Converting 1M Data
- Section 3: Configuring the Backtester
- Section 4: Other Issues


Section 1: Is MT4 Backtesting Reliable?

This question often gets pretty heated and people even get to the point of flaming each other about it. Backtesting in MT4 can be reliable, but its reliability is contingent upon the data you are backtesting on. Demo account data that is streamed in through a demo account broker has gaps, holes, and is basically not suitable for testing.
When backtesting, you want to use the EVERY TICK MODEL and have accurate 1M data to get the most accurate test possible. The 1M data is important, because the EVERY TICK MODEL uses whatever the smallest available timeframe available is and "fakes" the movement of price within the smallest available bars. Having 1M data allows for the fractal interpolation within bars to occurs only within the very narrow range of 1M bars.
The easiest [and only] solution to this is to use good 1M data. The most complete data you can get [at least for free] is from Alpari's Databank. They have data in MT native format, on the 1M timeframe back through mid 2004. However, setting up the data for use requires some doing.


---------------------------------------------------------------------------


Section 2: Downloading/Importing/Converting 1M Data

(1) You need to modify MT4 to allow for more bars. Go into the Tools Menu, then go to Options [or just hit C+O]. Go into the charts tab and put in 9999999999999 for bars in history. MT4 will default to whatever it's maximum is.

[Note: The reason MT4 has a limited bar count to begin with is because more bars (particularly when used in backtesting models) means MT4 is going to eat up more HD space.]

(2) Download the 1M data from Alpari's Databank in whatever currency[ies] you're going to test on.

(3) Import the data into MT4 using the History Center. Go to Tools => History Center [or push F2]. Make sure you import it in proper currency and in the M1 timeframe. You don't want EURUSD data being important into USDCAD for instance.

(4) Convert the data using the period converter script included in MT4 [you only have 1M bars right now]. You have to open offline charts to do this.
-Go to the File Menu, then Open Offline, select the 1M data of the currency you need to convert. A chart will pop up with that data.
-Then drag & drop the period_converter script onto the offline chart. The ExtPeriodMultiplier int that you can modify is the multiplier you are applying to the chart. So making it 5, will convert 1M data into 5M data.
-For simplicity's sake, you need to run the period converter with the following integers to get all the backtesting timeframes: 5,15,30,60,240, and 1440.

[NOTE: you can also convert 1M data to timeframes not native to MT4 if you want to do some indicator analysis or something on another timeframe.]

Congratulations, you have now imported and converted data into MT4. Now, for the sake of illustrating one of my earlier points, open up a currency you have imported data on. Look at the difference in the bars from the downloaded data as opposed to data streamed in from a Demo broker [So, if you downloaded 1M data from July 04 to August 05, look at the chart at August 05's end and September 05's beginning]. You will notice that the bars (on every time frime if you have converted them properly) from your downloaded time period will be more complete.


------------------------------------------------------------------


Section 3: Configuring the Backtester

Now that you've succesfully imported complete data, there are a few more things you need to do to run a reliable backtest.

(1) Check the recalculate option the next time you run a backtest, because you need the backtester to utilize your shiny new happy data (which it won't do unless you tell it). Anytime you import new data, you need to recalculate (I recalculate every few tests just to feel safe, maybe its a reflection of internal confidence problems, but that's for another FAQ).

(2) Check the use date option and set the date range only over a time period where you have good reliable data. This way you're only backtesting the good stuff. It will be reflected in the modeling quality percentage.

(3) Make sure the model is set to EVERY TICK. If you're not, all this hard work we just did was for nothing. I addressed why we do this earlier in the FAQ.


------------------------------------------------------------------------


Section 4: Other Issues

MT4 is a work in progress, sometimes there are strange bugs that crop up in backtesting. However, usually when you think you have a bug on your hands, there is something wrong with your code. I can't emphasize enough how important debugging is. If you have problems, check your code first because it's probably the problem. If you really think you have a legit bug on your hands, post it to the MT4 forums.
Because you are not actually backtesting on every tick that happened [you are dealing with an interpolation on 1M data], it is still not a perfect reproduction of what actually happened in the markets. Because of this, 1M and 5M scalping EAs that get in and out of trades really quickly will run into some problems just because of this limitation. The longer timeframe you are trading on, the less likely your testing is to be hampered by this.
Well, that's all I can think of now. I read this over, I think I made everything clear and have the steps outlined correctly. If you notive a mistake, let me know, and I'll correct it in my next version of the MT4 Backtesting FAQ.


Acknowledgements:
I learned most of what I know about MT4 and trading in general from these forums and others like it. Thanks to all the people who contribute that have provided me with useful tidbits of information. There are too many names [and some of them are weird, have lots of numbers in them, etc.] to list, but a serious thanks to all the StrategyBuilder contributors out there.
Best of luck in the markets everyone.

thank you man.....
I mported the 1M data and Converted it to 5,15,30,60,240, and 1440
but the model quality syill 50%

what can i do??????
Attached Thumbnails
Click image for larger version

Name:	50.JPG
Views:	167
Size:	37.8 KB
ID:	19759  
eng_zidan is offline   Reply With Quote
Old 06-07-2006, 03:19:46 PM   #8
slavafx
Registered User
 
Join Date: Jul 2006
Posts: 7
Rep Power: 0 slavafx is on a distinguished road
Re: MT4 Backtesting F.A.Q.

solved it myself

Last edited by slavafx : 07-07-2006 at 03:11:14 AM.
slavafx is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



Contact Us | StrategyBuilderFX MT4 Trading Platform | Archive | Privacy Statement | Top