• Overview
  • Reviews
  • Comments (2)

Three Moving Averages Trader

For opening positions, the Expert Advisor uses the signals of the Three Moving Averages Signal indicator.

Input Parameters:

  • Period of fast ma - period of the Three Moving Averages Signal indicator;
  • Take in atr, 0 - do not use a take profit - take profit size calculated using ATR (50) applied to the current timeframe; If the parameter value is 0, it is not used;
  • Stop in atr, 0 - do not use a stop - stop loss size. If the parameter value is 0, it is not used;
  • Trailing in atr, 0 - do not use a trailing - trailing stop size. If the parameter value is 0, it is not used;
  • Risk factor, volume eq  Equty*Risk factor/1000 - used in the work lot calculation formula: Equity*Risk factor/1000. Suppose, Equity is 10000 and Risk factor is 0.01, then the volume is 10000*0.01/1000 = 0.1;
  • Volume in lots if Risk factor is 0 - work lot size. If you set the Risk factor to 0, the specified fixed lot will be used.

Default parameters of the Expert Advisor are optimal for EURUSD H1 and the year 2013. They were calculated in the following way:

  • Determining the work symbol and timeframe - EURUSD and H1.
  • Choosing the period for optimization and forward testing. For the timeframe H1 the periods are 5 years and 1 year respectively.
  • Selecting the optimal values using the strategy tester, and checking the results on the forward period.
  • Optimal parameters are calculated several times. On the basis of the forward test results, I decide whether the Expert Advisor can be used for trading or not.

The number of optimized parameters should be minimal in order to avoid curve fitting. Initially, only one parameter was chosen - Period of fast ma.

The strategy tester settings used for optimization are demonstrated on the screenshots 1 (the Settings tab) and 2 (the Inputs tab). For a faster optimization, the "Open prices only" mode is used. You can use more precise modes, but they show almost the same results, since the Expert Advisor uses signal generated by the close prices only.

The results of tests are combined in a table; its brief variant is given below:

Optimization Period Optimal Value of Period of fast ma Forward Test Period Forward Test Result, Profit
01.01.2003-01.01.2008 27 01.01.2008-01.01.2009 1647.45
 01.01.2004-01.01.2009 23  01.01.2009-01.01.2010 -1050.33
 01.01.2005-01.01.2010 24  01.01.2010-01.01.2011 528.96
 01.01.2006-01.01.2011 46  01.01.2011-01.01.2012 -263.25
 01.01.2007-01.01.2012 46  01.01.2012-01.01.2013 -330.79
 Total      532.04

 

The forward test results demonstrate the profitability of the trading system.

One of the ways to improving it is implementing additional parameters for optimization. In this case, you need to understand that many parameters may lead to overoptimization.

The results of observing the system show that it successfully covers trend periods, but it doesn't take advantage of a huge part of the floating profit due the lags in detecting the change of a trend. That is why the Expert Advisor additionally includes a trailing stop controlled by the Trailing in atr, 0 - do not use a trailing parameter.

The results of optimization and forward tests are demonstrated in the table below:

Optimization Period Optimal Value of Period of fast ma,
Trailing in atr
Forward Test Period Forward Test Result, Profit
01.01.2003-01.01.2008 27, 5 01.01.2008-01.01.2009 2054.30
 01.01.2004-01.01.2009 23, 5  01.01.2009-01.01.2010 -1133.12
 01.01.2005-01.01.2010 24, 5  01.01.2010-01.01.2011 308.90
 01.01.2006-01.01.2011 54, 4  01.01.2011-01.01.2012 -1035.18
 01.01.2007-01.01.2012 54, 4  01.01.2012-01.01.2013 406.08
 Total     700.98

 

The results of the trading system are better. The profit has increased by 31%. The number of unprofitable periods has decreased from three to two. The default parameters of the Expert Advisor demonstrated on the screenshot 2 are obtained in the same way and they are optimal for the year 2013. The results of operation in 2013 (up to 18.05.2013 inclusive) are demonstrated on the screenshots 3-5. Pay attention that the optimal parameters are selected at the beginning of the year, and it is a forward test (not a backtest).

In the same way, you can obtain the parameters for other instruments, timeframes and time periods.

No reviews