Wednesday, December 22, 2010

SPY Trading System: Can this Work in Real Time?

[2011 Update: I started to trade this system. Progress is here]

Earlier this week, I posted an idea for a trading system. The concept was to come up with a potential system around the SPY. I always start with the SPY - it is our S&P 500, I know this index the best. I start by looking at an un-leveraged system around the SPY, then if I think I've found an edge, I will explore leverage (either broker margin or using leveraged ETF). I also will look to broadened out to other ETF's, starting with the US Indexes (i.e. QQQQ, IWM), then other countries (i.e. FXI,EWZ), then on to sectors (i.e XLE,XLF). If this system works across various ETF's, then you know you've got something. Robustness is important.

I put up a new page with the definitions for Trading System Performance Metrics. I will go through these metrics as they relate to the SPY DD System (DD means nothing, I just needed to give it a name) in this post.

Why ETF's? They are the easiest to create a system around. Clean, free data is available (can't say that for stocks, with survivorship issues and all). They generally mean revert well and that's I how I trade.

The system I posted a few days ago has been modified to account for commissions. I am using the Interactive Brokers rate structure. They are very cheap for normal sized accounts ($10K - 250K). The CAGR% changed from 27.27% to 26.07%. That isn't very much to me; it doesn't ruin the system.

The other issue people noted was slippage. This system trades on the close. That means your orders are entered as Limit/Market on Close. This year, I have been using a few systems that trade on the close and I consistently get the last quoted price of the day as my fill (+ - $0.01). And when looking at the SPY, it is so liquid, you will get a good fill. There isn't really any slippage when it comes to order fills. This system is made for normal people with normal accounts. If you are moving (hundreds of) thousands of shares, then you may be moving price a bit and creating slippage in that regard. But for the normal folks, that shouldn't be an issue.

So here is a revised, logarithmic equity curve ( I had to get rid of drawdowns and buy+hold because it screwed up the log formatting). The top of the equity curve is about $120,000, it didn't print that.
Click on these to make them bigger.





Exposure -  56% - I'll be in the market about 1/2 of the time. Good to know.
CAR% - 26.07% - This is not bad. I wouldn't mind earning 26.07% for 10 years. I've seen better, but for the SPY, this is good. And it is not all about annual return %. Drawdowns and volatility matter.
RAR% - 46.39% -  this is CAR/Exposure. I would like to see this minimum 50%, so it is a little below that. But close enough to remain interested
Recovery Factor - 9.59 - Net Profit divided Max System Drawdown. Measures how fast the system recovers from drawdowns. 9 is very very good.
Max Drawdown - 20.89% - Looking back at the last decade, would you be comfortable with the biggest unrealized portfolio loss (based on closing prices) being 21%? I would, considering what buy & hold went through. But the size of the number isn't that important, it is the length of time. That 20.89% drawdown was recovered in 17 trading days - that is fast! Now there was another drawdown in 2002 that peaked at 14% and lasted 183 trading days -  that is a long time. My confidence would be shaken if I sat below peak equity for 9 months. It is important to view these drawdowns in the context of time.
CAR/MDD and RAR/MDD -  these should be above 1 and 2, respectively. They are, but not by a lot.
Profit Factor - 2.12 - Profit of winners divided by profit of losers. Above 2 is great. Above 3 is excellent.
Payoff  Ratio -1.2- average win/average loss. Above 1 please. Check.
Sharpe Ratio - 2.25 - Above 1 is good. Over 2 is great.
DVR Ratio - 1.6 - Above 1 is good. Over 2 is great.
R-Squared - 0.71 - Closer to 1 means the portfolio moves in a straight line. It measures the smoothness of the returns. R-squared is a function of drawdowns, the less DD's, the higher R2. 0.71 is pretty smooth.
# Trades - 593 - so that is about 60 year or 5 per month. I can handle that.
Avg Bars Held - 3.61 - good to know how long I expect a normal trade to take. When trades stretch well beyond the average holding period, it usually means I'm going to end up with a loser.
% of Winners - 63.74% - This is OK for ETF's. The systems I trade now are all above 70%, some are in the 80's. Again, it goes back to what you can handle. Am I OK with losing 4 out of 10 trades? Especially when my losers are barely less than my winners, in terms of profit %. (1.36% W vs. -1.15% L).
Avg % Profit/Loss - 0.45% - Obviously must be positive to even consider a system. 0.45% is OK. I've seen ETF systems that are in the 1.5 -2 % range and stock systems around 4%.
Avg. Max Favorable Excursion - 1.68% - MFE is the maximum profit that the trade had before the trade closed. The average gives me an idea of the average positive move the trade makes.

Avg. Max Adverse Excursion - (1.34%) - MAE is the maximum loss that the trade had before the trade closed. The average gives me an idea of the average loss move the trade makes.
If I view these together, I can expect the average trading range to be ~3%. This is not that bad; I've seen systems that would have ranges 5 times that. It just gives me an idea to the volatility of the trades. Can I stomach them?

That is basically what I'm looking at when considering a system. Also, I look at the individual trades themselves. This system buys weakness and sells strength. It goes against the grain; psychologically this can be difficult. Below are some trades during June - August, when the market was volatile and these trades may be considered 'sketchy'.  


Conclusion: I do think this system could be traded in real time. But I won't know for sure until I start. Also, I've already screwed around with variations of this system (using leverage, scaling in techniques) and using a basket of ETF's vs. just one. I have found some better % returns but crazier drawdowns, others have lower % returns but very small drawdown and a great average % gain per trade, and others have great metrics all around except they are barely in the market to provide a meaningful annual return. It really depends on what your style is, then optimize from there.

There are lots of things I surely am overlooking, but this was a good exercise to get the brain juices flowing.

Below is how a few random ETF's performed from 2000 - 2010 on the DD System. These are not bad, but not great.



Ticker
# Trades
% of Winners
CAR
Max. Sys % DD
Recovery Factor
Profit Factor
Sharpe Ratio
Avg % P/L
Avg. MAE
Avg. MFE
QQQQ
547
60.69
19.93
-37.77
         4.98
    1.44
1.31
0.41
-2.16
2.46
IWM
488
63.32
13.99
-38.74
         6.15
    1.56
1.07
0.31
-1.81
2.04
FXI
277
62.09
46.97
-23.42
         5.52
    1.91
1.93
0.94
-2.39
3.11
EWH
591
61.76
29.53
-27.75
         2.90
    1.56
1.84
0.51
-1.67
2.23
XLF
588
61.22
19.03
-37.12
         2.40
    1.39
1.14
0.37
-1.99
2.25
XLE
545
60.37
16.73
-27.32
         3.15
    1.40
1.18
0.35
-2.08
2.23
XLY
553
62.93
14.64
-30.4
         4.67
1.51
1.16
0.3
-1.66
1.91

8 comments:

Anonymous said...

Regarding the R-squared you calculate.... What are you regressing your cumulative returns against to calculate that?

Chris said...

The formula uses "cum(1)" function. This calculates an indicator that rises one point for each day since the beginning of the chart. It is supposed to be a perfect straight line.

Woodshedder said...

Chris, good stuff. Of course I love MR systems, so I'm biased ;)
If you need help with that seasonality code, let me know. I'll send you what I have. It is pretty interesting and was adapted from some H. Bandy code.
Also, are you using AFL to create those charts and graphs? I love them.

Chris said...

Wood - The graphs and stats are done in excel. There are some AFL output that I copy into excel, then tweak for presentation.

I only looked at it for a little bit, but I'm having trouble with that seasonality code. I may hit you up for help. Thanks.

Anonymous said...

That's a very pretty monthly table, did you design that?

Chris said...

Yes, I made the table in excel

Anonymous said...

Any updates? If you stopped trading it can you tell us why?

Anonymous said...

Hi Chris, can you provide any additional color on how you created the R^2 metric? I'm not sure how "cum(1)" fits into it. ...Your R^2 metric reminds me of Seykota's Lake Ratio metric. Frankly, I think I like your R^2 metric better. ...Thanks for any color.
--Bill

Post a Comment