19th Ave New York, NY 95822, USA

Using This Sector Filter Improves Net Profit By 50%

LOREM IPSUM DOLOR SIT AMET
best trading books

Old school trading wisdom says you should not only buy the strongest stocks but the strongest stocks in the strongest sectors.

In this article, I discuss a simple breakout system. Then I introduce a basic sector filter which improves our net profit by around 50%. Full Amibroker code is also provided.

Simple Breakout System Rules

We start with a rudimentary breakout system that we will use to invest in US S&P 1500 stocks.

Very simply, we are going to buy on a 250-day breakout, sell by trailing stop and rank any duplicate trade signals by 3-month RSI (RSI60).

We don’t need any fancy rules here since the purpose of this article is to test the usefulness of our sector filter.

So the simple rules we will use are as follows:

Buy Rules:

  • Stock closes at new 250-day high

Sell Rules:

  • By 15% trailing stop loss

Backtest Settings:

  • Starting Capital: $25,000
  • Test Universe: S&P 1500 stocks (including historical constituents)
  • Max Open Positions: 20
  • Position Size: 5%
  • Transaction Costs: $0.01 per share
  • Execution: All trades placed on next market open
  • Liquidity: Close > $2 AND Average Turnover > $250,000
  • Ranking: 3-month RSI (RSI60)

Simple Breakout System Results

Running this simple breakout system on S&P 1500 stocks between 1/2005 – 1/2018 (with no filters or fancy rules applied) we recorded the following statistics and equity curve:

  • # Trades: 781
  • Net Profit: $35,571
  • CAR: 7.05%
  • MDD: -47.81%
  • CAR/MDD: 0.15
  • Avg P/L: 3.18%
  • Win Rate: 44.56%
  • Profit Factor: 1.61

Simple breakout system rules

As you can see we have got a pretty average result here which is not totally surprising when using such simple rules. Let’s see if we can do any better by using a sector ranking and filter.

Introducing The Sector Filter

Now we have seen the results of our rudimentary breakout system we can add our sector ranking and filter.

The idea is that we are going to buy the same breakouts but only if the sector that the stock belongs to is also showing strength.

Again, we are going to measure strength using the 3-month RSI (relative strength index).

In addition, we will have a sector ranking that incorporates the strength of the sector as well as the strength of the individual stock.

So, the simple rules can now be described as below:

Buy Rules

  • Stock closes at new 250-day high
  • AND sector that stock belongs to has a 3-month RSI reading above 50

Sell Rules

  • By 15% trailing stop loss

Backtest Settings

  • Starting Capital: $50,000
  • Test Universe: S&P 1500 stocks (including historical constituents)
  • Portfolio Size: 20
  • Position Size: 5%
  • Transaction Costs: $0.01 per share
  • Execution: All trades placed on next market open
  • Liquidity: Close > $2 AND Average Turnover > $250,000
  • Ranking: RSI(60) + SectorRSI(60) (strongest preferred)

What This Means

We are using the 3-month RSI reading to measure sector strength.

We will only buy stocks on a 250-day breakout if the 3-month RSI for that sector is also above 50. A reading above 50 confirms that the sector is on an upward path.

In terms of ranking – if we get more than one signal, we will rank each stock using a formula that calculates the strength of the sector plus the strength of the stock itself, and we will choose the strongest signals first.

Ranking Calculation Example

For example, let’s say we have a buy signal for MSFT and a buy signal for DE.

Microsoft has a 3-month RSI reading of 61 and is in the technology sector ($SP1500T) which has an RSI reading of 57.

Microsoft therefore scores a rank of 118 (61 + 57).

Meanwhile, DE has an RSI reading of 49 and is in the industrial sector ($SP1500I) which has an RSI reading of 53.

DE has a ranking score of 102 which is less than Microsoft so we would buy Microsoft first, before DE.

Simple Breakout + Sector Filter Results

Now we have the sector filter created we can run the system on the data with the added rules and see the results:

  • # Trades: 648
  • Net Profit: $53,305
  • CAR: 9.18%
  • MDD: -22.48%
  • CAR/MDD: 0.41
  • Avg P/L: 4.47%
  • Win Rate: 49.85%
  • Profit Factor: 1.94

Simple breakout system with sector filter

As you can see, introducing the sector filter has greatly improved our backtest results. Our net profit has gone from $35,571 to $53,305, a 50% increase, and annual return has improved to 8.20%.

The biggest improvement is in the drawdown which has dropped from -48% down to only -23%. This gives us a much smoother equity curve.

Additional Notes

  • In order to create this system it is necessary to map each stock to an index that reflects an appropriate sector.
  • The data provider I use (Norgate Data) makes this quite straightforward since most stocks already have an infrastructure laid out including sector and industry information.
  • We can then map each sector to a relevant index to gauge sector strength. For example, the index symbol for S&P 1500 industrials is ‘$SP1500I’ and the index symbol for S&P1500 healthcare shares is ‘S&P1500A’. See the Amibroker code below for more details.
  • Since some of the sector indices do not go back further than 2005 we started our backtest there.
  • If there is no sector index available the rule gets temporarily turned off in the code.

Amibroker Code

Following you can see the full Amibroker code that was used to map the various sectors and to backtest this strategy. This code assumes use with Norgate data:

Final Thoughts

So what to make of these results?

Well they may not be extraordinary but the point of the article was to show the usefulness of using a sector filter/ sector ranking.

We have proven that it can have a positive impact on an existing trading strategy and our trading metrics have improved across the board.

We have also provided the code so that you can easily implement similar strategies in your own backtesting.

Obviously we have only scratched the surface here and there are many more ways that sector analysis could be useful in your trading.

For example, a sector filter could be applied to a mean reversion strategy, to a rotation portfolio or instead of a market timing regime. There are many options available.

Simulations and charts created with Amibroker using historical data from Norgate Data.


Comments (1)

Your post are allways much informative. I start to develop trading systems a year ago and you helped me a lot. thanks.

Leave a comment