April 23, 2012

Recently doing some tests on some scripts that are still available on the old Wealth-Lab 4 site, I noticed that I could select almost any script and push its performance level higher. And that raised the question: why? You should not be able to do this. All scripts are like trading philosophies, a modus operandi, a kind of recipe trying to print money. These trading strategies are not just some set of random buy and sell orders. They make assumptions on their “tradable” universe and try to profit from the vagaries of the price action. All try to exploit some form of price behavior. Be it dip-buyers, trend-followers, break-out players, mean reversal gamers or contrarian illusionists; all try to make a profit. All the scripts had some form of concept on how prices move and what ever the trading strategy applied, it was to transform this perception into dollars in the bank.

So the question raised appeared pertinent. If you take a trading strategy sample from a set of available ones, that on average have average performance levels, why would you on general be able to improve on such strategies? You need reasonable answers that can explain why you are able to do this. What are the forces at work, what are the factors and principles that are being used that can convert ordinary scripts into better performing ones?

I use a pay-off matrix of the form: Σ(**H** .* Δ**P**). All it says is that the total accumulated profits are the result of applying the trading strategy **H** to the price differential matrix Δ**P**. Where Δ**P** is simply the price difference from one period to the next: Δ**P** = **P**(t) – **P**(t-1).

When I put on the table Σ(**H**.*Δ**P**). It represents the total profits generated by any trading strategy or system. Yours, mine, anybody's, what ever the strategy, over any price differential matrix, over any time period (past, present or future), over any length of time, over any kind of assets, over any number of such assets in a portfolio. Therefore, I could always make the proposition: the total sum of all generated profits: Σ(Profits) = Σ(**H**.*Δ**P**) no matter what the trading methods H used. There is nothing metaphysical, probabilistic, esoteric about it. In its simplest form, the pay-off matrix is a 1x1 matrix, it says that the quantity traded times the difference in price is = to the profit or loss generated: Q*(P(t) – P(t-1)), or Q.*ΔP, or equivalently, Q*P(t) – Q*P(t-1) = profit or loss = sold asset – purchased asset. What anyone is looking for is that: Q.*ΔP > 0; meaning that each trade has for objective to be profitable. The same goes for an entire portfolio holding matrix, what is sought is: Σ(**H** .* Δ**P**) >0.

There is a need for a price differential Δ**P** to make a profit. And to make a profit, Δ**P** must be greater than zero; Δ**P** > 0. Otherwise, the solution is simple: you get a loss; Δ**P** < 0. Having the means to calculate what ever your trading strategy might produce, it should be simple to undertake such calculations. A simple spreadsheet would do it, after all, it is just the summation of a column-wise multiplication.

So being armed with pay-off matrix: Σ(**H** .* Δ**P**). Analyzing different trading strategies could be as easy applying different holding functions to the same price differential matrix. This way, you could compare any strategy as it operated on the same data set of price variations. Say you select 100 stocks from the S&P 500, your price differential matrix would be the same for all your tested strategies. You wanted a different stock selection, you could simply select another 100 stocks and you would have a totally different price differential matrix on which you can again compare your trading strategies for their respective merits.

Let's start by defining 5 data sets of 100 stock each taken from the S&P 500 index. This will generate 5 price variation matrices Δ**P**_{1}, ..., Δ**P**_{5} composed of 100 stocks each. Let the trading interval be 5,000 trading days (about 20 years of daily data). The same way, I could just name the trading strategies as: **H**_{1}, …, **H**_{n} for any number *n* of strategies that I would like to analyze and compare over my 5 portfolios. I could re-sample using a random selection process on the 500 S&P 500 stocks to make all new portfolios which again could be tested against any of the trading strategies under consideration.

Each of the price variation data set could be at the limit considered unique in the sense that the available combination from a set of 500 stocks taken 100 at a time is an astronomical number as it involves factorials; in fact the formula is: n! / k!(n-k)!. There would be no way to test all possible portfolios since the combinations far exceed a few googols (10 at power 100).

We could test any strategy **H**_{n} against a particular portfolio Δ**P**_{1} or change its composition to show the general behavior of the trading strategy over various price differential matrices. But because the sampling is made to resemble the index itself, technically the multitude of tests performed using strategy **H**_{n} would be like or would tend to having used that particular strategy over the index itself.

This would mean that all the portfolios created by the sampling method would be made to resemble one another by construction.

Σ(**H**_{n} .* Δ**P**_{1}) ≈ Σ(**H**_{n} .* Δ**P**_{2}) ≈ , … , ≈ Σ(**H**_{n} .* Δ**P**_{5})

By applying the same trading strategy *n* over the 5 portfolios, one would get about the same performance, on average, as if the strategy would have been applied to the whole index. So technically, anyone could test any strategy over any portfolio and the outcome would resemble or tend to about the same performance levels as if having played the index itself.

Σ(**H**_{n} .* Δ**P**_{?}) → Σ(**H**_{n} .* Δ**P**_{S&P}) / 5

As long as the sampling, the number of stocks chosen is sufficiently large. And 1/5 of the population, in this case 100 stocks, would be more that representative of the whole population. The trading strategy would be bound to show its merits in spite of the luck of the draw. If the trading strategy under study would do about the same over any subgroup of 100 shares from the S&P500, then why perform the test a googol times? The answer could be provided with just a few tests, and the approximation more than sufficient to express the value of the trading strategy. To outperform, all that would be required would be:

Σ(**H**_{n} .* Δ**P**_{?}) * 5 > Σ(**H**_{n} .* Δ**P**_{S&P})

Since the sample size is 1/5 of the S&P500. Therefore any strategy applied to any portfolio selection of 100 stocks of the S&P500 only needs to exceed 1/5 of the total profit that would be generated by holding the total 500 stocks of the index.

Now that you know that testing your trading strategy n over a 100 stocks taken from the S&P500 will give you about the same performance no matter which of the 100 stocks you picked for the portfolio. Then, probably the most important aspect of your trading strategy would be its implementation. Which strategy, not which strategy will outperform the S&P500, but which strategy will outperform the others available and the S&P500?

You could start to classify strategy **B** is better than strategy **A** and here are the reasons why. You could express that the difference between the two strategies reside, for instance, in particular lines of code that are different in the two programs.

Σ(**H**_{B} .* Δ**P**_{?}) > Σ(**H**_{A} .* Δ**P**_{?})

This way, you would be starting to build an arsenal of trading procedures designed to outperform its predecessors. Finding rules and procedures that would enhance your trading methods, not only for one portfolio, but theoretically any composition as long as you take about 100 stocks at a time. These trading rules would have to be general in nature, they would have to be applicable to the majority of stocks in your portfolio selection. Technically, they would have to apply to the majority of the 500 stocks in the S&P500.

Theoretically, you would need a minimum of about 30 stocks to demonstrate your point of view. As a sampling of 30 starts to be sufficient to be representative of the whole population. Using 100 stocks at a time only assures you that your 100 stocks selection is more than adequate for strategy comparison. And using the S&P500 is also more than representative of the market as a whole.

It would appear as if when building a test portfolio that will span 100 stocks by 5,000 trading days, the expected outcome would be to have a performance tending towards the same performance as the index, and therefore about the same as the market. That you change the 100 stocks, even though you changed all the price series, it would still give you results that would tend to be the same as the whole market itself. You design a Buy & Hold strategy for your 100 selected stocks and the performance will tend to be the same as holding the index, and this almost irrelevant of the 100 selected stocks held. You would have 1 chance in a googol to hit the 100 worst performers in a single portfolio.

So testing trading strategies **H**_{B} over **H**_{A} for any set of 100 stocks could provide a reasonable proxy for testing the relative strength or worthtiness of said strategies. Even if being tested on a relatively small sample of 100 stocks sets. No need to test on googols of combinations.

The Buy & Hold revisited

It seems that what ever trading strategy you may devised needs to compare with the Buy & Hold. The reason should appear simple. It is the simplest strategy to implement and the one requiring the less work over its entire investment life. And if you diversify over 100 stocks, you are almost assured of performing about the same as the market index. An easy solution, with a lot of free time, and average performance levels.

Using the pay-off matrix, the Buy & Hold generated profits can be expressed as:

Σ(**H**_{H} .* Δ**P**_{1}) as applied to portfolio 1 of 100 stocks.

With **H**_{H} = Q_{on} **I** with Q_{on} the quantity vector used to represent the initial quantity bought in each of the 100 stocks (*n* = 1, …, 100) , and **I** a 100 x 5,000 matrix composed entirely of ones. Having said before that holding 100 stocks was representative of holding the S&P500, why not reduce the problem further, why not just invest in the S&P500. This way you would be investing in all 500 stocks at the same time. Instead of investing in all 5 designated portfolios Δ**P**_{n} simply invest in the index itself: SPY. And the problem is solved.

Σ(**H**_{H} .* Δ**P**_{SPY}) as applied to the S&P500.

One decision, One ETF to follow with the assurance that your performance will be as good as the index itself, even over the long haul. I should have said this right from the start and save you the reader a lot of time in my convoluted thinking process.

To under-perform your new single ETF portfolio, you will have to tamper with it. And to do this, you can alter allocation or add a trading system to the equation.

Σ( Q_{o spy} **I** .* Δ**P**_{SPY}) ; a 1 x 5,000 matrix to which can be added trading functions

but before applying trading functions, you could modify allocation to see the impact on your long term portfolio. For instance, putting 10 times less capital to work would simply mean that 10 times less shares would be bought as initial investment. And this would result in 10 times less profits.

Σ( 1/10 Q_{o spy} **I** .* Δ**P**_{SPY}) = 1/10 Σ( Q_{o spy} **I** .* Δ**P**_{SPY})

You would get the same percentage return on the invested portion of the funds but you would mostly under-perform on the total profit generated as only 10% of your capital would have been at work during the whole investment period.

So under-allocating will reduce the sum of all generated profits over the life of your single ETF portfolio.

You would have 1/10 * x% + 9/10 * 0% = 1/10 * x%. Not the best way to out-perform. This exercise would suggest to be fully invested to take advantage of the average performance this index can achieve over it long term horizon. And having chosen Δ**P**_{1} or Δ**P**_{2} would have produced about the same thing, no matter what their respective composition.

But under-allocation is not the only way to under-perform. One could simply time slice his participation in the SPY portfolio over the duration of the investment. Like skipping a year here and there. Resulting in being fully in the market only part of the time and therefore being under-exposed. As a result benefiting from the average long term upside bias only part of the time. This could be represented as a time percentage participation in the SPY portfolio; like 50% time exposure would result in about 50% of generated profits.

Σ( 50% Q_{o spy} **I** .* Δ**P**_{SPY}) = 50% Σ( Q_{o spy} **I** .* Δ**P**_{SPY})

Therefore, under-exposure, be it in capital or time, will lead to under-performance. Will produce not even being able to achieve average market returns.

Developing a Trading Philosophy.

What are the alternatives? From the start, the game has little to offer and if you participate less than you should, you are bound to under-perform even the averages. Therefore, opting for a trading strategy will have it's own set of requirements, of which the first one will be to outperform the Buy & Hold. You will be looking for an enhanced trading strategy matrix **H**^{+} that when applied to the SPY price differential matrix produces more that the Buy & Hold, such as in:

Σ(**H**^{+} .* Δ**P**_{SPY}) > Σ(**H**_{H} .* Δ**P**_{SPY})

This enhance trading strategy **H ^{+}** will have to increase the holding inventory levels above the Buy & Hold if it wants to succeed. There are not that many alternatives.

Published ... April 23, 2012 © Guy R. Fleury. All rights reserved.