June 29, 2020

The way you design your stock trading strategy can force it to react in very specific ways. Pointing toward the need to gain a long-term portfolio management perspective since the primary objective of any strategy designer should be to structure these automated trading strategies so that they can, not only survive but also generate above-average returns over 20+ years. If you cannot achieve that, it is very simple: you failed. All you might have to help you is your skills, some math, and the analysis of past history.

**Gaining A Long-Term Portfolio Perspective** started dealing with the last part of the payoff matrix equation as presented in The Portfolio Rebalancing Gambit series of articles. We usually do not have an “equation” dictating the long-term outcome of a stock trading strategy. However, there are lots of cases where strategies are governed by mathematical considerations.

**The Allocation Function**

As was mentioned before, the trade unit function u(t) needs to be proportional to the portfolio's ongoing equity value. This was written as: u(t) = F(t) / j, where *j* is the number of stocks in the portfolio. This simple definition made it a fixed-fraction trading strategy where over the life of the portfolio each new position would account for 1/j of the portfolio's equity. For example, a 100-stock portfolio would have 1% of available capital allocated to each of its 100 positions. Since F(t) would be - hopefully - increasing with time, the amount allocated per position would also rise in step with F(t). Thereby, making bigger and bigger bets as we would progress in time.

**The Initial Settings**

I do my portfolio simulations on the Quantopian website. Even before running a program, I have to set the simulation's start and end dates. It has everything to do with the program but these are not set by the program. The dates are determined by the data availability and the time interval over which I want to simulate. The initial capital is also a decision taken from outside the program, taken before the program is executed. Therefore, in these simulations, the initial capital F_{0}, the number of stocks *j*, just as the start and end dates are predetermined, they are strategy designer choices.

All this should be evident. Nonetheless, these choices do have an impact on the overall performance a strategy can deliver based on its structure, especially in a trading strategy where rebalancing is prescheduled for years on end. This will force trading to occur at preset dates and times. Trades will be executed due to the weekly price variance, most of which could be considered market noise.

The program code will deal with all the trading decisions from start to finish. We can already estimate the number of trades that will be performed over the life of the portfolio based on the estimated turnover rate (see **The Portfolio Rebalancing Gambit III** for its equation). This makes the bet sizing function dependent on the portfolio's growth rate. Simply going for full-exposure and a fixed-number of stocks is forcing the allocation unit function to tend to constant portfolio weights of 1/j. Of note, this is a sufficient condition to also maintain portfolio scalability.

Regardless, the object is to make money over the entire trading interval and not just over a few years. It is why I prefer backtests with long durations, say 10 - 15 years, and more. I expect the designed strategy to survive what is thrown at it for the duration, whatever it is, and do it reasonably well, meaning outperforming long-term market averages while maintaining risks at an acceptable level. For one thing, there will always be risks and trading expenses playing the stock market. It is why your trading strategy needs protective measures.

**Program Procedures**

The program's procedures are relatively simple. You have a stock selection process on some basis followed by a trade decision setup and a trade execution process. The final outcome can be expressed using a payoff matrix equation which will keep a record of all executed trades. It has been presented before, nonetheless, here it is again:

F(t) = F_{0} + $X = F_{0} + Σ (**H** ∙ Δ**P**)

where $X is the total generate profit or loss, **H** the stock holding matrix, and Δ**P** the price variation matrix. See the listed articles below for more detailed explanations.

What the equation says is that whatever you do trading the total generated profits $X will be: Σ (**H** ∙ Δ**P**). The payoff matrix will account for every penny made or lost. From the equation, it should be evident that the job is to maximize Σ (**H** ∙ Δ**P**). And since Δ**P** is not under your control, you only have **H**, the way you are going to trade that can and could make a difference.

So now, you can estimate how many trades your strategy is going to make over the next 20+ years, and you know your bet sizing function will grow at the same rate as your portfolio. What is left is to determine is where you get the profits and how much can you get.

**Related Recent Articles**:

**Gaining A Long-Term Portfolio Perspective**

**Toward Playing A Smarter Stock Trading Game**

**Stock Trading Game - Gambling It Out**

**The Portfolio Rebalancing Gambit – Part III**

**The Portfolio Rebalancing Gambit – Part II**

**The Portfolio Rebalancing Gambit – Part I**

**Books**:

**Reengineering Your Stock Portfolio**

June 29, 2020, © Guy R. Fleury. All rights reserved.