The Importance of Strategy Optimization Using MT4

The Importance of Strategy Optimization Using MT4

Reading time: 8 minutes

A complete trading system consists of several components, including which markets to trade, one’s risk profile, and how one enters and exits their chosen market. 

With any trading system, irrespective of whether you trade a non-discretionary system or adopt more of a manual discretionary approach, you must understand the need to be realistic in your goal setting, understand that losses are a part of the business and appreciate that the emotional side of trading will attempt to draw you in to make irrational decisions and even alter your trading strategy.

Discretionary Versus Non-Discretionary Systems?

Trading systems can either take on a discretionary or non-discretionary approach or blend the two. A fully discretionary trading system is more centred on intuition (not many traders can trade this way as optimization is impossible to perform accurately), while a non-discretionary approach is more of a calculated way of trading, particularly for a fully automated approach, with little engagement from the system designer/trader once the strategy has been tested. 

Between these two approaches lies a partial discretionary system (we can think of this as ‘partial automation’), one which provides the user with a signal that is then acted upon (or not). The trader chooses to buy or sell based on their personal experience and confidence level. 

In-Sample and Out-Of-Sample Data

Aside from ensuring that you are working with clean data in your testing (the data should ideally be from the same vendor that you plan to use for real-time trading), a backtest should contain enough data for at least 100 trades and cover different market conditions, such as upward and downward trends, together with rangebound markets. 

In-sample data, as its name suggests, serves as a portion of the data that is set aside for developing and optimising your trading strategies, allowing you to test different parameters and rules to see how they perform in hindsight. Out-of-sample data, on the other hand, should be stored outside of the optimization; it represents the data not used in developing your strategy. It acts to aid in testing your trading systems with data outside of the in-sample data, thus testing against unknown data and ensuring the results of your in-sample test were not an effect of curve fitting (which essentially means that your strategy has been overfitted to the in-sample data and will only work with out-of-sample data if it is exactly the same, which is not possible). 

How much of the data should be included? 

This will differ between traders, though it is usually not recommended to use the entire batch of data for your in-sample test for obvious reasons. It is common for system designers to adopt a 70/30 approach: 70% of the data is optimized using in-sample data while the remaining 30% of unknown and untested data is to be used in the out-of-sample data. Some traders may also employ what is known as Walk Forward Optimization: a procedure that effectively divides your data into segments, testing small portions of this separated data and then optimizing on a small segment of subsequent data and repeating the process. 

Types of Non-Discretionary Trading Systems 

As you can probably imagine, the types of systems that can be optimised are endless. We have trend-following systems that can be as basic as moving averages crossing over to generate a buy or sell signal to more complex systems that incorporate trend indicators such as the Average Directional Index (ADX). Other trading systems can be based on pattern recognition and breakout systems, for example. 

MetaTrader 4 (MT4) Strategy Optimization Process

MetaTrader 4 (MT4) remains a popular trading platform used by many traders in the financial markets

Within the MT4 trading platform, you have access to a Strategy Tester that allows you to optimise your trading strategies. 

To use MT4's Strategy Tester, you will need to ensure that your trading system has been coded as a custom Expert Advisor (EA). This can be done through the MetaQuotes Language 4 (MQL4).

Accessing the Strategy Tester can be achieved either by navigating to View and selecting Strategy Tester, as shown in Figure 1 (or by pressing CTRL+R).

Figure 1

Assuming you have uploaded the EA that you want to test, you must then select the EA you want to optimise through the Expert Advisor drop-down tab, as in Figure 2.

Figure 2

Once the EA is uploaded, the next step involves configuring the testing inputs. Things like the symbol you want to run the EA on (this could be a Forex currency pair such as the EUR/USD or any CFD market), the period (which timeframe), the date range (this is the range of historical data you wish to test through a demo account), the spread and the initial deposit (try to be realistic here and mimic what you plan to use for your live trading account). Assuming all the fields are entered correctly, you can then click the Start button to begin the optimization and then analyse the backtest results (found through the Results Tab), looking at statistics, such as total trades, total net profit, profit factor and absolute drawdown, for example. 

Optimization is an iterative process that will often require you to adjust parameters and retest to fine-tune your strategy. Assuming satisfactory test results, you can then look to validate the system for robustness with out-of-sample testing. As a note, strategy performance is very unlikely to echo in-sample data results; the optimized strategy commonly experiences a decrease in trading performance.

Pros and Cons of Strategy Optimization Using a Non-Discretionary System:

Pros:

  • A mechanical, non-discretionary approach offers a mathematical edge derived through testing and adjusting parameters.
  • A non-discretionary trading system limits emotional influence. 
  • Improved efficiency as errors often seen in discretionary systems will be more controlled.
  • Backtesting and optimization provide empirical evidence of your strategy's effectiveness. This validation helps you move beyond subjective assessments and base your trading decisions on concrete data.

Cons:

  • Curve fitting occurs when a trading system is fitted to the data and will struggle to perform with unknown data. This is why it is important to validate optimization results using out-of-sample testing.
  • A non-discretionary trading system will require periodic adjustments as market conditions change.
  • Optimising for a single performance metric without considering the bigger picture can lead to deceptive conclusions. Focusing solely on maximising profits while neglecting risk parameters can expose you to unnecessary losses.
Empieza a hacer trading
en cuestión de minutos.

bullet Accede a más de 10.000 instrumentos financieros
bullet Apertura y cierre automático de posiciones
bullet Noticias y agenda económica
bullet Indicadores técnicos y gráficos
bullet Muchas más herramientas incluídas

Al proporcionar su correo electrónico, usted acepta la política de privacidad de FP Markets y está de acuerdo en recibir futuros mensajes de marketing por parte de FP Markets. Puede darse de baja en cualquier momento.




Source - database | Page ID - 38286

Get instant Updates in Telegram