Thinking Stuff's ATM

Automated Trading Machine (ATM) makes it simple to remove fear and greed from your trading. Automated trading is no longer just for the rich or nerdy. Our revolutionary software runs on your computer, using your trading rules, but none of your emotions. There's just one requirement - you know how to use a mouse.  Learn more...

Thinking Stuff's ATE

Automated Trading Execution (ATE) is where we run your trading systems for you on our servers. Your system can be exported from ATM, or written in plain English and we'll make it for you. We'll even backtest and suggest improvements if you want us to. This service essentially automates your automated trading.  Learn more...

Thinking Stuff's Groups

Join a group of like-minded individuals, and help each other to trading success. Once you join a group, you will have access to that group's trading systems, ideas, and feedback. And please contribute your own knowledge as much as possible. Or contact us to start your own group.  Learn more...

Using An Overlay For The Stop Loss

The simplest stop loss values are something like these (sticking to Longs to keep things simple):

  • LOW - 0.0050 (low minus 50 pips)
  • CLOSE * 0.975 (close minus 2.5%)

That is, just subtract some pips or percent from some part of the price bar. And you can read our simple trailing stop example here.

The example below though, uses a simple moving average of the last 20 bars as the stop loss. And you can use this technique with any overlay. Each bar re-position the stop loss to wherever the overlay happens to be, but only as long as the overlay is rising (again, for longs. For shorts only move it if the overlay is falling).

The basic theory is the same as the simple example, but there is one additional thing to check. You need to make sure that long stop losses are always below the current price, and long take profits are always above the current price. The current price is given to us by the CLOSE.

With the simple example above, the LOW is already below the CLOSE, and then we subtract even more pips. So that figure will always put the stop loss on the correct side of the current price. CLOSE * 0.975 does the same thing.

But overlays can move above or below the price bars. So we can't just blindly move the stop loss to wherever the overlay is - first we need to check that the overlay is still below the current price.
 

Direction Rule Type Rule Family Line 1 X / Line 2
Long Entry Rules Line 1 is above Line 2 CLOSE SMA(20)
Entry Rules Line 1 is above X MACD Histogram 0 (zero)
Entry Rules Line 1 is above X RSI 70
Entry Values   Enter At Market  
Initial S/L Values   SMA(20)  
S/L Mgmt Rules #1 Line 1 is above Line 2 CLOSE SMA(20)
S/L Mgmt Value #1   SMA(20)  
Short Entry Rules Line 1 is below Line 2 CLOSE SMA(20)
Entry Rules Line 1 is below X MACD Histogram 0 (zero)
Entry Rules Line 1 is below X RSI 30
Entry Values   Enter At Market  
Initial S/L Values   SMA(20)  
S/L Mgmt Rules #1 Line 1 is below Line 2 CLOSE SMA(20)
S/L Mgmt Value #1   SMA(20)  

 
A stop loss is never moved to a position of increased risk. So even if the moving average goes lower (which happens often, even in a strong uptrend), the long stop loss won't follow it down.

All good? Well maybe.
 

Wiggle Room

The thing is that we don't know how far away that moving average is from the current price. The two could be 1 pip apart, or they could be 1000 pips apart (well, probably not for a SMA(20), but you get my point).

Using the simple example of the low minus 50 pips, you can always be sure that there will be at least 50 pips between the current price and wherever you move the stop loss to. That 50 pips is your wiggle room - the amount of space that the price is allowed to wiggle about as it hopefully continues its upward journey.

But just using an overlay - there's no way to tell how much wiggle room you're giving the price. As I said - the wiggle room might be just 1 pip or 1000. And you might be fine with that. If not, keep reading.

You could do the same thing as the simple example. Instead of just SMA(20) for the stop loss values, use:

  • SMA(20) - 0.0050

Which says to place the stop loss 50 pips below the SMA(20). But what if you really wanted to both (a) get out of a long trade as soon as that SMA(20) was breached; and (b) ensure there was always plenty of wiggle room? Try this:
 

Direction Rule Type Rule Family Line 1 X / Line 2
Long Entry Rules Line 1 is above Line 2 CLOSE SMA(20) + 0.0050
Entry Rules Line 1 is above X MACD Histogram 0 (zero)
Entry Rules Line 1 is above X RSI 70
Entry Values   Enter At Market  
Initial S/L Values   SMA(20)  
S/L Mgmt Rules #1 Line 1 is above Line 2 CLOSE SMA(20) + 0.0050
S/L Mgmt Value #1   SMA(20)  
Short Entry Rules Line 1 is below Line 2 CLOSE SMA(20) - 0.0050
Entry Rules Line 1 is below X MACD Histogram 0 (zero)
Entry Rules Line 1 is below X RSI 30
Entry Values   Enter At Market  
Initial S/L Values   SMA(20)  
S/L Mgmt Rules #1 Line 1 is below Line 2 CLOSE SMA(20) - 0.0050
S/L Mgmt Value #1   SMA(20)  

 
Now the trade is only opened if there is at least 50 pips between the current price and the moving average. And the stop loss is only moved if there is at least 50 pips between the current price and the moving average.

Which method works better? Only backtesting has the answer.
 

Groups: