Few weeks back I gave a talk about Backtesting trading strategies with R, got a few requests for the slides so here they are:
This is not an investment advice!!
Couple of weeks back, during amst-R-dam user group talk on backtesting trading strategies using R, I mentioned the most effective style for hedge funds is relative value statistical arbitrage, I read it somewhere. After the talk was over, I was not sure anymore if it was correct to say it and decided to check it.
Open source is amazing! I cannot even start to imagine the amount of work invested in R, in firefox browser (Mozilla), or Rstudio IDE, all of which are used extensively around the globe, free. Not free as in: free sample till you decide to upgrade, or: sure it’s free, just watch this one minute commercial every time you need to use it, but free, as in: we think it might make your life better, enjoy. Warms the heart, in direct opposite to the fabulous fabs out there, that instead of contributing to a better, safer society, set it back and get paid for it (see appendix). Character is also normally distributed I guess.
Having stock market in mind, in the previous post: “Price is right, part one.”, I stated that we should not think in terms of “the price went up/down too much” but that “the current price level is wrong since…. and the market is not getting it because…”, bearing in mind that Mr. Market is not a weak player to say the least.
In this post I back this claim with the examination of a trading strategy that ignores economical arguments, thus is only based on relative price moves. Say you believe my previous post is horseshit, wouldn’t it be nice to short the market if it’s “too high” and to long it when it “went down too much”? Fine!, let’s have a look at the performance of such a strategy.
A few words for those of you who are not familiar with the “pairs trading” concept. First you should understand that the movement of every stock is dominated not by the companies performance but by the general market movement. This is the origin of many “factor models”, the factor that drives the every stock is the market factor, which is approximated by the S&P index in most cases.
I am talking here about money managers. for those of us who have one. We assume they understand about markets in such a way that they can, and will generate at least the benchmark returns, what ever this benchmark may be.
In financial context, is suppose to reflect the relation between a stock and the general market. A broad based index such as the S&P 500 is often taken as proxy for the general market. The , without getting into too much detail, is estimated using the regression:
A of say, 1.5 means that when the market goes up 1% the specific stock goes up 1.5%. (Ignoring all the biases at the moment!)
In his book, “A demon of our design”: Richard Bookstaber talks about the concept of coupled systems. These are systems where, once launched, are impossible to shut down. One such process is a plain take off. Once started, the pilot has no way back, he cannot stop after getting off the ground, so the only way is up. Well, in financial markets, up is generally considered good,
THIS IS NOT INVESTMENT ADVICE. ACTING BASED ON THIS POST MAY, AND IN ALL PROBABILITY WILL, CAUSE MONETARY LOSS.
Most of us are risk averse, so in our portfolio, we prefer to have stocks that will protect us to some extent from market deterioration. Simply put, when things go sour we want to own solid companies. This will reduce return fluctuation and will help our ulcer index against large downwards market swings. Large caps are such stocks. But which large caps should we chose? The squared returns are often taken as a proxy for the volatility so, keeping simplicity in mind, I use those.
When we speak about volatility we generally refer to the relative movement of an instrument, say stock, from its center, say average. So high volatility instrument means high swings in its price process. In recent years, with the increase in “fire power”, both in computing and information flow, there has been a spike in analysis of intra-day data. Data that describes the price within the day, as oppose to the more conventional, “open” (open price of the stock for the day) and “close” quotes.
We take a look at the pattern of “swings” from stock prices within the day.