How to backtest forex and read the result

  • How to backtest forex and read the result

    Backtesting is a means of testing a trading strategy before it is applied to a live trading account.

    The purpose of backtesting is to try to find out earlier how the strategy is performing, if the backtesting results provide satisfaction it will be used or tested in a live account.

    Many traders experience failure when they make trades, one of which is because they have never performed a backtesting strategy, be it a backtesting indicator or a backtesting EA.

    This could be because they don't know how to do backtesting or because they just never found out how.

    This paper will explain how to do a backtest and also how to read the backtest results.

    What is backtesting?

    Backtesting is a way to test a trading strategy either with indicators or by using a robot using historical data to find out how the strategy is performing.

    Why do traders need to backtest? Because before applying a strategy on a live account, traders will get a clue from the backtesting results, about the performance of the strategy both with indicators and with automatic trading.

    Advantage of backtesting

    With backtesting, traders will get several advantages including:

    • Strategy insight, backtesting is to test a trading strategy, traders will know the performance by using historical data for the test.

    • Practical exercises, using historical data from the past the trader can practice everything he has learned to apply risk-free trading practices.

    • Confidence, if a trader looks at these good backtest results will increase the confidence of traders to continue to use the strategy on a real account.

    • Gaining insight into past price history, of course, will increase the knowledge of traders and can seek information as a result of significant trend changes.

    How backtesting work

    The way backtest works is to use data information on past price changes in tick data history to be used as a tool to test trading strategies before applying it to a live trading account.

    However, maybe each broker has limited data on past nutritional information, for example, a trader tries to retrieve 2010 data, while it is not available on the platform.

    So, let say, if you find a new strategy or a new trading robot, before using it on a live account, try it with backtesting first.

    By gonna testing, , you will find out how the results will be when the strategy is applied to past price data.

    Some important things that you will get by doing a backtest are as follows.

    • Return and equity, You can make conclusions by looking at the total return and equity in your experiment, whether it gives a large profit or only a small one, you can make a comparison with other strategies using the same trial fund.

    • Profit or loss.  With backtesting you will get an insight into how the strategy works, if the profit generated is greater than the loss this will increase your confidence in using it.

    • Trade gain and loss ratio. You can compare your strategies resulting in a gain ratio that is greater or less than the ratio losing trades.

    • Understand market volatility and know in which market conditions the strategy you use can work best.

    • You can learn to adjust your risk-reward according to the level of success of your strategy.

    The factor that influences in outcome backtesting

    Backtest in forex will also depend on several factors that affect the test results of a strategy, these factors include the following.

    • Execution trades may differ with real trading. During the backtest you may not consider the latency with the broker's server which can affect the speed of order execution, it might occur during the backtest that you don't have slippage or a requote problem.

    • Data sources and their quality. Differences in data sources and quality can affect the results of the backtest, this is related to where the data you use may be different from the actual conditions.

    • Determination of entries and exits from the strategy. When traders try to repeat the backtest process because maybe if they only do one backtest they are not satisfied with the results, if in the repetition there is a big difference then this can be related to the data source and the broker's server latency.

    How to backtest strategy MT4 or MT5

    To start a backtested strategy using the MT4 platform, the first step you will take is to download and install history data to MT4.

    When you run your MT4 or MT5, there may not be enough data available for monthly or weekly periods. To do a backtest you may need more chart history.

    The trick is as follows what you need to do

    • Run the broker platform you are using, and in the main menu at the top you select Tool >> Options >> Chart. Expand the max bar’s history allowed and choose the largest one, you can adjust the max bars in the chart too.

    • Then go back to the Tool >> history center menu, or faster you can use the F2 key. Then a market option will appear which contains the available trading pairs and instruments on your broker platform.

    Select the pair and timeframe for which you want historical data to appear on your MT4 platform then click  “import.”

    To test manually you need to know some important hotkeys that are useful for shortcuts, for example, F12 to forward 1 candlestick or Shift + F12 to backward.

    To backtest the manual strategy, you must find the conditions under which your strategy will be applied, by selecting the timeframe and scrolling backward from the available historical data. Once you find it, you can open your strategy to find out how it will perform.

    To scroll the chart backward, apart from dragging it with the mouse, you can also hold down Shift + F12, and hold hotkey F12 to forward the chart gradually.

    Backtesting is only a first step in knowing the performance of your strategy, you can do it with a demo account to have more confidence in your strategy manually.

    Backtesting using Tradingview platform

    Tradingview is a very famous platform, almost all traders are familiar with this platform. And it turns out that Tradingview also provides a replay bar that can playback historical data for you to test your trading strategy. You can try it for 30 days trial version.

    How to use you find it on blog.tradingview, or here are the steps that you can easily use

    • Find and click on the top panel of the Tradingview platform icon Replay button

    • The next click "jump to" as shown in the image below:

    • Next, you choose the point where you will start playing back the history chart. The red vertical line shows the Starpoint you chose

    • Choose whatever starting point you will play historical price data at, then launch autoplay by pressing the play button.

    • You can also load data manually by pressing the forward button.

    • If you want to exit replay mode, it is very easy just by clicking the X in the mode toolbar.

    How to use strategy tester MT4

    There are several kinds of backtesting methods with various kinds of software, but I will explain how to use the tester strategy which is the default MT4 application.

    This strategy tester is very useful for testing the accuracy of the technique used because the strategy uses data from past price movements.

    By the way, let's read the explanation below.

    • First, start the MT4 platform and click on the "View" section then select "Strategy Tester". Or you can use a shortcut by pressing "CTRL + R" on your keyboard.

    • You need a software simulator integrated with MT4, for example, MNZ Trading Sim. If not available you can use the keyword “Simulator” to find free software for a strategy tester in the market tab.

    • Install this software in an Expert folder and you can open the strategy tester with CTRL+R, then, you fill in all the required parameters, for example, the use date from what date you will start and until the end date of backtesting.

    • After that, click Start in the MT4 tester strategy and wait for the simulation graph to appear on the selected pair and timeframe.

    • You can now simulate a strategy using a strategy tester and buy and sell using the features available in MNZ Trading Sim. You can simulate Instant / Market Execution or Pending Orders.

    Currently, MNZ trading sim is unavailable in the MQL5 market if you missing the software, instead, you can try using a PAD tester to simulate trading.

    How to install a tester click the "market" tab in the bottom panel of your platform, then type "tester pad" in the search box. The tester pad for the strategy tester will appear. Click on the software and you only need to click download and wait for the installation process to complete.

    How to read backtest result

    After backtesting, we must analyze the results of the test so that we know whether the trading system or EA is what we want or not. There are several parameters that we must see and understand from the results of the backtest.

    Now let's try to look at the following example of the backtest results:

    The following are some key parameters and what we can know from the trading system.

    Total net profit

    This is the total result of all transactions carried out by the trading system that we are testing. A winning strategy should generate profits, not losses. This parameter tells us what can happen if you use this system following the rules attached to it. Remember, this is not a guarantee that in the future this system will work exactly as the test results. However, at least this parameter can show how much profit we can get by using this system.

    Maximum drawdown

    A maximum drawdown shows the biggest loss that might occur. This number should not be too large. Of course, big or small is relative, depending on how much your capital is and how much your risk tolerance is. For example, if our capital is $ 10,000 and our risk tolerance is only 20% of the capital, then the maximum drawdown should be no more than $ 2,000. Simply put, the smaller the maximum drawdown, the better.

    If we pay attention, the report has provided a more detailed description of Maximal Drawdown. In plain view, without us having to look for more details, the Maximal Drawdown looks clearly when we finish backtesting EA.

    When the maximal drawdown value starts to show the biggest limit intolerance provided by the user following expectations, then EA is feasible to be used in real transactions. Vice versa, if the maximal drawdown is still too large and not under the limits provided by the user, then EA needs to be reviewed until EA matches the user's expectations.

    Maximal Drawdown can be seen not only on the report during the test. If you saving the report, the results can be read on the graph image in the save report. This review is considered important because maximal drawdown is always the cause of the level of risk which if ignored may cause your capital to run out is not left.

    Maximal Drawdown Advantages or Weaknesses

    From the description above, we have got an idea of ​​the meaning of maximal drawdown in EA. well, here we will see the function besides reading the level of risk, what are the advantages and disadvantages of this Maximum Drawdown.

    The advantages of Maximal Drawdown are as follows:

    •  Able to know the risk level early

    • Can be categorized as an indicator of the level of loss

    • Can see the Equity spent by EA

    • Help prepare the right capital for EA

    The disadvantages of Maximal Drawdown are as follows:

    • Can not be used to find a drawdown in the future

    • Only able to estimate the current loss limit

    • Will change if there is a greater Maximal Drawdown value

    Maximal drawdown is closely related to the risk limit problem that EA does. This limit is used as an EA as a reference in handling how good is EA to overcome price movements to completion. At the same time, the user will observe how much capital is following EA if Maximal Drawdown experiences the greatest risk to protect the balance from losses.

    Total trades

    This is the total transaction made. We can analyze whether this system is aggressive or not by comparing this number with the period we use.

    For example, if the total transaction that occurs is 200 transactions in three months, it means that this trading system generates an average of three transactions per day (assuming that there are twenty working days in a month). That is, this strategy is not too aggressive and may be suitable for intraday trading strategies. If the numbers are getting smaller, then it might be more suitable for medium-term or maybe long-term trading strategies

    Profit trades

    This parameter shows the number of transactions that generate profits and what percentage of the portion of all transactions made. Simply put, this parameter shows the win ratio of the system we are testing. The bigger the number, the better.

    Bottom line

    As mentioned above, backtesting should be followed by forward testing in the real market. It is necessary to validate all the results we get from backtesting, it is also important to get clear evidence that we have managed to avoid overfitting during the backtesting process.

    The backtest method can help us to speed up the testing process, but make sure you have a record of price movements that are of reasonably good quality.

    After reading the results of the backtesting and the results giving confidence to the trading strategy or trading system used during the backtest, the next step is to do a forward test, this is also important because what is produced during the backtest does not guarantee the results will be the same as using real accounts.