Friday, November 30, 2012

Probability Trailing Stop

Generic trailing stops maintain a steady pip distance between the most favorable price seen and the stop loss. One thing that I don't like about this is that trailing stops ignore the take profit. My goal was to increase the information available by using a trailing stop in the context of a take profit.

The only information needed for doing so is the ratio between the stop loss and take profit. If I use a 50 pip take profit and a ratio of 1, for example, then the stop loss is also 50 pips. If I used a ratio of 2, then the stop loss is 100 pips.



As the price moves closer to the take profit, the stop loss should maintain the same ratio over the remaining distance. The original take profit was 50 pips. Say that the price increased 20. Only 30 pips remain to hit the profit target. The probability trailing stop adjusts the stop loss to 30 pips from the current price if the ratio is 1. If the ratio was 2, then the stop would adjust to 30 * 2 = 60 pips. The idea was that perhaps the stop loss should ratchet closer to the take profit as it becomes increasingly likely to occur.

An easier way to think about where to set the stop is to ask, "How many pips are left until the trade hits its take profit?" If the answer is 40, then the stop loss adjusts to 40 pips away from the current price and not the entry. If the answer is 25, the stop loss changes to 25 pips from the current price. The stop loss adjusts faster and faster as a trade nears its take profit.

Changing the stop ratio to something like 0.5 makes it more complicated. If 40 pips remain before a trade reaches its limit, then the stop loss adjusts to 40 * 0.5 = 20 pips away. If 25 pips remain, then the stop ratchets to only 12.5 pips away.

Test Results

I backtested the idea using a variety of forex pairs and DOW 30 stocks for the first quarter of 2009. The direction of a trade, whether long or short, was chosen using a random number. The date chosen was simply because I have M1 data for multiple instruments. The broad spectrum of results would reflect the same trend regardless of the time periods used.

All backtests were on M1 charts. The unit sizes of the trades don't matter much; I set the trade size to a standard lot on forex pairs and 1,000 shares for equities trades. All used a 50 tick take profit with an equidistant stop loss (the stop loss ratio was 1.0). The profit factors help keep the information consistent among the different instruments.

Instrument Profit Factor
EURUSD 0.96
USDCAD 0.88
DIS 0.91
MSFT 1.0
WMT 0.87
XOM 0.87

All of these backtests involve a minimum of 300 trades. The EURUSD backtest included more than 1,700 trades. The sample size for all tests are more than sufficient for drawing a conclusion. Using a probability stop with a ratio of 1.0 is a bad idea. Although the equity curves naturally varies among instruments - and would differ using new random numbers - the equity curve below shows what it generally looks like.

 Equity curve of probability trailing stop
The equity curve for a probability trailing stop on Exxon (XOM) for Q1 2009. 

The entry efficiency of the system appears solid. However, that is because the worst possible exit always shifts up. The idea trades exit efficiency for a hint of entry efficiency. Knowing that the trades pick their direction using random numbers, it is not worthwhile to get excited about this seemingly non-random metric.

 Entry efficiency for Verizon (VZ)
 The entry efficiency consistently comes out near 55-60%. The above image shows the entry efficiency for trading Verizon (VZ). 

The losses have to come from somewhere. Clearly, as the image below demonstrates, it results from the terrible exit efficiency. Results typically ranged from 35-40%.

 Exit efficiency for probability trailing stop
 The exit efficiency for a probability trailing stop ranges from 35-40%. The above image is taken from trading McDonalds (MCD). 

If you would like to test the concept for yourself, you can download the NinjaTrader export file by clicking Probability Trailing Stop. You need to email me for the random number file, which needs to be placed in the "C:\" directory. The code will not function without it. Although the tests for a stop ratio of 1.0 look terrible, all is not lost. I can flip this on its head and turn it into a profitable concept by blending it with the random trailing limit. Outcomes using a ratio of 3.0 also offer potential hope. We'll cover those outcomes in future blog posts.