Changing the Game II

July 4, 2012

In the previous chapter: Changing the Game, it was presented that even trading randomly over randomly generated stock prices could not only generate a positive outcome to the portfolio payoff matrix but that this outcome could generate exponential growth.

To some, it is unthinkable that a trading strategy governed by randomly generated trades over randomly generated stock prices (including unpredictable gaps) could have profits on an exponential growth rate or even a positive growth rate for that matter. As was said in prior notes, the expected value of using heads or tails to determine some other heads or tails' bet is zero. Except if one or both coins are slightly biased.

Yet, all these randomly generated trading strategies trading over randomly generated prices were producing profits at an exponential rate. This is a major statement: it would imply that as you progress in time, the rate of return is increasing in time at an exponential rate. It does not go fast, but progressively, it starts at zero and then grows and will continue to grow. As a side effect, it will gradually reduce doubling time; one of my highest objectives, if not highest priority.

Since from the previous chapter, we were left with only the P and H matrices having any significance, all the efforts should be concentrated on better understanding their respective behavior and interactions.

The price matrix P is simply the set of daily closing prices of the selected stocks. It could be of any size; one could select the 100 stocks of the S&P 100 for example, and easily build the P and ΔP matrices for 250 trading days (1 year) or 5,000 trading days (20 years).

One could also use randomly generated prices that could mimic as much as possible the Paretian nature of price movements, meaning data series having an initial price to which is added a low drift, some random components plus jumps (price gaps). This would make prices totally unpredictable. Especially if the random price variations buried any signal there might be in excessively noisy data; to the point of containing “black swans” generated by the up and down price gaps.

You could eventually predict the drift, but only after a long time and for the long term. Even if you had knowledge of the drift, it wouldn't help in the day to day operations as it would be literally drowned in all the noise and with a figure too low to really profit from it short term compared to the risk taken.

There is the conundrum: short-term, prices behave as if quasi-random; one is almost making a bet, gambling that prices might go up or down. Even if the long-term drift is up, tomorrow's price may see a down day; and with low probability a major gap down. Because the drift is so small, short-term, it goes undetected and probably undetectable. And when looking long term, the drift will tend towards the average market return. As a consequence, no long-term alpha generation, or if any, an alpha tending to zero from either side of the market average.

The Implications

It is easy to set up the P and ΔP matrices for backtesting the S&P 100. All the numbers are out there. You can analyze past data series from every angle using any simulation software available. However, all past data will remain just that: past data.

Backtesting on simulated market data made to mimic market prices, as in the randomly generated prices discussed above is something else. There, random price variations with drift and jump components become almost unpredictable with very little serial correlation. Using randomly generated data can lead, I think, to a better understanding of certain trading procedures, especially those having a long-term view of the market.

Much research has been done on past price data. Do stock prices, for instance, maintain some memory of their past? Which indirectly says stock prices can trend or display auto-correlation. One thing is sure, the longer the time horizon, the higher the probability that stock prices have an upward bias on average. One will find over the past 200 years, that over 95% of 20 years rolling trading windows are positive. This is the same as saying that over a 20 years investment interval, one has about a 95% chance, on average, of ending with a profit. But even knowing this, we still have only one future ahead of us.

If you trade using the output of random functions on what you estimate as randomly generated stock prices that mimic price jumps (gaps) how could you generate positive returns, wouldn't that be like a contradiction in terms?

A side effect might be that even trading randomly over randomly generated prices could out-perform predicting future stock prices. Just the general notion that the long-term trends could be positive would appear as a sufficient criterion for predicting prices. And if the price series are generated using random functions, how can anyone predict what will come next?

To demonstrate my point of view, all that was required was to design such an alpha generation strategy. Therefore, I opted to show and provide an Excel file showing the principles at work. This is a smaller design that the one in 2007-08 when I designed 2 such files, one 50 x 1,000 and a 100 stocks x 2,000 trading days using more elaborate trading procedures than those presented in this file (a 10 stocks x 250 trading days).

Alpha Generation Excel File

The conclusion of the Excel file can be showcased in a single graph:

Generated Profits

(click to enlarge)

The outcome of a trading strategy H applied to a price difference matrix ΔP resulted in the above payoff. The two main aspects for this payoff curve are: first, generated profits increase in time; and second, to a high degree of correlation, this increase in time is quadratic, it increases at an exponential rate.

In Excel, to execute a new test, it is sufficient to press F9 and every formula is re-calculated. Having prices as well as all the 2,500 trading decisions randomly generated, no two portfolios could ever be the same from one test to the next. For instance, pressing F9 again produced the following:

Generated Profits - 2

(click to enlarge)

Both graphics show exponential growth and are the result of applying a random trading strategy to a randomly generated price difference matrix. The trading strategy, being randomly generated will buy about anywhere during the trading interval without regards as to what the price may be at the time. And on the same principles will also sell or short shares based on randomly generated trading decisions.

Generating Random Stock Prices

Stock price variations are very complex, to the point of being very hard to predict. And the harder they are to predict, the more one should consider that randomness plays a major part in the price's evolution or generation.

P(t) = Po + ΣΔP

ΔP = Drift + Random variations + Gaps

The above equations served to generate random-like stock prices. The first one says that price is a function based on the initial price (Po) at t = 0, to which is added the sum of all price variations thereafter.

The second equation says that the price variations are composed of 3 elements: first, a long-term drift to represent the secular market trend (20 years or more) to which is added a purely stochastic process and some outliers (gaps) as unpredictable price jumps.

The Excel equations to generate these numbers are easy to construct. The drift is simply a number representing the slope of the long-term trend expressed in pennies per day (cell D3). The random price variation is produced using the Excel Rand() function which returns a number between 0 and 1. By subtracting 0.5 from the Rand() function makes it vary between -0.50 to +0.50 and multiplying this output by another number will determine the amplitude of the random fluctuation: (Rand()-0.5)*3.

Generating price gaps is as easy as generating any other price variations. They are simply low probability outcomes of higher amplitude. Again, I used the Rand() function:

+ If(Rand()>0.99, GapMultiplier*(Rand()-0.5)*10, 0)

which translates to: you have 1 chance in 100 to generate a price gap ranging between +/- 10 provided the GapMultiplier is equal to 2.

All this is relatively simple stuff. However, the output as shown in the price matrix is interesting. The price matrix becomes totally unpredictable. You can not know what will come next, either a small price variation up or down; or a “black swan” could also come your way, once in a while, up or down.

The 10 price series generated are like picking 10 stocks at random from an infinite stock universe. There is nothing you can learn from one data series to help you determine another. And there is no knowledge gained in a single test that can be transported to the next.

Stock Prices

(click to enlarge)

A view of the price matrix as a whole looks like the chart above. Pressing F9 in Excel will generate an all-new price series for each of the stocks in the portfolio. From any point in time of the generated price series will there be any type of statistical or technical analysis to help determine what is coming next.

The Price Difference Matrix

The ΔP matrix is a simple subtraction and should present little interest. It is nonetheless required for the calculation of the final payoff matrix. Its equation is: ΔP = P(t) – P(t-1). The ΔP matrix is the difference in price from row to row (day to day) of the P matrix; another way of expressing the variation in price from close to close.

The price difference matrix ΔP shows all 2,500 price variations:

Stock Prices Variations

(click to enlarge)

Of note in the price difference matrix are the outliers (gaps) that occur at random times having random amplitude. They tend to mimic what we sometimes see in the market; large unpredictable price moves.

The Trading Strategy

Here is the crux of the whole spreadsheet: the trading strategy. It is randomly generated over the entire trading interval, in this case, with 250 trading days, will require 2,500 trading decisions to be made. The basis for the equations used to generate the trades can be found in my 2008 paper: Jensen Modified Sharpe from page 28 to 35.

From their respective initial positions, stocks are bought and sold throughout the trading interval. A trade unit (number of shares to be traded at on time) serve as trade basis and is used for both long and short positions.

A representative stock holding matrix looks like the following:

Stock Holdings

(click to enlarge)

As can be seen, there is a tendency for the inventory to rise since the objective is to accumulate shares over time. By disabling the shorts, the inventory levels would only rise and look like Lévy processes with random jumps.

For longs, the governing formula is:

+ LongMultiplierEnabled * IF(Rand()>0.95, TradeBasis, 0)

which will generate, 1 unit trade, on average, over a 20 day period. The shorts operate under a similar principle: + ShortMultiplierEnabled * IF(Rand()<0.05, -TradeBasis, 0).

It is by creating an imbalance between the longs and shorts trading commands that following the initial purchase, each stock will tend to accumulate shares over the trading interval. And this inventory accumulation process will translate into profits as was seen in the first chart presented at the beginning of this note.

By accepting an accumulative inventory process, there is a Buy & Hold dimension that is being developed over the trading interval. Adding positions is like providing a reinforcement over the trading pattern.

A typical price series with its trading history is provided in the following graph:

Exectured Trades

(click to enlarge)

All the price variations are random including gaps (fat tails). And all the trading decisions are the outcome of random functions. To show the principles at work I opted to have a relatively high trading rate. But this could also be controlled to any desired level.

The Payoff Matrix

The payoff matrix is a simple multiplication. It is the result of applying the holding matrix H to the price difference matrix ΔP. The payoff matrix shows the daily profits and losses generated as time advance. Since the P matrix had the ability to generate outliers, these can be found in the large drawdowns that appear here and there over some of the price series. There are also up gaps as can be seen in the graph. The point is that none of those outliers (gaps up or down) could be predicted.

The Portfolio Generated Profits

The last chart in the spreadsheet and probably the most import is the Portfolio Generated Profits graph. It is simply the cumulative sum of the Payoff Matrix: Σ(H.*ΔP).

In the Excel file, pressing F9 will generate a new scenario. And, in final analysis, this graph is the only one of interest. It says how much was won or lost for that particular randomly generated trading strategy as applied to the randomly generated price series.

No two payoff matrix will be the same. But that is not important, it is expected. As a matter of fact, I don't think that anyone in a billion lifetimes will ever generate the same H and ΔP matrices as someone else. The future is unknown and this payoff matrix is surely a representation of this.

What is important however is that the best regression line to be applied to the data is a quadratic equation. Often with an r-square over 0.90 showing that there is a pretty good fit to the underlying data. And having a quadratic equation as the best explanation for the data implies that the data itself is an exponential function; in this case, a growth exponential function. It should be noted that a third-degree function has a higher r-square figure, but I did not want to crowd or complicate the issue.

Each time the F9 key is pressed, a totally new trading strategy is applied to the newly generated price series. Yet, the output of the payoff matrix Σ(H.*ΔP) remains positive. All the academic literature over the past 60 years says that randomly trading over randomly generated prices leads to zero alpha. And here you have this Excel file, not only generating alpha but exponential alpha.

Conclusions

All the above not only shows that one can produce alpha, even on randomly generated data, but that even using randomly generated trading strategies; this alpha will be of the exponential type. It implies that the rate of return will increase in time. Starting at zero, this rate of return will increase at an exponential rate.

It is not about achieving 100% per year from year one, it is about gradually increasing the rate of return to even exceed 100% as time progresses. It is in the nature of compounding returns and in the formulations presented in my original papers and in all my webpage notes for that matter. All my simulations also make the same point: accumulate and trade over the accumulation process. And by adopting such trading procedures your own trading strategies will also get a boost.

In the next few days, I will be adding a link to the Excel file that generated all of the above. I think it will enable anyone to “play” with my working model. I don't advocate trading randomly, there are trading methods that can do much better than what this Excel file tries to demonstrate.