June 21, 2012

Over the last few days, I commented in a LinkedIn forum on randomly generated trading. To answer a question, I built an Excel file to illustrate the construction of a payoff matrix Σ(H.*ΔP): a 10-stock by 250 trading days (which can be extendable to any size). The trading procedures were randomly generated as well as the stock prices. You simply pressed F9 to generate a totally new scenario; same as picking 10 stocks at random from an infinite normalized stock universe. Naturally, the expectancy of that system is zero.

But it still illustrated the problems a short-term trader has to face: the unknown and uncertainty. See my research note on random entries.

To the original Excel file, I added amongst other things a drift and a random gap component to have outliers (fat tails) in the price series. Doing so, even if every price variation would be random, a randomly generated trading strategy wins. At current settings pressing F9 shows a positive Σ(H.*ΔP) most of the time (over 98%). Meaning that it wins almost all the time for each of the randomly generated portfolios. Not every stock in a portfolio will produce positive results, as you would expect, but for the portfolio as a whole, the result was positive.

Consider the concept: randomly generated trades (long and short) over randomly generated price series with “fat tails” and you win the game. This is like using heads or tails to play heads or tails which as you know comes out to be the same as playing heads or tails.

There are no predictions that can be made for any single stock in any single portfolio. Each price series has its signal (drift) buried in its own noise. Each of the 2,500 price variations had about a 50% chance to rise or fall. There are some 15,000 calls to the random function in that file to determine what to do next: buy, hold, sell, short or liquidate.

The following Excel snapshot shows the first 27 trading days out of 250 for the P, ΔPH and H.*ΔP matrices.

The P matrix is randomly generated. No predictions can be made better than a lightly biased flip of a coin. The ΔP matrix is simply the price difference from row to row of the P matrix. The H matrix is the trading strategy; it is what makes the difference. It is defined as H = B – S; it is the running inventory level of shares held: it holds the number of shares you Buy minus the number of shares you Sell or Short over time.

The last matrix: H.*ΔP is an element-wise multiplication giving the generated profits or losses from executing the trading strategy H. The next Excel snapshot shows the graphs of the above matrices with some statistics like averages, min and max values.

The graphs show the entire history of the  P,  ΔP,  H, and H.*ΔP matrices. Of note: the outliers in the ΔP matrix and the increasing variance in the H.*ΔP matrix.

This would not be complete without a chart showing the performance results.

The blue line on that chart should hover around zero and has close to a zero correlation coefficient. But it is not the case. It is saying that there is a definite trend and its r-square value is 0.92 which can only say that the given quadratic equation (a power function) is a good representation of the generated profit line. This, in turn, means that the trading procedures used over the ΔP matrix are not only generating positive alpha, they are generating exponential alpha.

I know that I can not win on randomly generated stock prices. But even randomly trading the portfolio generated exponential alpha, an aberration in itself. Except if the market is not Gaussian. The Excel file demonstrated that point. And I think that is what that simple demo showed. I might not be able to predict where prices are going, but I can still play the game and win.

Created... June 21, 2012,    © Guy R. Fleury. All rights reserved