Thursday, December 3, 2009

Developing A Trading Strategy (Part 1)

In this article, I am going to take a simple trading strategy and show you some of the metrics that I use to determine if it is suitable for trading. Subsequent articles will expand on the strategy and the back testing process, and in the end, we should have an acceptable strategy that is easily implemented.

First, let's take our data set. I am going to use weekly S&P500 data, and the starting period for the study will be 1984. Why 1984? Because in part 2 of this series, I will introduce a filter that will improve the efficiency of the strategy introduced today, and the data for the "filter" only goes back to 1984. So this is the place where we will start.

Ok, so what is our strategy? I will buy the S&P500 on any weekly close greater than or equal to its simple 40 week moving average. I will sell the position on a weekly close below the simple 40 week moving average. Slippage and commissions are not included in the results, and when out of the market, I will not be including a money market return. All entries and exits are taken at the close of the trading week. To include the gains made over the past 8 months, the results include those points gained through last week's trading.

It cannot get any simpler than that, and in my opinion - and this is after back testing thousands of ideas - simpler is better when it comes to trading. Ease of execution is important. From my perspective, positioning myself for broad moves is a lot easier than trying to thread the needle day in and day out. By this I mean that I don' t like strategies that are dependent upon when and where you buy to consistently make money. In other words, I don't want a strategy that requires me to execute an entry or an exit with precision to make money.

Furthermore, I don't want a strategy that is dependent upon too many conditions or variables. For example, we could say we are only going to buy the S&P500 when the 40 week moving is rising and prices have closed above this key moving. In my experience, adding another variable to exclude bad trades will likely exclude some other blockbuster trade. To get something, you have to give up something. Somehow Mr. Market knows.

Before picking apart the results of the strategy, I want to make clear that I won't be discussing the merits of out of sample testing, optimization, or testing a strategy across different markets and time frames. Those concepts are important, but best saved for another day.

Figure 1 is the performance report for this strategy. This is generated in TradeStation. I have circled several key metrics on the report and linked to the numbers below.

Figure 1. Strategy Performance Report

1) The total net profit is just the number of S&P500 points generated by this strategy. This was 843.121 S&P500 points. By contrast and over the same time period, buy and hold generated 929.15 S&P500 points. This is reasonable, but if we are going to employ an active strategy, one would hope that it should improve the return. In this case it doesn't, so maybe there is some other benefit, like risk reduction, to employing this strategy.

In other words and in trading particularly, it isn't how much money you make but how you make that money that counts. For example, we can craft a strategy that makes a 100% a year, but to do this, you have to lose 50% first. I would contend that there are very few traders who would be willing to undergo or even withstand such extreme draw downs or loss of capital to achieve out sized returns. The path we take is more important than the achievement of the goal.

So the next series of metrics attempts to answer the questions: how did we make our money? What was the path that we took to achieve that return?

2) The strategy generated 42 trades.

3) 40.48% were profitable, and this is typical for a pure trend following strategy.

4) The strategy's profit factor (gross profit divided by gross loss) was 2.16. This is acceptable but just barely.

5) The select profit factor excludes outlier trades in the profit factor calculation, and as there is no change in the number, it says that there were no outlier trades generated by this strategy. Why is this important? We don't want a strategy that depends upon 1 or 2 outlier trades to make its profits.

6) The ratio average win: average loss is 3.12; greater than 2 is acceptable.

7) This strategy had 10 consecutive losing trades, and this was from the start of the last bear market in late, 1999. Being whipsawed by a lot of little losses is typical in a trend following strategy, but this is an important metric because you have to ask yourself if you can trade a strategy that loses 10 times in a row!!

8) Average bars in losing trades is less than 5 weeks, and this speaks to the trend following nature of the strategy. Losses are meant to be short in duration, yet plentiful.

Several metrics (not shown) are worth discussing.

1) The RINA Index is a measure of points gained and draw down relative to the time the strategy was in the market. For this strategy, the RINA Index is 76.49. Above 30 is thought to be sufficient.

2) This strategy was in the market 46.65% of the time, and this is typical of a trend following strategy. Less time in the market means less risk.

3) This strategy had a maximum equity curve draw down 0f 72.78%, which is similar to buy and hold. This means at some point in time in implementing our simple strategy, we can expect to lose over two thirds of our capital.

So is there any point to trading this strategy? After all, you made less points than buy and hold, and the strategy really didn't improve your risk management any as the draw down was equal to buy and hold. As written, I would not trade this strategy, but we can improve upon it by applying a filter, and I will introduce this in part 2.

Before closing out our discussion of this strategy, I want to show two graphs that I find helpful in evaluating a strategy. Figure 2 is the equity curve for the study; in this graphic look we can see how much money this strategy made and how the money was made. From 1994 to 1999, this strategy made about two third of its gains, and then in the last bear market it gave about one half of those gains back. The equity curve does go up at a nice 45 degree angle, but if we can somehow smooth out those peaks and valleys, I would be very happy.

Figure 2. Strategy Equity Curve

The second graph is the Maximum Adverse Excursion (MAE) graph. MAE assesses each trade from the strategy and determines how much a trade had to lose before being closed out for a winner or loser. For example, look at the caret with the blue box around it. This one trade lost 4.95% percent (x-axis) before being closed out for a 3.77% loser (y-axis). We know this was a losing trade because it is a red caret. What we see from the MAE graph is that the majority of winning trades had an MAE less than 1.5%, and this is to the left of the blue vertical line. I guess this is the old saying that a strong bull market won't let you in. To the right of the blue line the majority of losing trades (red carets) appear. On first glance this would seem like a convenient place to put a stop loss as the majority of trades that lost more than 1.5% went on to be losers of greater magnitude anyway.

Figure 3. Strategy MAE Graph

So if we apply a 1.5% stop loss to this strategy, we do improve the reward risk metrics significantly. For example, the RINA Index doubles, but once again, every new wrinkle to a strategy presents new problems. If you had used such a restrictive stop loss, you would have put yourself on the sidelines during the 2 year bull romp from 1996 to 1998 (caret with red circle) and you would be angsting away the past 5 months (caret with green circle) as well as you would have taken yourself out of the market early as well. Sitting on your hands and while others are making money is not very easy to do.

A more appropriate stop loss might be at 5% and certainly at 6% would put you out of the noise of the market. This is to the right of the red vertical line.

In the next article, I will add a filter that will improve both reward and risk.


Anonymous said...

CPC is showing people are buy more call then puts after today late day sell off?! Johnny, how's the Rydex looking? Thx!

Johnny G. said...

Little change in the Rydex from yesterday. As of Thursday's close:

Bullish & leveraged: 588.16
Bearish & leveraged: 394.50
Ratio: 1.49

Money market: 1,414.70

Very modest moves (roughly 2% of assets each) out of bullish funds and into bearish funds today. The remainder of the asset changes are attributable to NAV fluctuations. Money market flat.

Anonymous said...

Johnny G again, thanks for sharing!

Tim Racette said...

Does tradestation compile that statistical data for you or do you have to go about entering the data yourself?

Guy M. Lerner said...


TradeStation compiles the data in the format you see; the page I showed in the article is just one of about 6 pages and graphs

If I am really want to take something apart, I will export the results from TS to a spreadsheet that I have created for myself that allows me to calculate all sorts of metrics.

Declan Fallon said...


If you would like to try a backtest trading system builder which offers statistical performance data then give free a go.

I have a PDF available on building a strategy on the Zignals platform with examples on using single or multiple rule event triggers and different trail target/stop strategies:


aldrin james said...

I really need this strategy. I am having a hard time developing my trading company and I think this post is going to be the answer. I wish that I can also read the other parts.

stock trading seminars