April 16, 2020

Usually, in designing automated stock trading portfolios, all the attention is put on the program's code. The trading procedures, the decision making, the gathering of relevant information that needs to be analyzed, interpreted, and acted upon. Often, our initial capital is a limiting factor just as our ability to extract a decent long-turn return.

Here, I will go about it in reverse. From the final objective, it will be to break down the trading strategy into what needs to be done to achieve these long-term returns. Something like starting from the end results and asking the question: how did we get here? Or more to the point: how could I get there? The “I” here is you.

Any stock trading strategy can be represented by the following equal set of equations:

F(t) = F_{0} + Σ (**H** ∙ Δ**P**) = F_{0} + n ∙ x_{avg} = F_{0} ∙ (1 + g)^{t} = F_{0} ∙ (1 + r_{m} + α – ex)^{t}

The 4 equal signs above give the same final outcome which is the value of the total sum of realized profits and losses over the investment period based on the applied trading strategy matrix **H**.

Each equation considers a different aspect of the problem. The first part deals with the portfolio's total payoff matrix which will valuate, summarize and keep a record of all executed trades and their respective results.

**The Strategy Matrix H**

The trading strategy matrix H and the initial capital F_{0} is what drives everything else.

A vectorized form of the payoff matrix is: Σ_{i} (q_{i} ∙ Δp_{i}) where the result of the n sequenced trades are simply added up.

There is nothing mysterious in the holding matrix. It is just a bunch of columns (stocks) giving the ongoing inventory (number of shares held in each of the stocks) over the trading interval. Evidently, this inventory could hold any number of shares (long or short) on any number of stocks of our choosing within our available capital constraints.

The second part views the portfolio as the sum of a series of trades where the actual number of trades executed (n) is multiplied by the average net profit per trade (x_{avg}) over the entire trading interval. This part says a lot about the trading strategy itself. It resumes all of the payoff matrix complexity to two numbers.

If we want to increase the output of the payoff matrix then we have to increase either of those two numbers or both. Whatever is done in a trading program that does not affect those two numbers might have no consequence on the final result.

The third and fourth part of the above equation views the problem in CAGR terms (compounded annual growth rate).

**The Strategy's CAGR**

What CAGR would have been needed to achieve the same results?

The CAGR (g) is decomposed into the long-term average market return (r_{m}) to which is added the excess return (alpha) due to the trading program's execution or the management skills brought to the game and where the added trading expenses (ex) are deducted.

Is left to determine, **which trading strategies should be applied**?

This will naturally depend on available funds, the needed number of stocks in the trading universe, the trading methodology used, the expected portfolio lifespan, the economic and political environment outlook. There are other considerations too, things like risk averseness, acceptable degree of volatility, maximum drawdowns, and long-term expectations. Every individual, just as every fund, will have different aspirations. In the end, however, it will be a matter of choice among the strategies we might find acceptable and our own circumstances, our own vision, and understanding of the problem at hand.

Regardless, there are gazillions of strategies out there. The problem is not a lack of strategies, it is the fact that you have to choose one or more out of the gazillions of possibilities. The real problem becomes which one(s) will you choose? It is not my problem. Technically, it is not my choice that matters, it is yours.

You already know the answer to **H** = **0**. If your holding inventory is zero over the trading interval, you have no gain just as you have no loss. It most certainly is not a way to build a profitable long-term portfolio. The equation for that is real easy:

F(t) = F_{0} + 0 = F_{0} + 0 = F_{0} ∙ (1 + 0)^{t} = F_{0} ∙ (1 + 0 + 0 - 0)^{t} = F_{0}

Evidently, you want the best trading strategy there is. How could I have guessed?

The problem is that I do not know which of the gazillions (>10^{400+}) of strategies are the best. I am not able to compare them all, not even an infinitesimally small fraction of them. Therefore, I cannot use the words "the best trading strategy" in any context. All I can do is say: hey, here is a strategy which behaves in this or that way. Is it the best? I do not know. Is it the worst? I do not know. Is it average? I do not know either.

But, I could say, here is what this trading strategy does, or maybe more accurately, here is what it did over this selected period of time over this selected historical data using this trading methodology. This makes it "a" trading strategy among the gazillions out there. If your latest trading strategy turns out to be better than anything you have previously done, then it might technically become your "best" trading strategy until you find something better, but it most probably will not be the best out there. It might be sufficient to simply find a "good" trading strategy that fills most of your criteria and that can outperform your peers and the long-term market averages.

**Starting From The End**

Whatever you do in trading for however long you will do it, the result will be: F(t) = F_{0} ∙ (1 + g)^{t}.

Let's start by designing a portfolio's timeline. You are 40 and want to build a portfolio to retire at 70 with another 30 years to enjoy your retirement. You have F_{0} as initial capital. What is left to determine is (g), your rate of return. You buy a 30-year F_{0} long-term bond with a 5% yield. You know exactly where you are going, how long it will take and how much you will get:

F(t) = F_{0} ∙ (1 + 0.05 )^{30} = 4.32 ∙ F_{0}.

You notice very fast that F_{0} is a critical component of where you want to go. 4.32 times $100,000 is much less than 4.32 times $1,000,000 which is much less than 4.32 times $10,000,000. The number of zeros you put on F_{0} does matter.

However, F_{0} has little to do with which trading strategy you will use, it is just your starting capital, the limited cash you force your trading strategy to comply with. It is technically disembodied from whatever strategy you will adopt. What will get to matter is (g) and how much effort you will apply to increasing F_{0} to the level of making it a realistic goal to make you go where you want to go.

Say over the first 30 years, you want a 20% CAGR - the equivalent to Mr. Buffett's long-term CAGR starting with the same $10,000,000 he had as initial capital. The outcome would be: F(t) = $10,000,000 ∙ (1 + 0.20)^{30} = $2,373,763,138. Now, this becomes more what should be your objective. You can add or remove a zero from F_{0}, and evidently, that will multiply or divide the result by a factor of 10. You do not know how you will do it yet. But you intend to also accept anything higher than g = 0.20. With a 20% CAGR, you double, on average, your portfolio every 3.81 years while at 5% it would take 14.25 years to double.

**Finding The Trading Strategy To Do The Job**

The most simple solution to achieve the above returns would have been to buy Berkshire Hathaway, sit down and relax over those 30 years. No management fees, and secured in knowing that one of the best portfolio managers was on the job protecting your interest. There are happy Berkshire Hathaway investors, to say the least.

However, those are past results, and what you have to design must survive going forward. You can simulate any type of portfolio you want, you are only limited by your own abilities. But, from the first equation presented, we know that the trading strategy's outcome must satisfy: F(t) = 10,000,000 + n ∙ x_{avg} = 10,000,000 ∙ (1 + 0.20)^{30} = 2,373,763,138. And therefore, F(t) - 10,000,000 = n ∙ x_{avg} = 2,363,763,138.

This says that your trading strategy can have any combination of those two numbers that will produce that outcome. For n = 1, representing a single trade, then the Berkshire Hathaway case would have satisfied the bill. That was not that hard to do.

An automated trading system is usually designed to handle many stocks. So, let's make it a 500-stock portfolio. To make it easy, pick the 500 stocks in the S&P 500 index. Stocks are added or removed from the index as its composition changes. This way, your portfolio is tracking the index. However, doing so, your portfolio will have the same return expectancy as the S&P 500 index which over the long term is only about 10%.

This would change the outcome to: F(t) = 10,000,000 ∙ (1 + 0.10)^{30} = 172,494,023. A 92.6% reduction on your initial 20%+ CAGR goal. Therefore, you need to design something better. The long-term prize is worth $2,199,269,115+. So, sit down, and figure it out!

**Related Articles**:

**The Financing Of Your Stock Trading Strategy II**

**The Making Of A Stock Trading Strategy**

**Dealing With Stock Portfolio Equations**

**Financing Your Stock Trading Strategy**

**Related Books**:

**Reengineering Your Stock Portfolio**

April 16, 2020, © Guy R. Fleury. All rights reserved.