The Payoff Matrix

Any trading strategy whatsoever could be represented using matrix notation within a time function:

$$A(t) = A_0\, + \displaystyle{\sum_{i=1}^n (H}\,.^*\Delta{P}) $$

where an integral payoff matrix could be explicitly given in discrete form as:

$${\displaystyle{\int_{t=0}^T}} H(t) \cdot \,dP ≈ \displaystyle{\sum_{i=1}^n (H\,.^*\Delta{P}) }$$

Either expression is for the sum of all profits and losses from all the trades taken over the trading interval having a termination time $T$. $H$ is the stock inventory, the holding matrix, with $\Delta {P}$, the price differential for each trade. All is accounted for in that single expression. As if saying: $ 2 + 2 = 4$ many times, or more appropriately in this case: $2 \cdot 2 = 4$.

This payoff matrix could hold 1 stock for 1 day and be done with it, or it could hold thousands, even millions of trades over its lifespan. It will all depend on how the price time series will be sliced and diced. It will all depend on the trading strategy used. And there, there are millions upon millions of possibilities. So many in fact, that no one, no machine in our lifetime, or next, will ever see more than a minuscule fraction of this possible universe.

That equation is at the mathematical heart of the game. It is the bean counter. Whatever you do, whatever you trade, it is accounted for in one expression. It is the total output of what you do as a trader/investor, and by extension, what you designed your program to do.

From the payoff matrix, one could design trading systems which, at their very basics, are sets of trading rules to be followed to get in and out of trades for whatever reason one would want to implement. There is no need to put anything esoteric in its construction, but then, there is no one to stop anyone from doing that either.

All a holding matrix will do is increase or decrease its stock inventory as time goes by. At times, reduce its inventory right down to zero, at others, even go negative (short). When it will reach its terminal time $T$, which should be measured in years, the end result be it positive, or not, will have accounted for every cent.

First Requirements

It should be evident to anyone that the first requirement should be:

$$\displaystyle{\sum_{i=1}^n (H}\,.^*\Delta{P}) > -A_0$$

It says: do not lose more than what you have. And that is your initial capital: $A_0$. Otherwise, if you do, you are out of the game, unless you go find another stake to start all over again. But, one should realize before starting over that whatever they did was not that fruitfull having lost it all. I would stongly recommend changing the trading strategy.

Even if that was the basic requirement, it would be desirable to do more than just not lose all one's money playing the game. The first objective therefore should be not to lose in the first place, and this will require:

$$\displaystyle{\sum_{i=1}^n (H}\,.^*\Delta{P}) > 0$$

Saying that whatever the trading strategy may be, it should at least generate a profit. Otherwise, again why play the game? Exceptions to this would be people who like to play the game for its entertainment value, some even have psychological reasons to simply lose their money, but this also goes into a certain form of entertainment. But whatever, the primary objective for anyone should be to make an overall profit.

Playing the game for 10 or 20+ years and only showing the equation above, would say that you went, in some way, for the entertainment part of the game. It is okay, everyone can do what they want with their money.

One should consider that it is not enough playing for a small positive return. We can set goals, then find trading methods to achieve those objectives.

We could say that in 10, 20 or 30+ years we want our capital to have grown by 10 times its original amount.

$$\displaystyle{\sum_{i=1}^n (H}\,.^*\Delta{P}) > 10 \cdot A_0$$

The CAGR performance is not the same across the board. A 10-bagger over 10 years has a 25.89% CAGR, over 20 years a 12.2% CAGR, while over 30 years it will drop down to a 7.98% CAGR. We make the calculations, but seldom realize the amount of time required to reach those goals, yet alone consider all the efforts that will be required along the way.

Another factor to consider is that your trading strategy should never go sub-zero at anytime before termination time $T$. Otherwise, you will have reached termination time $T$ early with a total lose of your portfolio, including your initial capital.

$$\displaystyle{\sum_{i=1}^n (H}\,.^*\Delta{P}) > - A(t)$$

Losing your portfolio early or late in the game has the same net monetary value: $- A (t)$. All you really lost is your initial trading capital: $- A_0$. Paper profits, and profits from prior trades just evaporated... Note, that what you once had, even as paper profits, was also money, but it is not in your account.

The Other Requirement

Getting a 10-bagger or more is a matter of time. It is not an overnight operation. The market average over the past century has been less than 10% in CAGR terms, with reinvested dividends. On that basis, just buying index funds, you might see your capital grow to: $\,{2.59 \cdot A_0}\,$ over a 10 year period, to $\,{6.73 \cdot A_0}\,$ over 20 years, and to $\,{17.45 \cdot A_0}\,$ in 30 years. In human terms, 30 years is a long time: 10,950+ days, 30,000+ meals. It should make the point that it takes a long time, and most of it will be spent monitoring daily a trading strategy.

But then, one could reach his 10-bagger status sooner, say with an average doubling time of 4 years or less, on average. This would be equivalent to doubling ${A_0}$ every four years generating the series: 2, 4, 8, 16, 32 as multipliers for ${A_0}$. Still, doubling every four years requires an 18.92% CAGR. It is not beyond reach.

I think it is what a stock trading strategy should strive for: the equivalent of a doubling time of less than 4 years. It is always the last doubling time that is the most important. All by itself, by definition, it amounts to all that has been done prior by the trading strategy. You remove a doubling time ($d-1$), and you cut your portfolio in half. The equivalent of a 50% drawdown. So, the point would be, how many doubling times can you get using your trading strategy? One should also consider: how long do you want or intend to play?

$${d \cdot \displaystyle{\int_{t=0}^4}} H(t)\, \cdot \,dP >= d \cdot 2 \cdot A_0$$

To achieve such results, you will have to do more than what the average is doing. Otherwise, you will do about the same as the average or less.

Buying Index Funds

If you buy index funds, or design a trading strategy that tries to mimic an index. Well, you should not be surprise if you achieve what the index did, or will do for that matter. You strive for the 10% CAGR, design your trading strategy to aim for this 10% CAGR, most probably that is what you will get.

But then, it is somewhat self defeating. You are accepting, right from the start, that all you will be able to achieve is something that will tend to the long term average, with a high probability that you will not exceed it. Meaning that chasing this indexed return in itself made you underperform as the majority of index fund investors do.

Nonetheless, you could have bought the index, a single operation, and be done with it, instead of doing all the work or have your machine do it. All that time saved!

The Math of the Trade

A single trade is simple: $q \cdot \Delta p > \, 0$, or not. You made a profit, or a loss. The numbers do not say how long it took, or will take. Nor does it say how. Only that you got in at a specific price to get out at another which could be the same, higher, or lower. But essentially, you got in, held for a period of time (microseconds to years), to then get out to complete the trade ($\Delta p$). You could maintain a position opened for years if you wanted to. I find it is a matter of choice. It is not because someone holds for longer time intervals than most that they are wrong, that they will lose the game. On the contrary, it is just another way to play the game and win. If you want a perfect example of this, see Mr. Buffett's portfolio. He did not start by taking billion dollar positions, but he can now.

You can select, for whatever reason, whichever stock you want, and as many as you want, out of the available universe of stocks traded in the market. Again, that too is a matter of choice. It will evidently have an impact on each possible trade. However, this choice, at the portfolio level, should be somewhat proportional to your conviction of the profit potential of every single trade to be made.

But whatever. One has to do more if he/she wants more than just index returns.

It is not playing defensive, strictly aiming to mimic and underperform the indexes that one should be looking for in actively trading his portfolio. If it was the case, they would be better off giving that portfolio management job to somebody else who could at least try to outperform the indexes over the long term. And there are plenty of people that can do that, or just buy SPY and be done with it.

At least, your portfolio would track the index: $\displaystyle{\sum_{k=1}^{n=1} (H_{(SPY)}}\,.^*\Delta{P}) \to \displaystyle{\sum_{k=1}^n (H_{(index)}}\,.^*\Delta{P})\,$, and tend to perform the same as the market index.

If you go for actively trading a portfolio, then it should be evident that the trading strategy you would want to apply will have for mandate to outperform the index: $\displaystyle{\sum_{k=1}^n (H_{(you)}}\,.^* \Delta{P}) > \displaystyle{\sum_{k=1}^n (H_{(index)}}\,.^*\Delta{P})\,$.

If you intend to trade, then it is relatively simple.

You will find early that $n$ counts, the number of trades you will need to do to reach your goal. Do the math: $\overline {q \cdot \Delta p} = \bar x$. What is the average profit or loss per trade? A napkin calculation will give will give you: $n \cdot \overline {q \cdot \Delta p} = n \cdot \bar x$. The number $n$ of trades you need to achieve your goal?

Look at your trading system again. Those numbers, you already have them. And they can help set your long term objectives. You make \$ 10.00 on average per trade, you want 1 million, then you will need to make 100,000 trades to get there. Is your trading strategy able to generate those numbers. If not, and you already know this, why engage in the pursuit? You already know before you start the journey that you will not reach your goals as set. The answer to this is simple: find another or better way, or quit.

I was looking at one of the clonable trading strategy presented on Quantopian. BTW, I do thank everyone putting out their strategies like that enabling others to view, test, and evaluate them based on portfolio level protocols. It is a great tool for learning, and teaching by example.

Of its 11-year journey, I opted to count the number of trades $n$ over the first 2 years. It came in at 268,000 trades with a 14.8% total return compared to a 20.9% for SPY. This translated to an average profit per trade of: $\, \bar x = \$\, 5.53$. It is still money, so you win. And, that was the objective of the game. After all, it is a machine doing all the work, and no matter how it does it, if it comes out ahead, you won.

But, I think it should have outperformed the index, it was part of its task.

The Details

A stock trading strategy should have for first mission to survive. It should only be replaced if you have a better one; and not because it failed. Every time a live trading strategy fails, it brings down its portfolio with it. And that is the usual reason given for abandoning a trading strategy: it lost its capital $- A_0$ or a big chunk of it. Then, you might be out of the game.

Why would one want to change or fine tune his trading strategy all the time or every few months?

You can always compare trading strategies at any time. The formula is straightforward: $$\displaystyle{\sum_{k=1}^n (H_{(strategy \, A)}}\,.^*\Delta {P}) > \displaystyle{\sum_{k=1}^n (H_{(strategy \, B)}}\,.^*\Delta {P}) >\displaystyle{\sum_{k=1}^n (H_{(index)}}\,.^*\Delta {P})$$ So, what should be in your trading strategy so that it could survive. What should be its composition? I see 3 processes at play.

1. Stock Selection

One can select stocks from a wide universe. But all stocks are not created equal. Some do go bankrupt for a variety of reasons, the first of which is often mismanagement, followed by outright frauds. However, in backtesting, all those stocks need to be included in the potential selectable universe. It gets ride of any potential survivorship bias that might be introduced should they not be considered. And in this regard, the Quantopian database becomes a perfect testing ground for whatever trading strategy one could design, down to the minute level.

However, no one is forced to select any of the stocks in the tradable universe. One can give a set of criteria to confine his/her choice of highly tradable stocks. Selection methods that would be true that one considered past data or future data. Stuff like the highest capitalization stocks. They have always been there in the past, and they will be there in the future even if their prices could swing a lot. There will always be a group that you could call the highest capitalization stocks.

Some people pick a fix number of stocks, whatever the selection method used, and stick to it. Instead, one could look at growing the portfolio size. Expanding the number of selectable and playable stocks. That is my preference. But, nobody is forced to consider it.

2. Trading Rules

One can have as many trading rules as one wants. The objective is not to make as few rules as possible. The main objective is that whatever $H$ is, that it outperforms the index, hopefully by the widest margin possible.

These trading rules will become what your trading strategy stands for. The construction of this holding matrix $H$ will determine the outcome of your portfolio: $\displaystyle{\sum_{k=1}^n (H_{(you)}}\,.^* \Delta{P})$. Sure your stock selection will count, but it will be your ability to extract profits from all the price gyrations that, in the end, for a trader, will matter the most. The long term investor is not that much concerned by daily price fluctuations.

Without what will turn out to be an edge, some generalized positive expectancy, your trading strategy $H$ will simply go nowhere. You have to know before you start, if: 1) there is a positive edge, and 2) that can it be maintained.

Both can be answered in a backtest. The second one needs longer back testing intervals to at least show they could have survived in the past. If your stock selection process can withstand the test of time, so should your trading methods. And you will know only if you do the duration test.

For me, it does not matter much which trading rules will be adopted. I find it secondary. For one, you will not find which one was the best or most optimal. But, if you wanted to know, the kingpin of all trading strategies does not even need to be programmed. You select what will be the highest return stock of them all, and go all in from the start, then wait for termination time T. That is the top of the line, everything else will underperform that simple portfolio. You make the big bets where it matters the most.

3. Long Term Planning

Playing a CAGR game, one has to look in terms of years, even decades. Over the first year a total return and a compounded annual growth rate come out the same: $A_0 \cdot (1 + r \cdot t) = A_0 \cdot (1 + r)^t$ for $t = 1$, and whatever the rate $r$. But it is not the case afterwards.

A spread will build between these two: $A_0 \cdot (1 + r \cdot 20) ≠ A_0 \cdot (1 + r)^{20}$.

With time, it will only get bigger: $A_0 \cdot (1 + r \cdot 30) ≠ A_0 \cdot (1 + r)^{30}$, and bigger: $A_0 \cdot (1 + r \cdot 40) ≠ A_0 \cdot (1 + r)^{40}$.

One has a choice, to play linearly or play exponentially. There is a big difference. It is not that visible over the short term, but over the long term it represents a huge difference.

Just a little math should show this: $ A_0 \cdot (1 + 0.10 \cdot 20) = 3.00 \cdot A_0$, while $ A_0 \cdot (1 + 0.10)^{20} = 6.73 \cdot A_0$. It gets even worse if you put in more time or a higher return, for instance: $ A_0 \cdot (1 + 0.15 \cdot 40) = 7.00 \cdot A_0$, while $ A_0 \cdot (1 + 0.15)^{40} = 267.86 \cdot A_0$. The first scenario represents only 2.61% of the second: $ \frac {7.00}{267.86} = 0.0261$. This difference becomes even bigger if you raise the average CAGR.

Stock market average ≈10.0%, 50 years: $ A_0 \cdot (1 + 0.10)^{50} = 113.39 \cdot A_0$. Mr. Buffett's portfolio: $ A_0 \cdot (1 + 0.20)^{50} = 9,100.44 \cdot A_0$. The market's performance is only 1.29% of Mr. Buffett's, or put in other words, he outperformed the index 80.27 times. And then, some question his trading abilities. Does it show, I admire his trading philosophy, he did an awesome job. He has the most efficient organization and trading methods to handle his long term holdings. He does know the power of compounding, that is for sure.

That is all simple math. The real point being made here is that the average rate of return is important and the time the compounding is allow to operate is even more. Your CAGR controls your doubling time. You have a limited number of years to reach your goal. So you could translate those objectives into CAGR terms over the years of interest. Another property of the game is: you do not have to retire at 65. Your computer program could keep on doing stuff for you for years and years.

In a way, you should be interested in anything to help you plan the objectives of your trading portfolio.

You want it to grow as fast as possible with the minimum risk as possible. That is understandable. Who would not? It is elementary, so obvious to anyone. But underneath it all, it is your portfolio. You guide it to do what you want it to do.

The Planning

With Quantopian you can index anything and sort it. So I will use that ability to number trades sequentially as the program already does using trade id. I will resquence mine from 1 to $n$. With $n$ as large or small as the trading strategy will produce. I do not know how many trades a trading strategy might do, but I can still count.

In my research, I often use the notion of trade units: a fix amount allocated to a trade. It sets the quantity of shares to purchase on each trade by dividing the trade unit by the available price: $ \displaystyle \frac{u}{p} = q$.

In a trading system, each purchase in this sequence could be seen as: $ u_i = q_i \cdot p_i$ and their sum as: $$\displaystyle{ \sum_{i=1}^n u_i} = \sum_{i=1}^n {q_i \cdot p_i}$$ The sum of all these trade units have the following limitation at the start of the game: $\displaystyle{ \sum_{i=1}^n u_i} \leq A_0$. The number of trade units can grow if $A_0$ grows. But, that is relatively easy to do. You are going to play a game that is biased to the upside, where on average, you intend to win, meaning that as you advance in the game, you will be making profits, almost by default, making $A_0$ grow. And therefore, will gradually be able to increase the rolling $n$ count. Leading to:

$$\displaystyle{ \sum_{i=1}^n u_i} \leq A_0 \cdot (1+g)^t$$

Giving you the ability to generate your own positive feedback loop. The objective becomes designing a trading program that can feed on itself through positive reinforcement. Using profitable trades to feed the strategy's appetite for more shares. So now, you have to increase the portfolio's ability to increase its bet size as it grows.

The Portfolio

You do not play the game for 100 trades at: $\, \bar x =$ \$ 5.53, that is just \$ 553 dollars. If we use the example cited earlier with its 268,000 trades over 2 years of its 11-year run. One could extrapolate and say that the strategy might make some 1.47 million trades generating some \$ 8.16 million as ballpark figure. The strategy came in with \$ 7.78 million, close enough for a 9-year extrapolation. Sadly, it did not outperform the index over the period. But, money is still money. One could have done worse.

Right off, one should request that his/her portfolio has to outperform index averages, say the S&P500 for instance, use SPY as surrogate to compare performance. To outperform the index you will have to do more than try to mimic the index. The first task should be to find an edge, and the first edge is in the stock selection process itself.

Since you have an 8,000+ universe to choose from, you could select those base on criteria you like or eliminate all those that are undesirable from getting in your portfolio. But this is all relative. Up to 2008, LEH was going up, even made its historic high in 2007 to go bankrupt a year after, after having been there for 140 years. One could have said: there was a trend there, even an edge... But, your trading strategy could not have known this, just as it has no advance warning of singular events, no way of predicting black swans.

Nonetheless, your trading strategy has to survive it all, whatever is thrown at it. And it is your prerogative to select only the stocks you want based on your criteria. It is also your choice to not select a lot of those stocks for a multitude of other reasons.

But whatever, the math creeps up again.

At the portfolio level, the details become more complicated. Now, trading units could be scattered all over the place. $ u_{i,\,j} = q_{i,\,j} \cdot p_{i,\,j}$. And for the portfolio, all those deployed units would have to be accounted for: $$\displaystyle{ \sum_{i=1,\, j=1}^{n,\, k} u_{i,\,j}} = \sum_{i=1,\, j=1}^{n,\, k} {q_{i,\, j} \cdot p_{i,\, j}}$$

Having fixed your trading unit, you know how many trades your capital $A(t)$ can support. In the beginning, it is: $\displaystyle { n \cdot u \leq A_0}$.

Therefore, $n$ is limited to: $ \displaystyle n = \frac{A_0}{u}$. This starts as the same concept as using weights since in the beginning, $\displaystyle \frac{u_{i,\, j}}{A_0} ≈ \omega_{i,\,j}\,$.

It is from here that it starts to get fun.

Some might not see the difference in the following expression even if the end result is the same as the payoff matrix. It is equivalent to saying: total sum of profits and losses. It corresponds to: all shares sold at their respective prices minus their respective cost is equal to the total sum of profits and losses. $$\displaystyle{\sum_{d=1}^{d} ( \lbrace\sum_{i=1, j=1}^{n, \,k} q_{i,j} \rbrace \cdot p_{i,d}} \,) - \sum_{i=1, j=1}^{n, \,k} {q_{i, j} \cdot p_{i, j}} = n \cdot \bar x \, \,$$ The above is another expression equivalent to the payoff matrix, it looks at the problem trade by trade. It shows the importance of $n$, the number of trades to be executed to reach the desired objective.

That does not leave much space for interpretation. You already know how many trades will be required to achieve your goal based on your current average profit per trade ($ n \cdot \bar x$), you already know how much it will all cost: $$\displaystyle { \sum_{i=1, j=1}^n q_{i, j} \cdot p_{i, j}} = n \cdot u $$ Therefore, the next step should be to find ways to detect the type of phenomena that would help you generate the number of trades desired with your edge of $ \bar x$ average profit per trade, and how you could reach $n$.

This changes the search for profit. It is like designing backward. You know the math and now you want to design a trading strategy that respects this math. It is not designing a trading strategy and trying to get the most out of it based on indicators on trading rules. You now fabricate the trading rules that will let you accomplice ($ n \cdot \bar x$). You already know that $n$ could be large. As a matter of fact, you want $n$ to be large.

In payoff matrix notation it would come out as: $\displaystyle{\sum_{k=1}^n (H_{(your \, strategy)}}\,.^* \Delta{P}) = n \cdot \bar x$

With this, we changed the problem, we changed the game.

The Implications

We are now looking for large $n$ and wider trade spreads, wider price differentials $\Delta p_{i, j}$ for all the stocks that will be part of the portfolio at one time or other. Technically, it is also all that is offered. You can use whatever portfolio theory you want, but at bean counting time, all that is left is $n$ and $\bar x$.

This should dictate somehow the kind of trading strategy you may want to design. There are gazillions of ways to design profitable trading strategies. In my own research, I have designed more than a few. Some backtests can be found on my website (lookup especially the DEVX series). Each trading strategy showed in its own way a different method of achieving higher performance levels than just trying to minic market averages.

My strategies make every effort to increase $n$ and $\Delta p$ as the portfolio value grows. We could rewrite the very first equation as:

$$A(t) = A_0\, + \displaystyle{\sum_{i=1, \, j=1}^{n, \,k} (H}\,.^*\Delta{P}) = A_0 + n \cdot \bar x$$

For instance, from the example above, which is not mine, with its $\bar x = \$ 5.53$, one could try to improve the spread to $ \bar x = \$ 50.00 $. It would totally change the picture. It would propel that system to some 21.3% CAGR. A major improvement worth the task of finding techniques that would increase the average spread: $ \, \overline {\Delta p}$.

To put this in perspective. A 100-share trade would show a 0.0553 average profit per share. I do not think they would have been pushing it if they would have went for the whole dime+ average per share.


It is not only $\bf H$ that matters, but it is the driving force.

We have just reduced what is considered a complex problem to two of its most basic building blocks.

The number of trades $n$, and the average profit per trade $ \, \bar x$.

A single expression:

$$A(t) = A_0\, + n \cdot \bar x$$

No complications, just the essentials. It is on that foundation that one should build his/her long term portfolio.

The only trading strategies that could make any sense, while keeping everything else equal, will be those that strive to increase either $n$, $\bar x$, or both at the same time. If you want to count the beans, you will have to grow them yourself. So, find ways to generate them, and remember that $n$, their number, counts.

To ensure profits, it will be a sufficient condition for your trading strategy to show that: $\bar x > 0$. Meaning that you really did have a long term edge, which is the only one that will let you not only survive but also thrive in one of the harshest business environments.

The above equation says that what really matters is the number of trades taken and the average profit per trade, not per share, but per trade. And it is what will constitue your portfolio over time. If you have a stable average profit per trade $\bar x$, then to increase your profits, you will need to increase $n$, the number of such trades as time progresses. But also, since you have a profitable trading strategy: $\bar x > 0$, you could increase $n$ at the speed your program can detect these trading opportunities. Thereby, generating more trades ($n$) as you go along.

How could anyone be surprised by these results? It turned the task of portfolio manager to one of inventory manager, one of bean counting, as if in a store having some inventory to sell. Replenishing the shelves with stocks purchased at an average price and sold back hopefully at a higher price to make a profit. And the store continously make those trades. For them too, wealth grows as:

$$A(t) = A_0\, + n \cdot \bar x$$

One could redesign his/her trading strategies giving them a purpose that goes beyond average market performance:

$$A(t) = A_0\, + (n \cdot f(g)) \cdot (\bar x \cdot f(h))$$

The design of these functions can make a big difference when you look at the output of a trading strategy. For this, you will have to add positive feedback to your trading strategies, meaning reinvesting ongoing profits. When all is under control, you will see your performance rise above average. Slowly in the beginning, then gradually outpacing the benchmarks, producing a wider and wider spread between the two.

My conclusions are: if it is all that is left: $n \cdot \bar x$, with one counting incrementally $n$, I am left with the problem finding more $\bar x$, and/or increasing $\bar x$. It becomes a statistical problem of being able to detect price differentials, and then capturing part of those $\Delta P \,$'s for a profit.

© 2016, September 4th. Guy R. Fleury