How I get 99.9% modelling quality on MT4

Now I have your attention, because it’s a pretty big claim. After following this thread http://forums.babypips.com/free-forex-trading-systems/65546-millionaire-ea-417-million-profit-5-years.html I am offering my process for criticing by those who know better and as a starting point for those who don’t. At the end I will provide a link to where you can view an EA I have modified with a lot of thanks to my programmer Brian (he knows you he his, cheers so much bro). To me this shows that whether for the right or wrong reasons I believe my technic works and can be relied upon.

Also please excuse any duplication in this thread that I have made in the above thread.

First I’ll start with a quote from The Original Turtles Trading Rules

"There is no substitute for statistically valid historical research when developing mechanical trading systems. In practice, this means learning how to program a computer to run simulations of trading system performance.

There is a lot of good information on curve-fitting, over-optimization, trading statistics and testing methodologies on the web and in books, but the information is a bit hard to find amongst the hype and bull. Be skeptical, but keep an open mind, and your research will pay off."

To me, EA development is about allowing the trader to do that “statistically valid historical research” to create their mechanical system. But the key words are statistically valid. That means >99% modeling quality. And we all know that’s impossible with MT4 as a stand alone software.

I also want to acknowledge ClarkFX at this stage to. If you haven’t, head here and read this thread http://forums.babypips.com/expert-advisors-automated-trading/52287-tutorial-complete-backtesting-analysis-setup-100-free.html. This is where I started my journey. My knowledge of MT4, strategy tester, back testing, etc is but the snow that falls on the tip of the iceberg that is ClarkFX knowledge. Thank you for your words my friend.

Software

For this process we will need the following software set up:
• A separate dedicated MT4 platform
• StrategyQuant’s Tick Data Downloader
• Tickstory Lite and/or Tickdata Suite

MT4 Platform

We are going to go to a lot of effort to collect and process our data. And there will be a lot of data. We’re talk 10’s even 100’s of gig worth. And it’s going to take time. We want to protect that investment by using a separate platform. No need for an account or license. Don’t need our data contaminated by incoming server data. Keep your back testing separate to our trade account. Here’s a easy one http://files.metaquotes.net/metaquotes.software.corp/mt4/mt4setup.exe

StrategyQuant’s Tick Data Downloader

This free software will allow us to download our tick data directly from Dukascopy. More information and download link can be found at StrategyQuant’s website here StrategyQuant Tick Data Downloader . Two things, first I recommend creating a seperate file on you C: drive to install this in. It just avoids windows saving/file modification issues. Secondly the latest version is 2.3. I use 2.2 still. If it ain’t broke, don’t fix it.

Tickdata Suite (Optional)

This is the first MT4 patch I used. All the information and download links can be found here. Forex Tick Data | Birt’s EA review . Now, you will learn more there than I can talk about here. But I have two issues with it. One, you have to pay a small reoccurring license fee. Two, it’s still a lot of effort to download and convert this data. But if you do all of this, it has the big advantage of having variable spread feature for back testing. Tickdata Suite is designed as a standalone patch and can be used as such. I use it because it seems to add a high degree of stability to my system. It is optional and if you don’t want to pay the fee, you don’t need to install it. If you do, download and attach to your new MT4 platform first.

Tickstory Lite

This is the program I currently use to convert my data and run my MT4 platform from. All you need to know and the download link can be found here Tickstory - The Historical and Real-time Market Database for Traders . Best of all its free but fell to donate to the lads. Its great work they are doing. Again, install Tickstory Lite into a separate file on your C: drive. Once installed go into its settings and link it to your MT4 platform. Tickstory Lite comes with a full help guide and user forum.

So now we’re ready to collect some data.

Data

Right, raw tick data is available readily from wherever it is you want to get it. It is your choice how you obtain it. I source my data from Dukascopy. Their raw tick data is very high quality. Any issues I have with it is that it is missing data, not much just a little. So little that it appears to have no bearing on my results.

I use StrategyQuant’s Tickdata downloader for this task. It’s as simple as going into the program, choosing the pair, selecting the period to download and hit start. Go into the Configure settings first but and untick the automatic export to CSV function. One, we are only interested in the raw tick data not converted CSV files. Two, it takes time to convert this data.

Tickstory Lite also can be used to import data directly from Dukascopy. However I find it much slower than Tickdata downloader.

Once you have downloaded your data files you then need to transfer them to Tickstory Lite.
Use windows explorer to open up Tickdata Downloader. Inside find the tickdata file, open that and you will see your downloaded pairs. Copy those files. Next locate Tickstory Lite on C:drive. Open and paste directly in you pair files.

We are now ready to convert our files for MT4 to use.

File conversion

Raw tick data from Dukascopy comes as a .bi5 file. MT4 cannot read these files so they have to be converted to .csv, .fxt and .hst files. Luckily for us, Tickstory Lite is going to make a hard job very simple. Open up Tickstory Lite select the pair you want and click on the export to MT4 button. A pop up screen appears, you input your settings and hit OK. The program will then collect, convert and export the data directly to your MT4 platform ready for use in strategy tester.

The big plus in Tickstory Lite is an inbuilt script you deploy on you trading account and it collects all your brokers specific settings. Spread, lot size, leverage, swap etc. It stores this as a .mt4config file. You then use that information in the settings allowing your data files to be fine tuned specifically to your account and broker.

Back Testing

Now the fun begins. The final stage is to launch MT4 for back testing. First, open Tickstory Lite. Next click on the launch MT4 terminal button. This is important. In order to obtain 99.9% modeling quality, MT4 strategy tester needs to be told where to obtain the files it has to read. By default this is from its history center. When you launch using Tickstory Lite the patch tells it to look for the .fxt and .hst files you have carefully created. And this is where you get your modeling quality from.

So now you simply set up a back test as normal and watch and admire your handy work as each bar is formed tick by tick by tick.

Forward Testing

Now if you are lucky enough to develop an EA that works it’s time to forward test in a demo account. This is the stage I am up to with my particular EA. Bots behave very differently during demo testing compared to what might have been.

My Bot has had money management issues, placing multiple pending orders, not placing orders and excessive modify pending order issues. These issue weren’t present during back testing and could only be resolved once forward testing takes place.

I have had this bot running from mid Feb. Can you tell where I got the bugs sorted out.?


Here’s the full detail statement.

BnB Turtle Scalper.zip (9.64 KB)

Also, don’t limit yourself to just one demo account. Test your bot on a foreign broker. I am also testing this bot in a demo account competition being run at octaFX.com. If you follow this link you can see how it is performing. Forexbob’s statistics in round 1 | OctaFX

It’s not performing as well, but then my data has been optimized for my broker so that is to be expected. But it is performing well so that tells me my bot has a sound theory to it.

Live Testing.

The great unknown. As I said at the beginning, the purpose of an EA to me, is to allow one to do the historical research required to develop a mechanical trading system. Not for live trading. With that said there is a time and place for everything and we can’t always be at the charts analyzing the markets. They do have their uses.

But by now you show know the system inside out and be ready to trade live and manually. Your EA is now your trade advisor, providing you alerts for opportunities. It’s up to you to fire the trigger.

So there you have it. How I go about getting 99.9% modeling quality out of MT4 strategy tester. A process where I can be confident in the quality of my results.

1 Like

So my programmer has just tweak our Bot. Here are the results.


So I will be applying this new version to both my test demo accounts and watch it at work for the next week.

Here is last week results,


And Year to date results,


I will still test this for all of May, but If I’m happy I go Live in June. Look forward to reporting back

Hi bobbillbrowne,

Not wishing to be negative but I think that there are two major issues that backtesting just does not address.

Number one — Spread size
The most obvious is the spread size, even with the best tick data in the world, you don’t and can’t know the varying spread sizes that were present during the backtesting period.

As I see it you have two options to this problem. Use a fixed spread size for testing your system and then add a spread size filter to your EA so that you don’t ever enter a trade at an untested spread size. Unfortunately when trading live this won’t stop an unexpected larger spread size during the trade or at the exit point effecting the performance.

Or the second option, is to setup and test your system with a spread size double what you would expect in the market.
Simple solution, but EA performance normally deteriorates badly as spread size increases and your system may stop being profitable above a certain spread size. Good to know this value though, as you could add this value as a maximum spread size filter for trade entry.

Problem number two — Market conditions
The market has changed so much just in the last few years due to banking crisis, world conditions, robots etc.
So, is it realistic to backtest over the last ten or twenty years and expect this to look anything like the future? No I don’t think so.

It may be better to test over the last year and pick the best six months and the worst six months and then optimise both and then set your parameters for the middle ground. Then re-backtest a year of data every month with the new months data and make any adjustments as necessary going forward.

What I have done in the past is run the same strategy for a month on a small live account, a demo account and then at the end of the trial period backtest over the same month period to see if all three agree.

Good luck I am enjoying your progress.

Regards, Trader9.

Nice post mate. It complements the initial guide.

It is true that reproducing live conditions is hardly impossible, we can just approximate to it. With MT4 and the fixed spread I also adjust the spread to the worst number I’m willing to accept (above the average). For demo or live I have to add a filter to operate always under my worst expected spread.

I’m planning to setup properly ninjatrader or cTrader to have a second testing environment. I just need to dominate a bit more mt4 backtesting.

Bro, only positives here. My knowledge is so little. Solving these problems is all part of that complex beast Forex!

Problem one spread. First step with spread is to ensure you brokers data aligns to your source of tick data. Here’s two screenshots of my tick data on the demo and tester account (I have attached the png files).

TESTER ACCOUNT


DEMO ACCOUNT


Hard to spot any differences. I’m trading ecn and using ecn data. Dealing desk data vs ecn - forget it bro. Variance is just too great. Also remember we are looking at bid price, what is the headache is the spread. Again, I think the secret is your broker. The spread size wants to be stable as 24/7. My spread on the EURUSD is 1 point, occasional 2. This allows me to use the fixed spread strategy successfully. I can even factor in 7 points for the commission I will pay to my broker. So i use a fixed spread of 9 points to maintain repeatable results. You can use tickdata suite to compile your .fxt files and use the variable spread feature on it. But you will be back testing against your tick data source spread, not your brokers, again to much of a statistical variance for reliable results.

Total agreement about insurance bro. Spread (and slippage) filters are valuable assets to have to filter out bad market conditions to trade in. Talking of which.

Market conditions — HA HA that’s simple bro’s. They are called expert advisors not expert traders. You’re the expert trader. Simply turn the bot off if you won’t trade in the market. If you don’t know your bot well enough to know how it will behave under certain market conditions (trending, whipsawing, flat) then give it up period. As I always say, bots are there to the statistical testing one needs to develop their manual system.

Optimizing is a skill. Your not looking at profit factor alone. Draw down and # trades (trades = commission) are also important.

This week’s results looking strong at 8%, hope the week finish’s well. Look forward to reporting some results

All the best bro, Bob

Pitcures GBPUSD.zip (92.7 KB)

Here’s the result from last week in my demo account and year to date



Good and bad week. Good the bot behaved perfectly as it should, no bugs, made a profit. Bad because I changed some parameters based on back test results and the rest is history. I run a very tight trailing stop in this bot. It has a trailing stop and trailing step. Turns out that when the two match, the first movement of my stop loss was to my entry price, effectively becoming a break even move. So not allowing my bot to work as it was designed to. Now the results of back test where fine but they don’t factor in commission. A factor that looks like 50%. A big chunk. So resetting it’s parameters again (its a never ending process) and put it to the test. Here are some of the trades it took.


And few would argue differently,that’s why you need to Forward (demo) test your bot.

So everthing on track to go live with in June, we’ll see how things go this week.

All the best all


Hi bobbillbrowne

Can you please advise me on a problem? The issue is that the information is so large when I convert the tick data that my C drive is full and I don’t have enough space but my other drive has lots of space… Is there a way to move the installation folder of the custom indicators/EA’s/price history , to another folder??? Thanks in advance…

Don’t know if I can bro, but I’ll give it a go. I built my computer for the sole purpose of trading so I don’t have that problem.

If your data source is dukascopy then the .bi5 files that are generated are the smallest. Keep whatever method used to collect it (in our case -tick data downloader) on your C drive. On one of your other drives run your conversion software and mt4 terminal. So again in our case that’s tickstory lite and our mt4 platform dedicated to testing. I would dedicate a whole drive for the purpose strategy testing. You don’t need to be connected to the internet for testing. mt4 is stand alone. All you use tickstory for is to launch your mt4 platform. Tickstory doesn’t need to be connect to the internet to run the conversion part of the process. And since your mt4 has been loaded into its settings the output files will be placed there. So then its just a simple case of copying the .bi5 files from tick data downloader to tickstory.

How you physically go about doing this I don’t know bro. Maybe some-one smarter can help, like these pills me doc gave me lol

Hi there again.

The problem is that when I export (convert) the files to the independant MT4 this is the directory of the logs:C:\Users\Pesho\AppData\Roaming\MetaQuotes\Terminal\9F86138A4E27C7218E9EC98A5F8D8CA1

and the data is like enormous… do you know how can these directory of the logs can be changed?
Thanks in advance

I’m a newbie can you please tell me what this does

That’s the red button bro, don’t push that the thing will explode :slight_smile:

What about this do you want to know. When your developing your strategy (and there’s is a whole heap variables involved in that) you got three ways to test it. One, sit in front of the screen and go for it - not a bad strategy in itself. Two, go back and study chart after chart. Or three, build a bot and back test it.

It is possible to use mt4 strategy tester to do valid historical research but bro, its not easy and it takes time. Lots and lots of time. Choice is yours

Hi, is this EA available publicly?

If you can get it to work PM bro. It crashed on me when the EURUSD did the same last year. But I have been revisiting it by chance and reckon it’s worth another go. Also got some ideas to improve it.

Hey Bob.

How is the work coming along? The post you mentioned in the beginning of this thread, I read through all of it, every post, and was a bit confused as to why he seemed to up and vanish. Do you think he made it and forgot about us? Lol. Any way, I was wondering what you meant by the EA crashing on you?

Always watch out for the red button :smiley:

Don’t know what happened to the krugman. Personally I don’t mind sharing what I do, right, wrong indifferent. It helps in my learning process. Sometimes I have a bad attitude but that’s just me.

So this particular bot and it crashing, what do I mean. Well I’m happy to say I got caught up in greed. When my friend and I first designed this bot it was as a break-out strategy. But when we started back testing results indicated that it could also be a very good scalping bot that produce far greater returns. So I set it up as a scalper on a live account and let it run. This was on the EURUSD pair, started off ok but then the market topped and reversed and the rest is history. Slippage, commission cost all those variables associated with live trading made it unprofitable. Greed is a killer in this game and I knew that but still got sux into it.

Testing however is a very boring long process, demo or live, and while I was testing I went back to trading off tick charts my first love. And my work has been there since.

But one strategy doesn’t make a plan and I’m looking to diversify across asset classes. The breakout strategy is a valid strategy and I’m looking to revamp this one. Small risk traded over a basket of pairs for a modest return.

Here’s a couple of results just in EURUSD and GBPUSD over 2014



The work never stops and as old m8 Jake says, you have to work harder than everybody else.

Sorry man, my knowledge is next to zip on EAs. Why did the bot crash when the pair reversed? Is it not able to switch sides? My terminology is probably off (switch sides) but I don’t get how it lost it when the market reversed?
And if I ever learn a thing or two about creating EAs, I would love to help, but since I don’t have that knowledge now, probably not much I can do lol.

Na it had lots to do with what I was trying to do and that was scalp. Demo and back testing are very different to that of a live account. A little problem known as slippage, spread and the effects of commission become real. Now this isn’t too much of an issue when chasing 50, 100 or 200 pips. But when you’re chasing only 1 or 2 it becomes very real. During back testing and on a demo price always gets filled at the requested price, but expose yourself to a live environment and the for-mention issues come into play. A lesson learnt on my side.

So again I go back to my original belief. For us armchair speculators bots are great for doing the research and testing of our strategies but that’s where it ends. As a general rule.

Thank you for sharing this.
Everything worked properly and I managed to get data from 2006 to 2014.

Testing is done with 99.9% quality.
One issue though and I still haven’t figured it out yet.

When I try to do a backtest on the full period (2006-2014) it always stops somewhere around 2010.
And if I try to to the backtest for 2011-2014, the testing will not start.

Any ideas why? I tried re-downloading and re-converting the data. Didn’t help.

Sorry for taking my time in getting back to you. My understanding is that MT4 can only access 4G of data for backtesting. Given that a year can represents 1 G then you can only handle 4 to 5 years testing at a time. However Birts tick data suite does overcome this. Its one of the reasons I use both programs. Also Birts tick data suite allows me to open multiple windows for testing.

Are you using the tickstory lite, Birts tick data suite or both my friend?