Categories
Forex Trading Strategies

SMA Crossover Strategy with a twist

Introduction

Some centuries back, Karl Friedrich Gauss showed that an average is the best predictor of stochastic series.

Moving averages are employed to grade the price.movements. It acts as a low-pass filter, taking out the fast changes in price, regarded as market noise. The period of the moving average controls how smooth is this low pass filter. A  three-period MA levels the action of three periods, while a 200-period MA produces a single value of the last 200 price values.

Usually, it is determined using the close value of the bar, but there can be made also of the open, high or low of the of bars, or a weighted average of all price points.

Simple Moving Average(SMA):

This average is computed as the sum of all prices on the period and divided by the period.

The main drawback of the SMA is its abrupt change in value if a significant price move is cut off, particularly if a short period has been chosen.

Averages with different periods result in different measures that can be thought of as a fair price during that period. Thus, if we observe two averages, a long-term and a short-term MA, and the short-term average moves above the long-term average, we might conclude that the new opinion about the price is changing, so it’s a good time to buy.  The converse holds if a short-term average falls below the longer-term one.

The Parameter Space

Let’s analyse the parameter space of a moving average crossover strategy. This strategy has only two parameters: The fast-MA period, and the Slow-MA period.

We use a simulator on a EUR-USD 15-min chart over a historical record of nearly 14 years and computed the returns using a constant one-lot trade, and the result is shown in the figure below. We go long when the fast MA crosses over the slow MA and price is above the fast MA. The opposite holds for short positions.

We observe that the map is somewhat un-smooth, with its better performers at about 60-70 periods for the slow MA and less than five periods for the fast MA.

The other fact is that only 48 out of 304 simulations deliver positive results, this shows us that the strategy is questionable without other parameters that might improve its performance.

Testing  the popular 5-10 Periods SMA

I have seen some people boosting a system that goes long when the 5-period MA crosses over the 10-period MA,  and short on opposite crosses, but as far as I had seen when I tested it, this strategy loses 32,000 Eur at the end of 14 years ( below its equity curve)

The use of trail-stops and targets can make this strategy positive, but the equity curve is hopelessly untradeable:

So what may help to improve this strategy?

Well, I thought about two ways. The first one is to move the slow MA period to about 70.

Well, that is a good improvement, although we have losing periods, it, definitely, is much better to use a longer-period parameter on the slow average.

What happens, if we add the condition that the slow MA should be pointing UP and prices above the slow MA?

 

When applying these rules, we observe that the better-performing slow-MA period moves around 80 bars, and the fast MA period stays at less than 5. Another point we observe is that the slow MA surface is smoother around 80 periods. This is a sign that we’ve found a right place for our parameters. Finally, in this simulation, 500 out of 735 simulations are in positive territory. That shows us that we have found a more robust strategy because 80% of the parameter values deliver positive outcomes.

So, that will be the basis of our moving average crossover strategy.

The Rules of the strategy:

Periods: Slow MA: 75, fast SMA: 3

Initial Stop-loss: 0.18%. This mean, we cut our losses if it crosses 0.18% away from our entry price.

Trailing stop-loss: 0.38%. We let the trade room to catch the trend.

For long entries:

1.- We define a bull market when the Fast SMA crosses over the Slow SMA

2.- We allow long positions only when the slow SMA points upward, meaning its current value is higher than its previous one.

3.- We buy when the price closes above the Slow SMA.

For short entries:

1.- We define a bear market when the Fast SMA crosses under the Slow SMA

2.- We allow short positions only when the slow SMA points downward, meaning its current value is smaller than its previous one.

3.- We sell short when the price closes below the Slow SMA.

The equity curve is much better, although it shows the typical equity curve of a trend-following system.

The Total Trade Analysis shows why. The system’s percent winners are 27.33%, and the reward-to-risk ratio is 3.5 (Avg Win/Avg Loss ratio). That tells the system is robust, by priming profitability over the frequency of winners.

Main metrics of the Donchian System, on the EUR-USD:

It’s not usual but, from time to time we may expect a streak of up to 20 losing trades, therefore we need to apply proper money management.

As an example, let’s say, you don’t like to have a drawdown higher than 25% of your running capital, then you need to divide that figure by 20, and that must be your maximum risk for a single trade, therefore, in this case this is 1.25% of the current capital allocated for this strategy.

How to trade this strategy on your JAFX MetaTrader 4:

Adding a moving average to a naked candlestick chart is simple:

A popup window appears after clicking “Moving Average”:

There you are able to set the period and MA method, Price to apply. We change just the period, and select the “Weighted Close (HLCC/4)” We may, also change the color of the Slower MA to a different color, so every MA has different colors.

© Forex.Academy