Trading Using Statistical Arbitrage vs. Traditional Technical Analysis

This is a discussion on Trading Using Statistical Arbitrage vs. Traditional Technical Analysis within the Technical Analysis forums, part of the Methods category; The problem with traditional technical analysis is that most financial time series (such as stock prices) are pretty close to ...

Reply
 
LinkBack Thread Tools Search this Thread
Old Oct 13, 2015, 11:58pm   #1
Joined Oct 2015
Trading Using Statistical Arbitrage vs. Traditional Technical Analysis

The problem with traditional technical analysis is that most financial time series (such as stock prices) are pretty close to being a "random walk". The "random walk hypothesis" states that stock market prices evolve according to a random walk and thus cannot be predicted. (This is consistent with the "efficient market hypothesis.") However, stock prices are not a pure random walk. For one thing, there is usually a small deterministic (predictable) component. The implication here is that much of technical analysis is an effort to detect a small deterministic trend within a larger random process. This large random component means that conventional technical analysis often doesn't work all that well.

There is some evidence that certain asset classes, such as currencies and commodities, tend to be mean-reverting, in which case I would expect traditional technical analysis to work somewhat better for these assets. Even so, there is a large random component to these asset prices that make them difficult to forecast. To address the randomness problem, some quantitative analysts use statistical arbitrage, in particular, cointegration. Cointegration involves assembling a portfolio of securities that has favorable statistical properties for forecasting. The idea is that you try to find a combination of 2 or more securities in which the random walk components largely cancel out, and you’re left with a portfolio that is more deterministic.

The most common example of this is pair trading. Pair trading is a market-neutral trading strategy that monitors the prices of two correlated securities, such as, say, Coca-Cola (KO) and Pepsi (PEP). Because these companies sell similar products, their stocks tend to move together. In pair trading you buy one and short the other (in the correct ratio) when their prices diverge significantly (based on historical norms). However, the problem with pair trading is that in recent years it has become too popular. As we know, when too many people are using the same or similar strategy, its effectiveness diminishes. To put it bluntly, it appears that pair trading is dead.

However, there’s no reason to limit cointegration to two securities. Statistical methods such as the Johansen procedure allow one to find cointegrated portfolios of 3 or more securities. The rapid growth in the number of ETFs in recent years adds a large number of potential securities with which to assemble a cointegrated portfolio. The possible number of cointegrated portfolios of 3 or more ETFs is so large that it is unlikely to be fully exhausted for the foreseeable future. (For example, I calculate 1.2 billion possible combinations of 3 ETFs. Even if only a small fraction of these exhibit cointegration, that is still likely to be a large number. The number of possible combinations of 4 or 5 ETFs is astronomical.)

There are commercial software packages (such as FX AlgoTrader) which enable users to find and trade cointegrated pairs, but I’m not aware of any commercial products that enable users to assemble cointegrated portfolios of 3 or more securities. For anyone who has software programming skills, there are resources available to do this. (For example, Ernie Chan’s “Algorithmic Trading: Winning Strategies and Their Rationale” provides a good overview, is practical and not overly technical.) As a software engineer, I wrote my own software to find and trade cointegrated portfolios of multiple (3 or more) securities. Currently, I’m trading a cointegrated portfolio of 3 ETFs, and so far, I’m having good results. I did paper trading for nearly a year while I developed and refined the algorithm, but I recently “went live”. Backtesting suggests I should be able to achieve greater than 50% average yearly return (AYR), with a maximum drawdown of 13%. Since I starting live trading in a $100,000 account 2 1/2 months ago I’ve made an 11.3% return during this period. (If the algorithm continues to perform this well, this suggests an AYR of 67%.) Time will tell how well the algorithm continues to perform.

To implement a mean reversion strategy, I apply a Kalman filter to the cointegrated portfolio. This provides optimal dynamic updating of the portfolio weights, along with error and variances of the “spread”. (This is similar to a Bollinger Band approach, but without the lag inherent in moving averages and moving standard deviations.) The following chart shows 5 years of weekly data of the spread “error” (blue line), along with +/- the square-root of the spread variance (green/red lines). When the spread error is above the green line, I short the portfolio. When it’s below the red line, I buy:

kalman-filter-statistics.jpg

The cumulative returns during 4 years of backtesting produced an in-sample AYR of 67%:

cumulative-returns.jpg

If this thread generates any interest, I’ll try to post regularly to report on the algorithm performance, answer questions, and discuss other trading strategies I’m looking at, such as using multivariate auto-regressive models.

P.S. If anyone can tell me how to make the chart images larger, I'd appreciate it!
IFeelFree is offline   Reply With Quote
Thanks! The following members like this post: timsk , Charlton , mcquak , kalott , sdnian
Old Oct 21, 2015, 1:28pm   #2
 
Mr. Charts's Avatar
Joined Sep 2001
This is not my thing as I get much higher returns actively day trading, but it is very interesting and I ,for one, appreciate the time and effort you've put in posting the above. Please continue
__________________
Mr. Charts
Full time US Share Trader
Follow me on Twitter twitter.com/MrChartsJoyson

Contributor to T2W's Trading FAQ Book
http://www.trade2win.com/books/trading-faqs

T2W interview

http://www.trade2win.com/knowledge/a...ichard-joyson/
Mr. Charts is online now Coach/Trainer   Reply With Quote
Old Oct 21, 2015, 7:18pm   #3
Joined Oct 2015
IFeelFree started this thread
Quote:
Originally Posted by Mr. Charts View Post
This is not my thing as I get much higher returns actively day trading, but it is very interesting and I ,for one, appreciate the time and effort you've put in posting the above. Please continue
Thanks, Mr. Charts. I suspect that my approach is bit too mathematical for most traders, but the math gives me confidence that I have a sound basis for making my trades. There's at least one other trader on this forum who's also using a cointegration/mean-reversion strategy. I'm looking at other strategies as well, such as cointegrated vector autoregressive models and momentum strategies. As long as I'm making good returns, I'm going to continue with this.
IFeelFree is offline   Reply With Quote
Old Dec 12, 2015, 12:54am   #4
Joined Apr 2004
IFeelFree,

Your stuff sound very good. I have some questions :

- You use ETFs are of same sectors for your portfolio ?
- You run ols regression for the ETFs weights ?
- Your backtest it's for 3 ETFs or all portfolio ?
- What timeframe you use ?

Regards.
surfeur is offline   Reply With Quote
Old Dec 12, 2015, 8:16am   #5
 
nine's Avatar
Joined Sep 2003
If you stuck with "what's good about this" rather than creating fake straw men you'd be on sounder ground. Disparaging something you seem to know little about makes you look foolish. Instead, if you expound on your method it could be an interesting thread.
nine is offline   Reply With Quote
Old Dec 13, 2015, 12:36am   #6
Joined Oct 2015
IFeelFree started this thread
Quote:
Originally Posted by surfeur View Post
IFeelFree,

Your stuff sound very good. I have some questions :

- You use ETFs are of same sectors for your portfolio ?
- You run ols regression for the ETFs weights ?
- Your backtest it's for 3 ETFs or all portfolio ?
- What timeframe you use ?

Regards.
1. The ETFs I'm currently using are for stocks, bonds, and commodities. (I don't want to list the ETFs because I want to keep that proprietary.) I also use the inverse ETFs rather than short the ETFs (which I can't do in my account.)

2. The ETF weights are obtained from the Johansen procedure, which optimizes cointegration, and so is different than OLS. (In the case of only two time series, one can use OLS to obtain coefficients, but not when there are 3 or more time series.) In particular, the Johansen procedure uses a vector auto-regressive model to look for a cointegrating relationship between multiple time-series. I found the code for the Johansen procedure online, and I verified by inspection that the code agrees with the formulas.

3. The 3 ETFs (and their inverse) are used to assemble the portfolio, which is updated every time I make a trade (weekly). I did backtests using 5 years of data which, because of the lookback period, gives 4 years of returns. I update the parameters every week, so the whole thing is very dynamic.

4. I trade weekly. I ran the backtest for daily trades but the results were only a modest improvement. Given the much higher trading costs of daily vs. weekly, I decided to stick with a 1 week time-frame.

I'm happy to report that the algorithm had me short stocks and long bonds this week, which made it very profitable during Friday's bloodbath.
IFeelFree is offline   Reply With Quote
Old Dec 13, 2015, 12:52am   #7
Joined Oct 2015
IFeelFree started this thread
Quote:
Originally Posted by nine View Post
If you stuck with "what's good about this" rather than creating fake straw men you'd be on sounder ground. Disparaging something you seem to know little about makes you look foolish. Instead, if you expound on your method it could be an interesting thread.
It may be the case that technical analysis can key in on certain patterns that come up when traders act in certain ways. I don't know. However, based on standard statistics, price movements in markets exhibit a high degree of "randomness", that is, poor predictability of those price movements is expected using conventional technical analysis. Nevertheless, it appears that some experienced traders are able to use such analysis profitably. I suspect that years of trading have given them a highly developed intuition regarding the markets, and that is their true edge.

Traders uses whatever edge they have in trading. My edge, if I have any, is my mathematical knowledge and programming skills. The advantage with my approach is that I only spend about 3 hours a week trading and updating my software, and I'm up 15% since August. That's good enough for me.
IFeelFree is offline   Reply With Quote
Old Dec 19, 2015, 6:29pm   #8
Joined Apr 2004
Thanks IFeelFree for your feedback.

How many bars you use for find your cointegration ? 2500 5000? more?

So if i understand right, you don't use the weight found with johansen procedure but you use kalman filter ?

If Yes there are differences ? the weight of johansen isn't enough good?
surfeur is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Statistical Arbitrage resources hirtop General Trading Chat 1 Oct 3, 2015 7:16pm
Statistical Arbitrage trading/market neutral strategies hirtop General Trading Chat 2 Oct 3, 2015 7:04pm
Is there any good statistical data on Technical Analysis Patterns? watkins Technical Analysis 5 Mar 22, 2013 1:12pm
Statistical Arbitrage? yari123 Discretionary Trading 2 Aug 2, 2007 3:51pm
Statistical Arbitrage ducati998 Trading Systems 1 Dec 29, 2004 3:18am

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)