Update VR Watch list and Linker a new version 22.082 from 12.08.2022

We are in social networks
trading-go.net russian version
Trading-go.net English version
Apply

How to test Forex and Crypto Expert Advisors
Detailed Instructions for MetaTrader 4 and MetaTrader 5

The best test of a trading Expert Advisor is to launch in the conditions as close as possible to real ones. You can get the most qualitative results of testing a trading Expert Advisor by launching testing on training and demo accounts.

Why testing is needed

Testing is the running an Expert Advisor or indicator on historical data with a pre-installed set of settings. Testing is carried out in order to detect errors in the code of an Expert Advisor or indicator or errors in the trading strategy. The test can be launched in visualization mode, which allows you to see all trading actions and indicator signals right on the chart. Such testing is much slower than with disabled visualization. The visualization building process heavily loads the computing powers of the computer to render all the data. Therefore, you need to clearly understand what goal you are pursuing when testing.

how to test an Expert Advisor

Testing the Expert Advisor or indicator allows the trader to evaluate the program work on historical data. The main criteria for evaluating a trading Expert Advisor or indicator:

  • Errors in the program code – thanks to the strategy tester, the trader does not have to wait for a long time. By running the program in the strategy tester, the trader will receive a log with all the actions of the trading Expert Advisor in a few minutes. This log records every action performed on historical data. Each purchase and sale of a financial instrument, each modification of a position, mathematical calculations, and, most importantly, errors in the operation of the trading algorithm are described. Errors are non-critical when the EA can continue its work, for example: "Failed to modify the position at the first attempt" and critical, when the EA stops its work and turns off its entire trading algorithm with complete unloading of the code from the chart, for example: "zero divide". The critical errors can lead to the complete stop of the trading Expert Advisor and the entire terminal as a whole.
  • Compliance of the trading strategy with the declared data – the trading Expert Advisor is written and developed by a programmer. Depending on the goals pursued by the developer, the description of the program and its capabilities may not correspond to the real picture. Testing the EA in visual mode will allow the trader to compare the trading strategy with the description provided by the author.
  • Profits and losses – it is necessary to evaluate the financial result taking into account many factors:
    • Trading on historical data – despite the fact that history is cyclical, it is most unlikely that the segment on which the test is done will be repeated in the future.
    • Trading environment – testing will not repeat the spread changes, trading slippages, requotes, tick arrival rate, gaps of the arrival of new prices. The trading environment in the tester is very different from the trading environment in real trading mode.
    • Quality of financial instrument history – the absence of part of the history or the absence of part of the prices will not allow to qualitatively determine the financial result. Nowadays, even with a history quality of 99%, it is almost impossible to get an accurate picture.
    • Programmed trading strategy – trading strategies based on VR Smart Grid networks are highly sensitive to price quality, the absence of several historical ticks can lead to incorrect indicators.

There are only two ways to check the program for compliance with the trading strategy, for the code errors and for real profitability. Any user of the MetaTrader 4 terminal can check the program trading strategy in the strategy tester or by running the program on a trading demo account.

Testing Expert Advisors in the MetaTrader 5 terminal differs from testing in the MetaTrader 4 terminal, we will consider both strategy testers in this instructions. A word of tip-recommendation if you are still choosing which terminal to work with or are already using MetaTrader 4, make a choice in favor of the MetaTrader 5 terminal. The support for the MetaTrader 4 terminal has officially ended, the development of the MetaTrader 4 terminal has been completely stopped.

Instructions for MetaTrader 4

Written and compiled scripts, so-called Expert Advisors, can be run on any MetaTrader 4 terminal. This factor has created a whole market of user programs distributed both free of charge and on various terms of a one-time payment or subscription. Today, you can find more than one hundred thousand such programs for all tastes on the Internet.

In theory, Expert Advisors should contain an open strategy repeatedly tested on demo trades and in real conditions, and the test results are usually attached to the program. It turns out that traders acquire fully automated, already tested algorithms.

In practice, this is not always the case, and since robots get access to a real deposit, it is very important to make a rapid assessment of the Expert Advisor purchased at the first stage of the choice, regardless of the attached and advertised results.

A custom Expert Advisor with a coded strategy for MetaTrader 4 is a mql4 or ex4 file. The trader should ensure the correct path when installing an Expert Advisor, so that it can be found and run on the MetaTrader 4 platform without problems.

The installation looks like an ordinary file copying, but there is one important feature – the folder for placing the Expert Advisor files is opened via the running trading terminal.

The first step for the trader – that the EA files are in fact intended for MetaTrader 4 by checking the extension (it should be mql4 or ex4). As an example, we consider the installation of the VR Smart Grid robot, which consists of a single file.

free strategy tester

The second step is the MetaTrader 4 launch

download strategy tester

The third step– is to open the Expert Advisor files installation folder via the terminal menu «File » and the option «Open Data Directory». After this operation, the folder window will open. as usual.

download strategy tester for free

Indicators, Expert Advisors, scripts, auxiliary libraries, templates and many other things related to the custom configuration of the platform are located in the MQL4 folder. It is enough to open it to immediately find out where to copy the Expert Advisor files due to the authentic folder name.

download forex strategy tester

Step four – – distribute the Expert Advisor files with the distribution and settings to the corresponding folders, following the recommendations attached to it or focusing on extensions:

  • mql4 and ex4 Expert Advisor – to the Experts directory
  • mql4 and ex4 indicator – to the Indicators directory
  • mql4 and ex4 script – to the Scripts directory
  • dll and ex4 libraries – to the Libraries folder
  • Settings (templates) files – to the Presets folder

In the example, we will copy the VR Smart Grid forex Expert Advisor file to the Experts folder.

download forex tester

If the Expert Advisor is installed correctly, its name will appear in the «Navigator», after MetaTrader 4 restart. The final stage before testing is to download ticks history. Define the instruments you want to work with and press F2.

download forex tester for free

Select the desired financial instrument in the quotation archive window and then click the «Download» button. The tick history will be downloaded, the process progress will be marked by the green bar at the bottom of the «Quotation Archive» window.

strategy tester

If the history is already loaded into the Metatrader 4 terminal and the broker servers do not contain new data, a message will appear with a suggestion to recalculate (reload) timeframes. Just in case, it is better to use the suggested update of tick data.

mt4 strategy tester

The downloaded quotation archive will provide the strategy tester with database for modeling (restoring) candles when recreating the trading history. The downloaded quotations in most cases do not have a complete set of data, very often there are data gaps, which leads to a low quality of Expert Advisor testing.

IMPORTANT! Part of the trading account properties are copied from the account to which the terminal is currently connected. Testing on different types of accounts will be very different. Properties that are copied (Leverage, minimum and maximum lot limits, number of decimal places, number of simultaneously allowed positions, total volume of open positions, etc.)

Preparation of strategy tester for running Expert Advisors

The strategy tester opens as the bottom window of the Metatrader 4 workspace, allowing the trader to test/optimize trading systems and «to be in the market» by tracking current positions at the same time.

forex strategy tester

The trader can launch the service at any time through the «View» platform menu or via combination of shortcuts specified in the «Strategy Tester» option.

mt4 forex strategy tester

The developers tried to make this application native, so a user, even barely familiar with the Metatrader 4 platform, has almost no questions about the interface, but some functions are quite specific.

Setting up Expert Advisor properties of the strategy tester

The Expert Advisor properties are located in the right corner of the strategy tester field and control the direct setting of test modes divided into three tabs:

  • Testing
  • Input parameters
  • Optimization

Never optimize during the initial run of the Expert Advisor! Performance test of any trading system should not be started with an attempt to «adjust» the parameters of the indicators and conditions included in it.

The optimization system uses a «genetic algorithm» that can effectively improve the test performance. The side result of his work is – to adjust parameters for a specific historical period and instrument loaded into the tester. In real trades, when faced with another form of fluctuations (volatility, gaps, etc.), the robot will make a lot of losses.

download forex strategy tester for free

  • The “Deposit” defines the currency, the starting size of the deposit, the direction of trade (in both directions or transactions in only one direction) and the type of optimization that will be enabled.
  • The Input parameters – are the settings of the Expert Advisor, the tab is completely identical to the one that appears when the robot is installed on the chart.

mt4 forex tester

As already mentioned above, for Expert Advisor's correct operation during testing, you should follow the settings recommended or set by default by the developer of the trading system.

In some cases, changes are possible within «presets», special files attached to the robot with descriptions of cases or instruments for their use. If the Expert Advisor is popular, then the settings files can be found independently on the Internet.

The VR Smart Grid robot used as an example just has similar custom settings files. The settings files can be placed anywhere on your computer.

Then, in the strategy tester, the user will only have to click the “Upload” option and select the desired file in the window that pops up. Often, by default, the «Tester» folder is opened by default when you select a download, so use the Windows navigation to find the settings file yourself.

Tester fields description

When you open the testing service, the «Expert Advisor» option is set by default to the left. It automatically displays the entire list of robots in the Experts folder and the «Navigator» window.

free forex tester

When you select the second option – the indicator, a list of files in the Indicators folder will be displayed.

free forex strategy tester

To run the Expert Advisor test, double-click on its name in the drop-down list. Next, the instrument, according to the quotes of which a one-time test will be carried out, is selected in the same way; one click is enough to display it in the settings window.

forex tester

The «Model» function determines the accuracy and duration of testing, the «every tick» method restores historical quotes using all the archive data, so it is the longest, the other two types do not provide an accurate estimate and are used by developers at the stage of testing «trading hypotheses» to save time while searching for ideas.

how to test an Expert Advisor

In some cases, when the logic of the robot is «tied» to a long-term strategy, where transactions are opened at the price of opening a candle (bar) at the beginning of the day, you can resort to a model with the appropriate name – this will allow the trader to «rush» the Expert Advisor through the maximum time period.

free strategy tester

The duration and accuracy of the test is affected by the date or length of the historical segment. Some traders believe that the bigger it is the better, but empirical experience proves that:

  • It is much more important to choose a section with the most symmetrical (even) distribution of upward trend, flat and various volatility levels
  • A segment from 2,000 to 10,000 candles or bars of the «working» timeframe – selected in the «Period» field would be enough

download strategy tester

As mentioned above, one of the testing tasks is to check the «logic» of opening and closing transactions, the work of money management – – automatic placement of pending orders, fixing losses and profits. Thanks to the visualization option, the trader can personally observe these processes in the «high-speed run» mode of trading sessions.

The «Visualization» option offers the user to choose the inclusion and duration period of the trading demonstration.

download strategy tester for free

Setting the above settings allows you to press the «Start» button of the test, many do this, leaving out the «Spread» parameter, where the default value is «Current». This can lead to unreliable results for two reasons:

  • When testing at the weekend when the market is closed, the spread on the instruments may be implausibly overstated
  • In real trades, the spread can change the value, besides there will always be slippages, delays affecting the price of entry and closing of the transaction

Sometimes traders input the spread cost manually, higher by one point of its real value, in order to somehow take into account the losses described above.

Launching the Expert Advisor Testing

After choosing the method of modeling the trading history and the length of visualization segment, set a fixed lot size equal to 0.01 in the Expert Advisor input parameters. This will help to display the dimension of the test report indicators in points, which will make the analysis of test results convenient.

Testing starts by clicking the «Start» option and passes automatically, displaying only the segment selected on the visualization on the upper chart of the instrument. While monitoring transactions, you can pause (1), accelerate (2), reduce or expand by moving the slider (3).

download forex strategy tester

If the «every tick» method is selected, then the candles are recreated in the tester and the price produced fluctuations, almost with reliable accuracy, which allows to display transactions not at the opening and closing price, but directly «inside» candle.

download forex tester

After the test is finished, new tabs are added to the service, which were not present at the tester launch stage: “Journal”, “Chart”, “Results” and “Report”.

Analysis of the Expert Advisor test results

Preliminary assessment of the effectiveness of the trading algorithm is carried out:

  • Generalized, with the help of the yield-equity curve graphical analysis
  • Mathematically, by checking the compliance of the obtained parameters with valid theoretical values
  • Step by step–, considering every transaction on the chart and in the results table

The stability of the Expert Advisor code is determined by the tester log.

“Expert Advisor testing breakout” Anomaly

At the final stage of testing in the Metatrader 4 strategy tester, the service performs a “trading breakout” i.e., forced closing of orders with an actual loss or profit. While testing medium-term, long-term strategies or Expert Advisors practicing order grids, as in the case of VR Smart Grid under consideration, the trader may see an overstated loss at the end of the test, which will be reflected in a sharp drop in the curve of profitability – equity.

The «Results» tab contains a detailed description of the completed or modified trade transaction, as well as pending (limit) orders and trading results.

All actions of the Expert Advisor's automatic strategy have a sequential numbering, which is contained in the first column for easy navigation when searching for work failures, as well as the time of operation, located in the second column.

Numbering of transactions is contained in the fourth column «Order». When modifying limit placed orders, it does not change, for example, the marker marks the placing of the second limit order for sale, so the column contains the number 2. It is repeated in the following line: due to the change of the previous Sell order, the robot added to it a related stop loss order to limit losses in case of unfavorable price movement.

The transaction type is determined by the second column, the operation of the money management unit of the strategy is displayed in S/L and T/P numbers, stop loss insuring against losses and take profit, fixing profit. The «Price» column shows the price level of pending or executed orders on the market, Profit» – closed transaction result, «Balance» – the dynamics of deposit changes.

In the above example of testing the VR Smart Grid Expert Advisor, the trader should pay attention to how the lot increase and the trailing stop is rearranged after the positive change in the direction of the open transaction and check on the chart whether these operations coincide with the logic of the robot algorithm.

download forex tester for free

“Chart” tab

The “Chart” tab is divided into two fields. The first one contains two lines: balance (blue) and current funds (green). The balance changes only when positions are closed, and current funds change depending on the current values of accumulated profit or loss, which explains the mismatch of these curves. The second window, located at the bottom, displays a histogram of position size, it will be constant for a strategy using a fixed lot opened by trading signal of the robot. In this example, VR Smart Grid Expert Advisor works according to a complex grid strategy using position increment, which is displayed with different heights of columns.

strategy tester

“Report” tab

Report” – is the most important tab, as it determines the testing results objectively, by the numbers. First of all, you should pay attention to the quality of trading history modeling (1), sometimes it is difficult to achieve 90 percent accuracy, so the Expert Advisor should be checked on a demo account.

mt4 strategy tester

Modeling errors will be displayed by:

  • Red or grey strip
  • A specific number of candles that do not coincide with the chart on which trading is conducted
  • Percentage ratio and green strip of properly recreated candles or bars

The length of the tested period is indicated by the number of candles and «working timeframe, in this example it is Н1. The line (2) contains the data of the initial deposit and spread set by the user prior to testing.

The line (3) defines the strategy benefit in terms of profit, net and gross profit, even gross loss play a relative role, the following parameters are much more important:

  • Profitability
  • Math expectation – is arithmetic mean probability calculated by the formula:

download forex strategy tester for free

The losses and profits in the strategy are posted in line (4):

  • Absolute drawdown – is the maximum real recorded loss
  • Relative drawdown – is the maximum loss obtained from a single open position

Other parameters –, the absolute numbers of profitable and losing positions are not as important as:

  • Total number of transactions – indicates whether the test length is sufficient or insufficient
  • Percentage of losing or profitable transactions

The rest of the report is a kind of «collection of records» for the biggest test losses and profits, where you should pay attention to the maximum series of continuous transactions, closed in the negative.

Information from the terminal help

  • Bars in history — number of modeled historical data in bars;
  • Ticks modeled — the number of modeled ticks;
  • Modeling quality — the quality of ticks modeled during testing, in percent. The modeling is shown schematically as a strip in the next report line. This strip can be of three colors:
    • Grey — this part of the available data was not tested. Grey color may appear if the date range was specified in the test settings;
    • Red — modeling was not carried out in this interval due to the lack of data for a shorter period. In this case, only the data of the period selected in the test settings was used;
    • Green — modeling was carried out in this section. Moreover, the brighter the color is, the better the modeling was. For example, when testing on the H1 period, a dark green strip may indicate that the data of the thirty-minute M30 period were used for testing, and the brightest one — indicates the use of minute data;
  • Initial deposit — the initial deposit volume;
  • Total Net profit — the financial result of all transactions. This indicator is the difference between the "Gross profit" and "Gross loss";
  • Gross profit — the sum of all profitable transactions in monetary units;
  • Gross loss — the sum of all losing transactions in monetary units;
  • Profitability — the ratio of gross profit to gross loss in percent. One means that the sum of profits is equal to the sum of losses;
  • Expected payoff — the mathematical payoff expectation. This statistically calculated indicator reflects the average profit/loss ratio of one transaction. It can be also considered that it reflects the expected profit/loss of the next transaction;
  • Absolute drawdown — the largest loss below the value of the initial deposit;
  • Maximum drawdown — the largest loss from the local maximum in the deposit currency and as a percentage of the deposit;
  • Relative drawdown — the largest percentage loss of the maximum equity value and its corresponding monetary value;
  • Total transactions — the total number of trading positions;
  • Short positions (won %) — the number of short positions and the percentage of profitable short positions;
  • Long positions (won %) — the number of long positions and the percentage of profitable long positions;
  • Profitable transactions (% of total) — the number of profitable trading positions and their share in the total number of transactions, in percent;
  • Losing transactions (% of total) — the number of losing trading positions and their share in the total number of transactions, in percent;
  • The biggest profitable transaction — the biggest profit among all profitable positions;
  • The biggest losing transaction — the biggest loss among all losing positions;
  • Average profitable transaction — the average value of profit per transaction (the sum of profits divided by the number of profitable transactions);
  • Average losing transaction — the average value of losses per transaction (the sum of losses divided by the number of losing transactions);
  • Maximum number of consecutive wins (profit) — the longest series of profitable trading positions and the sum of their wins;
  • Maximum number of consecutive losses — the longest series of losing trading positions and the amount of their losses;
  • Maximum consecutive profit (number of wins) — the maximum profit for one series of profitable transactions and the corresponding number of profitable transactions;
  • Maximum consecutive loss (number of losses) — the maximum loss for one series of losing transactions and the corresponding number of losing transactions;
  • Average consecutive wins — the average number of profitable positions in consecutive profitable series;
  • Average consecutive loss — the average number of losing positions in consecutive losing series.

“Journal” tab

The journal– is a statistical step by step report on the work of the Expert Advisor. Unlike terminal logs, it does not contain service messages (information about the robot start, shutdown, etc.), there is only a description of transactions.

The journal will definitely display code errors if any are found. If this happens, you need to contact the developer or download the Expert Advisor elsewhere.

mt4 forex tester

Saving and analyzing test report

By right-clicking on the “Report”, “Results” and “Chart” tabs, you can save them for further analysis. The drop-down menu provides a choice of options for copying or saving to a file, the path to which the trader chooses independently or agrees with the default option. Copies are needed to compare with other test options for which you will need to select other parameters or settings.

What to look for:

The main goal of testing– is express check of the Expert Advisor, so on the first “Chart” tab the trader should observe the growing equity line. At the same time, the stability of earnings is guaranteed by indirect indicators:

  • Smooth growth of the capital line, with no sharp growth or failure of the curve
  • Trend tangent inclination angle of 30–45 degrees

On the “Report” tab, first of all, we pay attention to the number and percentage of profitable transactions

  • The higher the number of closed transactions is, the more reliable the received report parameters are
  • The ratio of profitable transactions should be at least 60% for intraday strategy and above 70% for medium- and long-term trading system

A large number of positively closed orders can result in a loss if the trader “forgets” about such parameter as profitability:

  • The resulting profit and loss ration, ideally, should be higher than 2

This figure can be achieved by controlling the size of stop losses – orders limiting loss, relative to the automatically fixed profit, the size of which is determined by pending orders – take profits.

The table on the “Results” tab shows the totals for each positive and negative trade. Studying random sample will help to understand the systemacity of the stop loss and take profit size. If the algorithm contains too high losses, their series can “kill the deposit ”.

The parameter “consecutive losing transactions” will give an idea of the possible length of a series of negative transactions.

Analyzing the results above, the trader should understand that the task of the tester is the rapid analysis of the robot work. Testing proves only the absence of code errors in the Expert Advisor and the existence of a “workable” trading algorithm.

Instructions for MetaTrader 5

The MetaTrader 5 Terminal is an advanced platform for trading any financial instrument. The terminal allows you to trade any financial instrument, Forex, Crypto, CFD, Option, Futures. If you do not trade in the MetaTrader 5 terminal yet, we recommend that you do it as soon as possible. Also note that the MetaTrader 5 terminal works only in 64-bit operating systems. Terminals working in 32-bit systems are no longer supported or updated.

IMPORTANT! Expert Advisors, indicators, scripts made for terminals of version older than 2361 cannot work in terminals of version 2361 or lower. If you use MetaTrader 5 of version 2361, we strongly recommend to install the 64-bit version of the terminal, you may need to install the 64-bit operating system windows.

mt4 forex strategy tester

Preparing the MetaTrader 5 terminal for Expert Advisor testing

Launch the MetaTrader 5 terminal in which you plan to test the Expert Advisor. The installation of the Expert Advisor in the terminal is done in the same way as in the MetaTrader 4 terminal. After launching the terminal, you can call up the strategy tester in two ways.

forex strategy tester

The additional "Strategy Tester" window will open, these are preset test and optimization modes, selecting any of the modes in the subsequent settings, it remains possible to reconfigure everything to any of the presented modes.

free forex tester

Under the item (1) in the strategy tester window, there is the test mode with visualization. Despite the fact that the mode is called "Visualization" in the following settings, visualization can be disabled or enabled. The field (2) is intended for searching the results of previous tests. The list of previous tests and their results can be reviewed under item (3).

Tester fields description

The strategy tester settings consist of 20 items.

free forex strategy tester

(1) "Settings" tab – Is located in the tab bar and allows you to switch between other tabs.

(2) "Expert Advisor" Drop-down list – in this testing, you can select the Expert Advisor under test.

(3) "IDE" Button for calling the code editor – if the Expert Advisor under test has a source code file, you can open this source code by clicking on the IDE button

(4) Button for loading the settings file – by clicking on this button, you can load the previously saved settings file and test with the settings from the file.

(5) "Symbol" Drop-down list – in this setting, you can select the financial instrument on which testing will be carried out.

(6) "Period" Drop-down list – allows you to select the "Chart period" for testing.

(7) "$" Button for additional settings – allows you to make changes to the properties of a financial instrument, by default, the properties of the financial instrument are filled with values from the broker and these properties are used for real trade. If necessary, you can change the properties manually.

(8) "Interval" – Drop-down list – allows you to select a preset time interval for testing.

  • All history – testing will start from the first available date of history data available on the broker server.
  • Last month – testing will start from the beginning of the current month
  • Last year – testing will start from the beginning of the current year
  • Period selection – activates the following settings: (9) test start date and (10) test end date, the dates are entered manually by the trader.

(11) "Forward" – Drop-down list – allows to set a period that is not involved in the optimization process, and the found set of settings is checked on it. Simply put - the terminal tester selects settings in one part of the history, and checks their work in another.

Forward - this setting allows you to check the test results, it will be useful for excluding situations of adjusting settings on history. The selected test period (9)-(10) is divided into parts (half, third, quarter). To specify your own start date for forward testing, you need to select the "Custom" item in the setting (11). And specify the start date for the Forward test in the field (12). The selection of settings is carried out in the first part of testing and called the back test, forward testing is carried out in the second part.

(13) " Delays" Drop-down list – allows the user to set delays for the process of opening positions, this delay is called "Requte" requote in real trading. Due to price changes, there is often a situation when a lot of time passes from the moment of the first attempt to open a position and the price has time to change. When trying to open a position at the old price, the broker server will return a "Requte" failure.

(14) Button – allows you to set additional parameters for changing the properties of the trading account, commission, margin, limits, etc.

(15) "Modeling" Drop-down list – allows you to select the mode for ticks modeling and price steps.

  • Every tick – mode of operation, in which the chart is plotted for all ticks without gaps. Slow mode + quality mode.
  • Every tick based on real ticks – modeling and emulation of ticks are not performed in this mode. The strategy tester works strictly according to the quotations provided by the broker. Slow mode + it takes time to download the entire tick history from the broker server. Slow mode + Maximum quality mode.
  • OHLC on М1 – mode of operation without ticks, in this mode, prices – Open, High, Low and Close – are modeled in this mode. Fast mode + low-quality mode.
  • Only opening prices – testing in this mode is based only on bar opening prices. Fast mode + low-quality mode.
  • Math calculations – mode for working with math calculations.

Best testing quality "Every tick based on real ticks" does not guarantee the same results as if it were on a training or real account.

"Every tick based on real ticks" is the maximum available quality, not a guarantee of 100% reproduction of price data movement.

(16) "Profit in pips"– if this option is enabled during testing, all profits will be calculated in pips, profit and loss calculations will not be made. This mode is not recommended for Expert Advisors with increased trading lots, since in such EAs, 5 pips of profit can cover 50 pips of losses.

(17) "Initial deposit" – allows you to set the deposit sum for testing.

(18) "Test currency" – allows you to set the deposit currency.

(19) "Leverage" – allows you to set the leverage size.

(20) "Optimization" – Drop-down list – allows you to enable the tester into the "Optimization" mode

(21) "Visual mode" – New window – if this option is enabled, the strategy tester will open an additional window in which you can visually see all trading operations made. Enabling this mode greatly slows down the testing process.

Launching the Expert Advisor Testing

After you have set up the trading environment for the strategy tester, you can move to the settings of the EA itself. To do this, go to the "Parameters" tab.

how to test an Expert Advisor

The "Values" column is marked with a red rectangle, this is where you can set the desired settings for a single test. The list of settings, their values depend on the Expert Advisor and will change for each Expert Advisor. After you have set the settings for the Expert Advisor for testing and set up the test environment, you can press the green "Start" button.

Testing Process

After clicking the "Start" button, the strategy tester window will open with a quick run of the Expert Advisor on historical data. If you have installed Forward testing. Then, having reached the specified date, the strategy tester will launch the second tester window to visualize the Forward test. After testing, a chart with the test results will open in the main window of the MetaTrader 5 terminal, each transaction will be displayed on the chart. The launch of the first testing may be delayed, as the terminal may need to download the history of the financial instrument.

download forex strategy tester for free

The testing window is a bit like the MetaTrader 5 terminal window, but it has fewer buttons. There are buttons to change the chart type, to zoom in and out of the chart, and to control the test speed at the top of the window. In the case when you need to skip a part of the visualization, you can specify the date until which you want to skip the visualization and press the "Scroll to" button.

The bottom of the window contains tabs:

"Trade" – the tab displays the current open orders and positions.

"History" – the tab displays the trading history of the Expert Advisor, you can view transactions, orders and transactions + orders via the context menu.

"Operations" – the tab displays trading operations made by the Expert Advisor, opening and closing positions of their modification.

"Journal" – Displays records and, with the test, writes everything that the trading Expert Advisor does, all trading conditions and errors of the Expert Advisor work are also written in this tab.

The chart of the balance and equity curve is plotted in the MetaTrader 5 terminal window.

download forex tester for free

  • Blue line – balance change
  • Green line – equity change
  • Green histogram – lot sizes of trading positions.

Analysis of the test results

The test report can be saved as a web page or table file.

download strategy tester for free

The test report in MetaTrader 5 is much larger and more extensive than in MetaTrader 4. The trader can see the simple test reports and the forward test report.

The following indicators are available in the test report:

  • History Quality — this indicator characterizes the quality of the price data that were used for testing. The indicator is defined as the percentage ratio of correct minute data to incorrect ones. Data with zero spread, with volume 1 at various OHLC values, are considered incorrect data. They also include gaps in history. Depending on the value, the test interval is divided into 1 — 199 segments, for each of which the quality is calculated separately. These segments are displayed in colors on the graphical indicator of the history quality (the lighter the shade of green is, the better the quality is, the intervals with the quality less than 50% are displayed in red).
  • Bars — the number of bars generated by the symbol on which testing is performed;
  • Ticks — the number of ticks modeled during testing;
  • Symbols — the number of symbols information on which was requested by the Expert Advisor during testing;
  • Initial Deposit — the initial deposit for testing;
  • Withdrawal — the sum withdrawn by the expert during testing. This field is not displayed if no withdrawal operations have been made;
  • Total Net profit — the financial result of all transactions. This indicator is the difference between the "Gross profit" and "Gross loss";
  • Gross Profit — the sum of all profitable transactions in monetary units;
  • Gross Loss — the sum of all losing transactions in monetary units;
  • Balance Drawdown Absolute — the difference between the initial deposit and the minimum value below the initial deposit, to which the balance has ever fallen for the whole test period. Absolute drawdown = Initial deposit - Minimum balance. See an example of drawdown calculation.
  • Balance Drawdown Maximal — the largest drop in the balance between the local maximum and the next local minimum in the deposit currency. In parentheses, the value of this drop is indicated in percent. Maximum Drawdown = Max [local maximum - next local minimum].
  • Balance Drawdown Relative — the largest drop in the balance between the local maximum and the next local minimum in percent. In parentheses, the value of this fall is indicated in monetary terms. Relative drawdown = Max [(local maximum – next local minimum)/local maximum * 100].
  • Equity Drawdown Absolute — the difference between the initial deposit value and the minimum value below the initial deposit, to which the equity level has ever fallen for the whole test period. It is calculated in the same way as the absolute balance drawdown.
  • Equity Drawdown Maximal — the largest drop in equity between the local maximum and the next local minimum in the deposit currency. In parentheses, the value of this drop is indicated in percent. It is calculated in the same way as the maximum balance drawdown.
  • Equity Drawdown Relative — the largest drop in equity between the local maximum and the next local minimum in percent. In parentheses, the value of this fall is indicated in monetary terms. It is calculated in the same way as the relative balance drawdown.
  • Profit Factor — the ratio of gross profit to gross loss. One means that the sum of profits is equal to the sum of losses;
  • Recovery Factor — this indicator reflects the strategy riskiness, what sum the Expert Advisor risks to earn the received profit. It is calculated as the ratio of the received profit to the maximum drawdown;
  • AHPR — the arithmetic mean transaction (percentage change). The arithmetic mean change in funds for each transaction. The arithmetic mean usually gives a slightly overestimate of the profitability of a trading system in comparison with the geometric mean. If the geometric mean implies the multiplication of the results of each transaction, then the arithmetic mean makes the simple summation. In parentheses, a more familiar form is given in percent, a positive value indicates that the trading system is profitable. A negative value indicates loss.
  • GHPR — the geometric mean transaction (percentage change). The geometric mean shows how many times the capital changed on average as a result of each transaction. The relative change in funds is often a more objective assessment than the mathematical expectation. The percentage change in capital is indicated in parentheses. The negative number in parentheses indicates that, on average, there is a capital reduction on each transaction.
  • Expected Payoff — this statistically calculated indicator reflects the average profit/loss of one transaction. It can be also considered that it reflects the expected profit/loss of the next transaction;
  • Sharpe Ratio — this indicator characterizes the effectiveness and stability of the strategy. It displays the ratio of the arithmetic mean profit during the position holding to the standard deviation from it. Additionally, the value of the risk-free rate is taken into account, which is the profit on the deposit of the corresponding sum on a bank deposit;
  • LR Correlation — linear regression correlation coefficient. The balance chart is a broken line, which can be approximated by a straight line for clarity. The method of least squares is used to find the coordinates of this straight line. The resulting straight line is called linear regression and allows you to estimate the deviation of the balance chart points from linear regression. The correlation between the balance chart and linear regression allows you to estimate the degree of capital volatility. The fewer sharp ups and downs are on the balance curve, the closer the value of this indicator is to one. The closer it is to zero, the more random trading is.
  • LR Standard Error — the standard error of balance deviation from linear regression. This indicator is used to assess the deviation of the balance chart from linear regression in monetary terms. It makes sense to compare only systems with the same initial conditions (the initial capital values are equal). The larger this value is, the more the balance deviates from a straight line.
  • Margin level — the minimum margin level in percent, which was fixed during the test period;
  • Z-Account — serial test (probability of correlation between transactions). The serial test is used to measure the degree of correlation between transactions, and allows you to evaluate whether the trading history has more (or less) periods of consecutive wins or losses than a random distribution. Dependency allows you to apply capital management methods and/or change the trading system algorithm to maximize profits and/or eliminate dependency. Both the failure to detect real dependency and the erroneous detection of non-existent dependency between transactions are dangerous. The Z score shows the deviations from the normal distribution in sigma. A value greater than 3 indicates that a win will be followed by a loss with a probability of 3 sigma (99.67%). A value less than -3 indicates that a win will be followed by a win, and also with a probability of 3 sigma (99.67%).
  • OnTester result — the value returned by the OnTester function in the Expert Advisor as a result of testing. It corresponds to the selection of the custom criterion during optimization;
  • Total Trades — the total number of trades (transactions that fixed profit or loss);
  • Total Deals — the total number of transactions;
  • Short Trades (won%) & mdash; the number of transactions that fixed profit from sales and the percentage of profitable short trades;
  • Long Trades (won%) — the number of transactions that fixed profit from purchases and the percentage of profitable long trades;
  • Profit Trades (% of total) — the number of profitable trades and their share in the total number of trades, in percent;
  • Loss Trades (% of total) — the number of losing trades and their share in the total number of trades, in percent;
  • Largest profit trade — the largest profit among all profitable trades;
  • Largest loss trade — the largest loss among all losing trades;
  • Average profit trade — the average value of profit per trade (the sum of profits divided by the number of profitable trades);
  • Average loss trade — the average value of losses per trade (the sum of losses divided by the number of losing trades);
  • Maximum consecutive wins ($) — the longest series of profitable trades and the sum of their wins;
  • Maximum consecutive losses ($) — the longest series of losing trades and the sum of their losses;
  • Maximal consecutive profit (count) — the maximum profit for one series of profitable trades and the corresponding number of profitable trades;
  • Maximal consecutive loss (count) — the maximum loss for one series of losing trades and the corresponding number of losing trades;
  • Average consecutive wins — the average number of profitable trades in consecutive profitable series;
  • Average consecutive losses — the average number of losing trades in consecutive losing series.
  • Correlation (Profits, MFE) — the relationship between the results of positions and MFE (Maximum Favorable Excursion — the maximum size of potential profit observed during the position holding). Each position reached its maximum profit and maximum loss in the period between opening and closing. MFE shows profit in the favorable direction of price movement. The result of this position and two indicators — MFE and MAE (Maximum Adverse Excursion — the maximum potential loss observed during the position holding) — correspond to each closed position. Thus, we can plot each position on a plane, where MFE is put along the X axis, and the position result — along the Y axis. The closer the position result is to the MFE value, the fullest the price movement was used in the favorable direction. The straight line on the chart shows the approximation by the Profit = A*MFE+B function. The Correlation (Profits, MFE) indicator allows you to evaluate the correlation between the received profits/losses and MFE. The closer this value is to 1, the better the positions are on the approximation straight line. The closer it is to zero, the less significant the correlation is. MFE most of all characterizes the ability to realize potential profit.
  • Correlation (Profits, MAE) — the correlation between position results and MAE (Maximum Adverse Excursion). Each position reached its maximum profit and maximum loss in the period between opening and closing. MAE shows a loss in the unfavorable direction of price movement. The result of this position and two indicators — MFE and MAE — correspond to each closed position. Thus, we can plot each position on a plane, where the MAE is put along the X axis, and the position result – along the Y axis. The closer the position result is to the MAE value, the fullest the protection against price movement was performed in the unfavorable direction. The straight line on the chart shows the approximation by the Profit = A*MAE+B function. The Correlation (Profits, MAE) indicator allows you to evaluate the correlation between the received profits/losses and MAE. The closer this value is to 1, the better the positions are on the approximation straight line. The closer it is to zero, the less significant the correlation is. MAE characterizes the resulting drawdown during the position life and best characterizes the use of protective Stop Loss.
  • Correlation (MFE, MAE) — the correlation between MFE and MAE. It shows the correlation between two series of characteristics. The ideal value is 1 — we take the maximum profit and protect the position as much as possible throughout its life. A value close to zero tells us that there is practically no correlation.
  • Minimum position holding time — this indicator shows the minimum time interval between the opening and complete closing of a position during testing. The complete closing of a position is considered to be its liquidation; partial closing and reversal of a position are not taken into account.
  • Maximum position holding time — this indicator shows the maximum time interval between the opening and complete closing of a position during testing.
  • Average position holding time — this indicator shows the average time gone between the opening and complete closing of positions during testing.

If during testing/optimization there are withdrawals in the Expert Advisor, then the drawdown indicators are calculated taking them into account. The drawdown indicators calculated before the withdrawal is stored by the program. At the moment of withdrawal, their calculation will be restarted from the current value of the balance and funds. If the obtained drawdown values exceed the previously stored ones, they, in turn, will be stored by the program. Thus, the final test report will reflect the maximum drawdown values.

Subtitles En

Gross testing errors

The grossest error of the trader is the attitude to the test results as the desired results of trading on a real account. Even testing and optimizing the EA on real ticks will not show the results that will be obtained when testing the EA on a demo account. Testing carried out in conditions as close as possible to real ones will be of the highest quality and honest. You can open a training account with our partners for quality testing.

Additional information

  • You can call the strategy tester help by pressing F1
  • You can customize the chart as you need, set indicators, change the color of candles and lines and save the template with the name tester.tpl In the next testing launchs, the strategy tester will load the template you created.
  • You can customize the chart as you need, set indicators, change the color of candles and lines and save the template with the name of the Expert Advisor under test, for example, the name of the VR Smart Grid Expert Advisor, save the VR Smart Grid.tpl template and, in the next run of the VR Smart Grid Expert Advisor, the strategy tester will apply the template named VR Smart Grid.tpl

Reviews and discussions

To write a comment, log in via
To log in, disable the ad blocker and refresh the page.
First, log in to the site.
All
Feedback
Offer
Comment
Mistake
И
Иван Белкин
19.01.2022 19:46:47 Комментарий #linck
https://trading-go.net/beginner/kak-testirovat-forex-crypto-sovetniki/#reviews155

тест финал

To answer 0 0
To write a comment, log in via
To log in, disable the ad blocker and refresh the page.
First, log in to the site.
Thanks. Your comment has been received. After verification, we will publish it.
Something went wrong, log in, fill in all the fields and try again!
И
Иван Белкин
19.01.2022 19:46:55 #linck
https://trading-go.net/beginner/kak-testirovat-forex-crypto-sovetniki/#reviews156

Ответ финал

To answer 0 0
To write a comment, log in via
To log in, disable the ad blocker and refresh the page.
First, log in to the site.
Thanks. Your comment has been received. After verification, we will publish it.
Something went wrong, log in, fill in all the fields and try again!

Articles of your choice

How to install – update the application in MetaTrader. Simple instruction.
How to install – update Forex and Crypto Expert Advisors.
Detailed instructions for MetaTrader 4 and MetaTrader 5
Step-by-step instruction on how to correctly and error-free install or update a Forex – Crypto Expert Advisor, indicator or script in the MetaTrader terminal. The instruction is described for MetaTrader 4 and MetaTrader 5
17.01.2022 Comments Read Beginner, Lessons, Help, MetaTrader
How to buy an Expert Advisor, indicator or script for MetaTrader
How to buy Forex and Crypto Expert Advisors
Detailed instructions for MetaTrader 4 and MetaTrader 5
Step-by-step instructions on how to buy or rent an application for MetaTrader.
The instructions describe two ways to purchase the application in the MetaTrader terminal and on the mql5.com website
13.01.2022 Comments Read Beginner, Lessons, Help, MetaTrader
Feedback Top icon
We use both our own cookies and third-party cookies for the purpose of analysis, as well as to display ads based on your preferences, in accordance with your browsing habits and your profile. For more information, please see our Privacy Policy.