Mark Thomas — Trade On Track
Before I lose you, let me quickly explain what a “fractal-based trailing stop EA” is – it’s more useful and interesting than it might first appear! This is apart of a few articles is to design and develop an Expert Advisor (an automated trading system) that positions and moves our stop loss for us, based on fractals.
This EA is not going to be a fully automated trading system, it’s just going to automate our stop loss for us. This can be a very useful tool for just about any trend-following trading strategy that you might already use. The idea of using it is to enter your trade as you normally would, then kick off this EA position and move the stop loss for you from that point on. If you find yourself watching your screen for hours on end just to move your stop loss up or down as price continues to move in a profitable direction, then this could save you those hours. Most trailing stop systems just keep moving your stop a set number of pips from the current price – not very logical and not very effective. This little robot can position stops in the same way that you would place them yourself, just below the pivots (fractals) in an uptrend, or just above the pivots in a downtrend.
While I’m using the term “EA” which is the term that the Metatrader platform uses for its automation scripts, this particular article will not be MetaTrader-specific. This article will discuss the overall design of the fractal-based stop loss system which can be applied in your manual trading, or to any trading platform that has automation capabilities.
A fractal (sometimes called a pivot level, pivot point or reversal point) is normally described as a formation of at least 5 bars (or candles), where a high is surrounded by two lower highs on each side (a bearish fractal), or a low surrounded by two higher lows on each side (a bullish fractal).
The chart below shows the bearish fractals highlighted with red circles and the bullish fractals highlighted with green circles. The bearish fractals generally indicate turning points where price heads down and the bullish fractals generally indicate turning points where price heads up.

Fractal-Based Trailing Stop EA

The above image shows how the GBP/CHF behaved over a  day or so on the 15-minute chart. There was a nice downtrend for about 150 pips before it started turning back up again. We’ll use this example in the design of our fractal-based trailing stop system. Let’s break the chart down into segments and follow a potential trade of that downward trend.

Fractal Based Trailing Stop EA

Placing the stop loss

The breaking of a fractal level is often used in conjunction with other triggers as an entry signal. We’re not really going to discuss entries in detail here, but let’s consider that we entered a short trade as soon as price broke through the first bullish fractal indicated by the green horizontal line on this chart. So, our entry would be on the green cross. For our stop-loss system, we’ll be placing our stop loss just above the last bearish fractal before the price break. This is indicated by a red horizontal line on the above chart. NOTE: On our big chart above, you’ll see that the entry candle actually turned out to be high of a bearish fractal. But, at the time of entry, we didn’t know there was going to be two lower highs to follow it, so we have to go back to the last confirmed fractal at that time.
We’re now in our trade and we’re attempting to follow the trend down. When would be a good time to move our stop loss down? A logical answer would be when price breaks through another bullish fractal. So we’ll need to wait for another low to form into a fractal, which will require the price to go down, retrace back up a little, then continue on down and break through that new fractal low.

Fractal Based Trailing Stop EA

In the above chart, when the price hits the green cross (that is when it breaks through the previous bullish fractal), we’ll move our stop loss to just above the last bearish fractal that occurred before our price break. This trailing stop loss strategy continues as we follow price down.
There’s one other rule which we’ll build into our trailing stop strategy. Notice how each of the bearish fractals in the above image is moving downwards – each one is lower than the previous one. Often near the end of a trend, this pattern doesn’t continue and instead, we get a bearish fractal that is higher than the previous one. If this happens and the price had failed to break below the last bullish fractal, then we’ll move our stop to just above the last bearish fractal. An example is seen below:

Fractal Based Trailing Stop EA

So, we would have been stopped out at that last red horizontal line, pointed to by note (4).
You can see the power in using fractals to position the stop loss because the stop is placed just above a resistance level (the bearish fractal) in a downtrend, and just below a support level (the bullish fractal) in an uptrend. Sometimes price breaks through the fractal point by a few pips so it’s a good idea to allow a few pips between the fractal point and the stop loss. This could vary depending on the chart period. For instance, if we’re trading a 15-minute chart, then we might allow 6 or 7 pips between the fractal point and the stop loss. If we’re trading a 4-hour chart, this buffer might be increased to 16 or 17 pips. It also depends on the relative volatility of the currency pair. For example, the GBP/JPY can make a false break through a fractal point by more pips than say the AUD/USD. In the design of our automated trailing stop script, it would be a good idea to have this buffer as a “variable”, so that you can change it yourself whenever you activate the script.
That concludes the theory and basic design behind our fractal-based trailing stop system. In the next article, we’ll convert this design into some specific rules that can be implemented in computer code.
Please view the accompanying video (below) for a recap of how the fractal-based trailing stop EA works.