How To Use Strategy Tester In Mt4
What is the MT4 Strategy Tester?
The MT4 Strategy Tester is a useful tools straight included in Metatrader 4 to examination your Expert Advisor with historical data. Information technology helps you lot to optimize your EA'south functioning to the maximum. Acquire how to optimize your Expert Advisor with more than x'000 unlike settings in a single run to squeeze out the subconscious force of your EA.
Chapters
- History Center
- Strategy Tester
- Backtesting
- Analysing
- Optimization
- Frontward vs Backtest
History Centre
Earlier y'all can backtest y'all EA, you lot have to download the latest history dates from your Broker. Go to Tools > Options and enter in the „Max confined in history" and „Max bars in chart" the number 9999999999999. Restart your terminal and press F2 on your Keyboard. Go to the currency Pair you lot want to download data from. Make a double click on all timeframes until they are all colored like on the picture below. Then click on „Download" > OK. This will take a while.
Strategy Tester
Go to View > Strategy Tester to open it. Fill in all of the necessary data.
- Skillful Counselor: Select your EA you want to backtest (for this article I choose the free "Bollinger Bands EA Basic" (available here).
- Symbol: Cull ane of the Symbol y'all downloaded earlier.
- Period: Cull the timeframe you want to test your Expert Counselor on.
- Model: Choose the model you desire to test your Expert Counselor on.
- Every Tick (the most precise method based on all available least timeframes to generate each tick)
- Control points (a very crude method based on the nearest less timeframe, the results must not exist considered)
- Open prices only (fastest method to analyse the bar just completed, only for EA that explicitly command bar opening)
- Spread: Choose a Virtual Spread for you backtesting. A reasonable value is 2 pips. (set twenty for a 5 digits banker and ii for a 4 digits banker)
- Use engagement: Fill in from when to when you want to make the backtest.
- Visual mode: If you choose this option, the chart will pop-up and you can easily and visually see how you robot is trading. With the petty bar you lot can adjust the speed of the calculation.
- Expert properties: Here you tin modify the properties of your robot. In the "Testing" tab y'all can cull how much Initial eolith and Currency you want to test besides as if you desire to merchandise Long & Short positions or but one of them. Become to the Inputs tab to change the Value of your robots Variables.
- Symbol backdrop: Shows you some useful data well-nigh the current Symbol
- Open chart: If your backtest is finished you lot tin have a await at all trades on the chart.
- Modify practiced: If yous take the source code of your Expert Advisor you can modify information technology by clicking here.
Backtesting
If y'all have set all parameter listed higher up, you tin start your backtest past clicking on the "Start" button. If the backtest is finished you find below the Upshot tab and three new tabs. The Graph, Report and Journal tabs. Read the next chapter "Analysing" to learn more about these tabs.
Analysing
After backtesting your Expert Advisor information technology'due south important to analyse the test results
Result tab
In the result tab you find the whole trades your EA has made during the exam. The Order Type (buy, sell, buy stop, sell stop, buy limit, sell limit), if the Guild was deleted, mortified, closed past the EA, or reached the Take Profit (T/P) or the Cease Loss (S/L). Yous can run across the Order number, his open toll, End Loss and Take Profit (if bachelor), the trades profit and the current business relationship balance.
Graph tab
In the graph tab is not much to say. Y'all tin can run across the graph of the EA's trades. On the right is the account residue and below the number of trades.
Report tab
This is an important tab. All the detailed information are here. I merely explain those who are not self-explanatory and important for me.
- Gross profit: Total profit, the sum of all profitable (positive) trades.
- Gross loss: Full loss, the sum of all negative trades.
- Profit factor: Profit cistron is equal to the gross turn a profit divided by the gross loss. Higher is better, anything above 1.5 is good.
- Expected pay off: Is the full cyberspace profit divided by the number of trades.
- Absolute drawdown: The absolute drawdown shows the difference between the initial deposit and the smallest value of the equity.
- Maximal drawdown: The difference between ane of the local maximums and the subsequent minimum of the equity. The largest value is taken.
- Relative drawdown: Disinterestedness drawdown in monetary terms that was recorded at the moment of the maximum equity drawdown in percent.
Journal tab
The journal tab of the MT4 Strategy Tester is not important to nearly of you. Information technology is only interesting for Proficient Counselor developer to detect some errors in the code.
Optimization
The possibility to optimize your Skillful Advisor in a single run is the nigh impressive nigh Metatrader Strategy Tester. If y'all use this possibility correctly it will assist you a lot to observe the perfect settings for your EA. To employ this selection you accept to bank check the "Optimization" box in the Settings tab of the MetaTrader 4 strategy tester and then go to the "Practiced backdrop". In the "Testing" tab yous can cull on which criteria the EA should be optimized for. Here I cull "Profit Gene", then the Metatrader Strategy Tester will optimize the EA for maximum Profit Factor. But yous tin also set up other criteria.
Now go to the "input" tab. Here we are interested by the "Outset, Pace and Stop" columns. For this demonstration, I will test some dissimilar Take Profit levels in combination with some dissimilar Stop Loss levels and the Changed Strategy part. I check the box next to the Take Profit an Stop Loss Variable and set the Start = twenty, Stride = 15, Cease = 95 (see the picture beneath) and the Changed Strategy role to Start=simulated, Cease=true. Press OK and Offset your Optimized backtest. Metatrader Strategy Tester will at present exam your EA'due south turn a profit several times with the combination of all these different settings. The Take Profit and the Stop Lose have 6 setting (20, 35, 50, 65, 80 ,95) and the Changed Strategy has ii (false and true). This makes a total of 72 passes (6x6x2).
After the calculation is finished (information technology took me nigh 7 minutes) you volition be able to go to two new tabs called "Optimization Results" and "Optimization Graph". There are the results of all Passes. On the Optimization Result (on the picture sorted by the most Profit factor) y'all will see all 72 passes with their Profit, Full trades, Profit factor then on. You can see that the pass 69 fabricated the best Profit Factor. It made one.36. This is not overwhelming skillful only we optimized only 3 functions. Click with the right mouse push on the best result and choose "Ready Input Parameters". If your tester jams, look in the journal tab for clues. Information technology may be because you lot take tried to optimize too many parameters in the one pass.
On the "Optimization Graph" you see all the pass beneath and the optimized parameter (profit factor in this instance) on the right side.
If you at present go to the input parameters you lot run into that these settings are now saved. Yous see that the Take Turn a profit is nonetheless fifty, the Terminate Loss has changed to 95 and the Inverse Strategy in no on true. Brand a normal unmarried backtest with these settings to see all transactions or to visualize the trades in a chart window. (You can at present besides save the settings to admission them later)
If y'all now take a look at the EA yous meet that his performance has increased significantly.
Forrard testing vs Historical backtesting
Subsequently you lot optimized your Skillful Counselor you want to exam it now in a forward examination. Forrard test means to test your EA in a demo or real business relationship with real market conditions. Try it first on a demo business relationship for sometime so you tin start on a existent account. When you lot first test your optimized EA in a forward test you will probably speedily encounter that you lot are loosing coin in the forward test although the backtest where incredibly good. Let me give you some reasons why this is so and how you can prevent this.
Optimized Parameter
If you optimized an EA y'all do non merely want to take the settings with the most profit but the settings with a turn a profit and a adept profit gene (the profit of all winning trades divided by the loss of all loosing trading). To brand sure the strategy tester optimized the EA with a high profit cistron go to „Expert properties > Testing > Optimization" and set the Optimized parameter to Profit Factor.
Incorrect Model
Before you optimize an EA yous have to brand certain what Model you take to utilize. If you know that y'all EA only trades on the opening of a Candle and you use only Fixed SL an TP and no Position Direction like TrailingStop, yous tin can utilise the „Open price simply" or „Control points" model, which are very fast. But for everything else you accept to choose the „Every Tick" Model. Or you optimize information technology beginning in one case with the Control points and bank check the upshot with the Every Tick model. If the results are more or less equal, yous can simply optimize this EA with the „Control points".
Over-optimization
The first thing is that yous tend to over-optimize your EAs. Let me quickly explain what over-optimization (bend fitting [wikipedia]) is: You have to know that with the mt4 strategy tester you can hands get a actually skilful backtest bend by backtest all input parameters of an EA with a lot of steps. Just y'all aren't looking for a smashing backtest result. You lot want to be successful in forwards testing then you take choose less steps. For example if you want to optimize the StopLoss 40 to 160 and the TakeProfit from xx to fourscore, exercise not optimize every single step. Choose a step of 10 for the StopLoss and a step of 5 for the TakeProfit. This way the backtest volition be less assisting but less over-optimized. Another reward, if yous take less steps, is that the optimization process is much faster. So how to make sure your backtest is not over-optimized? You can do this with a simple pull a fast one on. If you lot examination 1 yr dorsum you desire to split off the last third or fourth of the year and optimize simply the rest. If y'all optimized your EA test it on the slice that you lot just dissever off. If you lot get more or less an as good performance, your are adept to get. If your EA is over-optimized yous volition see the bend sloping downwards and you lot accept to re-optimize the Expert Advisor again.
Backtest Fourth dimension
Exercise not backtest your Expert Advisor too far in the past. Information technology is no useful if yous optimize your EA back to the Twelvemonth 2000. The markets have changed a lot. You want to optimize you EA based on the latest History (one-3 Years). But for what time period should yous test your EA? In my experiences, the backtest time is not essential. Y'all want to have about 200-300 trades in a backtest to make it meaningful regardless what time period you backtest.
Diversity in forrard testing
Do not just accept ane setting for your forward testing. You can make the optimization process for multiple Timeframes and Currency pairs. Y'all tin can easily forwards exam many settings on your VPS (Virtual Private Server). Have multiple settings for every Currency Pair and Timeframe. Yous only have non to forget to set a different MagicNumber on every nautical chart! Also employ myfxbook or fxblue to track your account.
Expert Advisors with small-scale SL/TP
If you have an EA that places pocket-size StopLoss and TakeProfit its hard to get it good optimized. In the Backtest you do not have Slippage, order open filibuster and changing Spread. And so this 3 thing will take proportional more than issue on EA with small StopLoss and TakeProfit. You will barely notice this on an EA with StopLoss and TakeProfit in a higher place xv-20pips. The but affair you can do here is to set a fixed Spread (well-nigh two pips) for your backtest and make a frontwards exam. Not only on a demo but also an a Alive business relationship with the minimum of lot.
Spread filer
If forward test your Expert Advisor you lot want to brand sure that you lot use a spread filter. Sometimes the spread of a broker tin can rise rapidly and if you open a trade with a spread of 10pips you already lost almost 8pips.
Overview
So, in general, we tin can bunch it together like this:
- Use Every Tick
- Use few optimization steps
- Expect for most 200-300 trades.
- Test the EA forrard in Demo or Live with small lots.
- Use a spread filter
Yous know now how to optimize an Expert Advisor in the Metatrader four strategy tester. If you lot liked this tutorial feel free to share this page. Experience free to leave a annotate or open a discussion in the forum.
How To Use Strategy Tester In Mt4,
Source: https://quivofx.com/school/metatrader-4-strategy-tester/
Posted by: myersmarder.blogspot.com
0 Response to "How To Use Strategy Tester In Mt4"
Post a Comment