Saturday, 19 of May of 2012

Testing Stops

I have stated that, in general, stops hurt systems. In a recent e-mail, a reader quoted other authors and challenged me to defend my statement.

I define a trading system as a combination of a model and one or more data series. The model is the set of rules that identify patterns that precede profitable trading opportunities. This definition is broad enough to include fundamental analysis, technical analysis, advisory services, and any other way buy and sell decisions are made. The data is the price and volume data of whatever is being traded, together with whatever additional information is used by the model. This definition is also broad enough to include all methods of trading.

The model includes logic and rules for entries, for exits, and perhaps for risk assessment and determination of trade size. (Trade size differs from position size. Trade size affects individual trades, while position size affects the fraction of the trading account used to take each trade. For example, trade size might depend on volatility at the time the trade is being entered.)

Entries are based on some rules – some logical statements.

Exits are based on any one or any combination of:

  • Rules or logic.
  • Profit target.
  • Holding period.
  • Trailing exit (or trailing stop).
  • Maximum loss stop.

All of these apply to an individual trade and, together, determine the characteristics of the trading system.

The maximum loss stop is used to exit a trade that is experiencing a serious loss. It is not used to decide whether the trading system is healthy or broken; and it is not used to determine position size.

The trailing exit, often called a trailing stop, is different from the maximum loss stop. The trailing exit is designed to move the level at which an exit will be made as the trade progresses, protecting gains. Two common methods for implementing trailing exits are chandelier and parabolic.

All exits, including maximum loss stops are components of the trading system. They determine when to exit an individual trade. They are not used to determine position size. Position size operates at a higher level – as a component of the business of trading – along with account size, personal risk tolerance, probability of ruin, and potential for account growth.

 

How to Test

It is a straightforward process to decide whether a maximum loss stop helps your system or hurts it:

  1. Define the system, including the data series, entry rules, and exit rules. Include an exit based on maximum loss with a variable to specify the loss level required to trigger the exit.
  2. Keeping everything the same except the loss level, make a series of test runs. Vary the loss level. Begin with a level such that none of the trade exits are caused by the stop. Incrementally tighten the stop until most or all of the exits are caused by the stop.
  3. For the runs made, plot your objective function versus the stop level.
  4. Set the maximum loss to the level that results in the best system performance.
  5. Perform an analysis of the system to determine profit potential, risk, and position size. Decide if using maximum loss stop improves the system.

 

Example

Trend following systems tend to be self-correcting. When they are in a position and the price is moving the wrong direction, the logic will eventually cause an exit out of the current position and a reversal entry into the new one.

The problem arises more often with other types of systems:

  • Seasonality.
  • Pattern.
  • Mean reversion.
  • Advisory service.

These may not have logic that identifies a trade going wrong. With a mean reversion system, for example, a stock might drop from 80 to 75 and look like an attractive entry; when it drops to 70 it may look like an even more attractive entry.

This example uses the system described and analyzed in Mean Reversion based on RSI.

//	TestingMaximumLossStop.afl
//
//	AmiBroker code as used in the analysis of
//	Mean Reversion based on RSI
//	with the addition of code to test
//	the effect of using maximum loss stop.
//

SetOption( "InitialEquity", 100000 );
MaxPos = 1;
SetOption( "MaxOpenPositions", MaxPos );
SetPositionSize( 10000, spsValue );

RSILength = 4;
MALength = 200;

RSIBuyLevel = 25;		//	Basic version
RSISellLevel = 55;

RSIShortLevel = 75;	//	Basic version
RSICoverLevel = 45;

CloseAboveLongTermMA = C > MA( C, MALength );

RSI4 = RSIa( C, RSILength );

Buy = RSI4 < RSIBuyLevel AND CloseAboveLongTermMA;
Sell = RSI4 > RSISellLevel;

Short = RSI4 > RSIShortLevel AND !CloseAboveLongTermMA;
Cover = RSI4 < RSICoverLevel;

MaximumLossLevel = Optimize("MaxLossLevel",20,0,20,0.5);
ApplyStop(stopTypeLoss,stopModePercent,MaximumLossLevel);

e = Equity();
Plot(C,"C",colorBlack,styleCandle);
Plot(e,"equity",colorGreen,styleLine|styleOwnScale);

//////////////////// end ////////////////////////

The next figure shows the performance summary when this system is used to trade SPY for the period 1/28/1999 through 1/13/2012. It is using only the basic version of the system, trading long and short, $10,000 for each position, no stops (stop level set to 20% and never hit).

The maximum loss on any single trade is 9.5%.

The next figures are the equity and drawdown.

The stop level was tested at 0.5% intervals from 0.5% to 20.0%.

The next figure shows the net profit in dollars versus the stop level. Highest net profit of $11,137 is produced with no stop. In general, as the stop tightens, net profit drops.

Other objective functions may give other results. The next figure shows the CAR / MDD ratio versus stop level. Highest CAR / MDD is produced when the stop level is 4.5%. Referring back to the previous figure, profit when the stop level is 4.5% is $9,189.

Your objective function should incorporate those characteristics of the system that are important to you. Improving the CAR to MDD ratio at the expense of lower net profit may or may not be valuable to you. To determine how the stop affects risk, profit potential, and position size, work through the analysis using the trades produced with those settings.

 

Conclusion

Ignore the traditional advice and test your system using your criteria for success. Your choice of objective function will definitely make a difference. If a maximum loss stop helps, use it. If it does not help, do not use it. But never set a maximum loss stop without first knowing how it affects the performance of each specific system.

As an alternative to using a maximum loss stop, try to improve the logic of the system so that it recognizes when a trade is going bad and exits the trade, or recognizes conditions where it should avoid trading and never enters the bad trade.

Thanks for listening.


Leave a comment

You need to be loged to make a comment


Comments RSS TrackBack 5 comments