Can't you autotrade?

 

Look in the image how you get auto-trading works in Metatrader 4.

Files:
 

Verb Guide to EA Optimization!

I'm in the process of getting ready to do some testing so decided to write an article on this topic. I'm sure others have wondered how to do it and I'm even more sure I'm not the expert but here's how I do it.

It's a pity that I can only post 4 images as there is about 11 for the full guide so I had to rewrite this slightly but oh well. A full posting is on my blog if you want to view: Step by Step Guide to Optimizing an Expert Advisor! : verbtheory trading blog

Good trading to all and enjoy!

Ever wondered how to optimize an EA?

There certainly are a lot of brains on this planet and I'm sure there are better ways that others have devised but I havent found them readily available or they are not willing to share so...

Here's how I go about the basics of optimizing, backtesting and why.

In general, the idea is to get the profit maximum up. Next step is to optimize trade management variables like breakeven, targets and trailing to increase profit factor while reducing drawdown.

We will utilize control points to get a rough idea of optimization then use every tick to test our results from control point testing. This will enable us to get faster results as every tick modelling is VERY slow.

Setup

Make sure your expert is loaded into your metatrader/experts folder.

Make sure any indicators that the EA uses are in your metatrader/experts/indicators folder.

Goto Tools -> History Center and double click the symbol you want to test. Double click on M1 and download the data. Hit Ok at any prompts and recalculate. Double-click on each of the periods and it will recalculate all of them. Important step. This way you will have all of the data you need to test. It's a good idea to go into your metatrader folder and delete any .HST files you may have before doing this to ensure your data quality is acceptable.

Open up a chart and drag the EA from the navigator in metatrader onto the chart.

Hit F6, this will bring you to the strategy tester

Choose the correct period for your EA and the symbol you wish to test.

Choose a date range to test with. Start with a small date range at first. It is much easier to optimize a small range to get an idea of how the EA could react in a bigger date range. It will help the optmization process move much faster. Start with 6 months then expand to one year, two years and so on in subsequent runs.

Select the "Expert properties" button and proceed to optimization steps.

Optimization Steps

Let's start with maximizing our profit!

Using default entry parameters, take off all trade management like breakeven, first targets, etc. Turn them all off.

Select Stop Loss and Take Profit

Enter basic value for stop loss and take profit then increment them by 5 all the way up to say 1000.

[Make sure you check the box next to each variable that you want to test and then enter the value in: start (will start testing at), step (how much to increment by) then Stop (test up to)

Make sure to choose the Optimization tab and check mark the Profit box. That way it will test for maximum profit.

Additionally switch over to the Testing tab and enter your starting balance. Depending on the trading strategy this will be critical. I usually start with 10,000 in the balance. Hit OK.

Check the "Optimization" check box.

Hit the start button and it gets to work. There will be alot of test passes to cruch so might as well go get some lunch this is going to take awhile.

As the tester progresses through each pass, it will report back any profitable passes in the "Optimization Graph" and "Optimization Results" tabs. What I do is use the graph (right click in the graph and deselect 2D surface) to watch the optimization process and wait for the results. Looking at the graph helps me see the highest profit gains first then switch to the "Optimization Results" and sort by profit to see progress.

Here is an example:

3:1 reward to risk???? drooooool.

The tops represent the highest profit gained, then I switch to results and sort by Profit.

Once all of the passes have completed, I can examine the tester results that look interesting to me. By right clicking and on the result I want, I can now set that as the input parameters to test the with.

Ooooo... 1.31 profit factor with 9.34% drawdown! :P

Now it's time to test these crude results with 90% modelling quality and see how they react.

Go back out to the settings tab and uncheck the "Optimization" box. Select the "Model" dropdown box and choose "Every tick..". This will show us an accurate picture of how the EA will react to historical market conditions. By downloading the History of the symbol to be traded, the quality will be about 90%. Of course, data feeds are all over the place so this is really just a best guess.

Usually in the beginning of testing, I like to watch the trades as they progress so I check mark the "Visual mode" box and adjust the slider for the speed at which the chart will scroll. This way I can get an even better feel for how things might react.

Hit start and there you have it! A new chart will appear and the trades will get logged for you to watch and ponder how to reduce drawdown and maximize profit.

After watching the trades you get a sense for how and where you might take profit, set targets or even start trailing. You can even pause the test in real time by hitting the pause button and measure things out to devise some trade management strategies. Here is an example:

Reducing Drawdown & Increasing Profit Factor

Since there are so many combinations that are possible when it comes to trade management, it would be better to throw these things into the tester and have it optimize for us.

Simply follow the steps above for optimizing stop loss and take profit BUTonly do it for the trailing stop, breakeven and targets.

Select control points for modelling quality again.

Check mark the "Optimization" box and hit start.

Analyze the results, pick the best one and set that as the input.

Test using "Every tick" modelling and check out the results.

Rinse & repeat until you have acceptable settings!

Now remember there are many trading strategies out there. For example, basket trading cannot be fully automated in backtesting on Metatrader but you can test individual pairs and accumulate their results then run it in excel. Just a caveat for you.

I'm going to end it here as this has been long enough of a read. I hope you have found this helpful and definitely know this isnt the A-Z guide but should get a majority of people ready to optimize and backtest!

Additionally, there are many great resources out there on backtesting that I'm sure folks will tag onto. I'll add them here on the first post but here's a good one to start with: MQL4 Articles: strategy tester.

Enjoy and Ciao for Now!

 

Verbtheory,

Thank you for the post. Looks like, I've got some work to do with regard to testing my EA's.

Also, I have checked out your forum. I registered and looked around. Upon initial review, looks like you have some good stuff out there.

You're Avatar ain't bad either.

Maybe I'll see you out there at one time or another...

Doug

 

Hi there,

Nice explanation. I have done countless testing, optimizations and cross-optimizations in my trading life. However, my testing accuracy results were 98%, not 90%. I'll look for the file where I got the info on how to get 98% and post it later, if you're interested.

Happy trading,

Ms_Mel

 

please do post, we really-2 need the method.

 

woo...amazing~~~~~

 

Well done !!!

 

Found the file.

It's actually 99% modelling quality.

Happy trading,

 

Auto Traders

Do you think Auto Traders are a legit way of trading or a scam?

 
Hilzfuld:
Do you think Auto Traders are a legit way of trading or a scam?

Maybe I'm not understanding your question right, but autotrading simply means using an Expert Advisor (EA) which you install on your computer and use with MT4, for example. The EA will automatically do certain things, based on certain parameters which you decide (enter when moving average crosses, exit at TP or SL), etc.

So find a good EA, test it to death, then use fully automated or semi-automated (for example the EA enters trades but you manage them afterwards).

Hope this helps and if that wasn't your question, I'm sorry. Please rephrase and it will be my pleasure (and others I'm sure) to help.

Happy trading,

Reason: