Development Process — Exit Testing
No entry is foolproof, and many successful traders are wrong over half the time. Good exits aid capital preservation when you are wrong, and maximize profits when you are right.
The nature of your strategy should always be considered when thinking of exits; there are no universally successful exits. Small profit targets tend to work well in short-term countertrend strategies. For long-term trend trading, where capturing the occasional long trend is critical, wide trailing stops tend to perform better.
Continuing from our trend following CCI entry, we will now develop suitable exits for the hourly GBPJPY. A maximum of two exits will be applied, each with one optimizable parameter.
2. Performance Metrics
The net profit / max drawdown ratio used previously in entry testing will continue to be the primary metric. The following metrics will be taken into consideration as well:
- Number of trades – Needed for statistical significance
- Expectancy – Can our transaction costs be covered?
- Maximum drawdown – Needed for capital allocation
3. Exit Testing Results & Discussion
Most traders usually exit their trades using one or more of the following exits:
- Reversals
- Stop losses
- Trailing stops
- Time stops
- Profit targets
3.1. Reversals
In a reversal strategy, the exit of a long trade is also the entry point of a short trade. Reversal strategies seem to be viewed unfavourably in general, perhaps due to their simplicity. I have found that they perform surprisingly well for trend strategies, which often do not use much trade management. Since our CCI entry was developed as part of a reversal strategy, the reversal exit will be used as the initial baseline. The other exits will be tested one at a time, and if they improve the baseline performance, will be added to our strategy.
3.2. Stop Losses
In general, I only add a trading rule if it benefits the trading solution. I do, however, have a strong preference for using a catastrophic stop loss in my strategies. This stop loss takes you out of the market when your open loss hits your maximum allowable amount, or when you determine that the premise behind the entry has been invalidated. An optimally placed stop caps the losses on the big losers, while still giving your trades sufficient breathing space. Stop losses primarily aid risk control by reducing drawdowns. Net profit and expectancy usually decrease marginally, but many traders feel that the peace of mind of having a stop more than compensates for this. Note that stops usually work reliably except when you need them most – during times of exceptional volatility where slippage can increase drastically.
Stop losses are usually either pip-based or volatility-based. Markets are constantly evolving, and adaptive strategy elements like volatility-based stops seem like a great idea. Average true range (ATR) and standard deviation are two common technical indicators that gauge volatility. A multiple of these indicators is usually used to compute the stop distance.
Pip and ATR-based stops will be tested. Pip stops will be optimized from 10-200 pips, in steps of 2, while the ATR stops will have their multiple optimized from 0.5-5, in steps of 0.05.
Figure 1: Results of stop loss optimizations
A 180-pip stop loss seems to be the best option. Let’s see whether the performance metrics have been improved over the baseline.
Figure 2: Secondary metrics after addition of 180-pip stop loss
Surprisingly, the max drawdown was not curtailed, but profits have increased. A 180-pip stop loss will be added to the reversal strategy, and will form the new baseline. Note that the reversal exits are still active, because they are required to exit profitable trades.
3.3. Trailing Stops
With the success of the catastrophic stop, one tends to wonder whether trailing stops can further improve the trading solution. A trailing stop moves in tandem with the market when the trades goes in your favour, allowing you to limit your losses without limiting your maximum possible gain. Trailing stops tend to perform best on longer-term trend strategies. They can be activated immediately after the trade goes into profit, or only after a certain profit level has been achieved.
Similar to the stop losses tested above, pip-based and ATR-based trailing stops will be tested. The 180-pip stop loss will be kept in place, and the trailing stops will be activated once the trade is profitable.
Figure 3: Trailing stop optimization results
The trailing stops did not improve the strategy. There were even some parameters where the strategy was an overall loser. Perhaps too many trades were choked off by the advancing stops.
3.4. Profit Targets
Analogous to stop losses, profit targets close your position once your open profit reaches a target level. In general, profit targets do not work on trend following strategies, because it violates the rule of letting your profits run. However, they take you out of the market at the equity high of the trade, minimizing open trade drawdown. Once again, both pip-based and ATR-based profit targets will be tested. To accommodate the possibility of capturing large trends, the range of pips tested will be increased to 20-500, while the ATR multiples will be increased to 1.0-10.
Figure 4: Profit target optimization results
Addition of profit targets failed to improve the baseline. I find that they usually only work well in countertrend strategies.
3.5. Time Stops
With a time stop, you exit your position after a certain amount of time has elapsed, or when a certain time of day/week is reached. Capping your time in the market has a few advantages:
- Reduces systematic risk caused by economic and geopolitical factors
- Allows more efficient use of your capital
- A strategy with less time in the market is usually less correlated with other strategies in your portfolio
Time stops are simple, yet can be surprisingly effective. In fact, champion trader Kevin Davey mentioned that time stops are one of his favourite exits.
Trend strategies usually stay in the market for longer periods; having an end-of-day or end-of-week time stop does not seem to make sense. Let’s test a bar-based time stop instead. We will exit the position after a certain number of bars has elapsed. The strategy will be optimized with a time stop, ranging from 2-250 bars, in steps of 2.
Figure 5: Time stop optimization results
The 225-250 bar region has the highest NP/DD values, and is reasonably stable. A 240-bar time stop, corresponding to two trading weeks for the hourly GBPJPY, will be chosen. It is possible that time stops over 250 bars will lead to greater strategy improvements, but I prefer to avoid such long holding periods. The corresponding metrics are below:
Figure 6: Secondary metrics after addition of 240-bar time stop
The maximum drawdown has decreased by about 9% while net profits have remained unchanged, leading to an improvement in the NP/DD ratio. The number of trades actually increased, showing that you can expect to hold trades for longer than two weeks with a reversal strategy. This substantial time in the market is one reason a pure reversal strategy is risky.
4. Conclusion
A variety of common exits have been tested on our GBPJPY trend-following strategy. The addition of a 180-pip stop loss and a 240-bar time stop have increased the strategy’s net profit / max drawdown ratio from 5.26 to 6.18. Profit targets failed to improve the trading solution, as is usually the case for trend strategies. In this instance, the trailing stop performed worse than the catastrophic stop, although better performance may be achieved if the trailing stop is only activated after a certain profit threshold.
For the final part of the MT4 development workflow, we will attempt to refine our entries by testing several types of trend and volatility filters.
A
Additional Market Testing
A
Walk-Forward Optimization

Supercharge your strategy development with StrategyQuant
Access 14-day FREE trial here!
Get up to USD 300 discount!

Strategies need improvement?
Use QuantAnalyzer’s powerful analysis tools
Try the FREE version here!
Get 20% Discount here!

Hey there, Wayne here! I’m on a mission to develop robust algorithmic trading strategies for the forex markets. Trading Tact is where I share my trading methods and insights.
