As was presented in ** Basic Portfolio Math IV**, the 505 listed stocks in the S$\&$P500 price matrix is the same for everyone. Its past is recorded history and there is only one iteration of it. Was also covered that the possible combinations of selectable stocks for a portfolio could be much more than considerable, more than even gargantuan, making any stock selection almost a one of a kind from this apparent limitless set of selectable possibilities.

There is not enough computing power on this planet to make an exhaustive search for the best possible trading strategy within a million lifetimes, let alone over the next few minutes.

We remain limited to the best we can find with the tools we have. Whatever that solution, its payoff matrix would tend to be unique too.

It appears as if the only way to get strategy "$a$" to be equal to strategy "$b$": $\;(\mathbf{H}_{a} \cdot \Delta \mathbf{P}) = (\mathbf{H}_{b} \cdot \Delta \mathbf{P})\,$ is to have the exact same strategy over the same price data over the same time interval. There is no reverse engineering available either, or should we say computable within one's lifetime. All you could do might be to come close using similar or different methods: $\;(\mathbf{H}_{a} \cdot \Delta \mathbf{P}) \to (\mathbf{H}_{b} \cdot \Delta \mathbf{P})\,$.

You can take any trading strategy, modify its code and let it do something completely different from its previous iteration. There is no stopping anyone there. This could be viewed as part of the problem too, since it can easily lead to curve fitting scenarios.

So, you designed this unique stock trading strategy $\mathbf{H}_{a}.\,$ A one in a thousand googol+. The structure of its program, its trading routines, and its housekeeping procedures all contribute to the outcome of its payoff matrix: $(\mathbf{H}_{a} \cdot \Delta \mathbf{P})$. You can always compare trading strategies: is $\;(\mathbf{H}_{a} \cdot \Delta \mathbf{P}) > (\mathbf{H}_{b} \cdot \Delta \mathbf{P})$, or whatever since the outcome of the payoff matrix is a single number anyway.

To have a program terminate is a confirmation the program executed to one of its endpoints. It is not a confirmation that the program is making money or that the trading logic is without flaws. It only says the program reached a termination point. There is a big difference between executable code that executed and profitable code. Normally, you cannot reach the latter without the former.

When you program your trading strategy, it will require a lot of iterations just to debug and make it work. We do not program these things without bugs the first time out, especially if the program is sophisticated and/or complex. Also, in the programming and debugging process we are introducing some optimization which in turn could overlap the fuzzy frontier of over-optimizing.

A payoff matrix is not a stand alone thing, it operates within a context. It usually should be part of a portfolio equation: $F(t) = F_0 + \sum^n_1 (\mathbf{H}_{z} \cdot \Delta \mathbf{P})\,$ where $F_0\,$ is the initial capital put to work. $\mathbf{H}_{z}\,$ is some trading strategy "$z$". The payoff matrix is the cumulative sum of all profits and losses generated by all the trading activity over the strategy's trading interval. Everything is covered in that equation. The payoff matrix keeps the historical record of every trade taken.

You want to deal with more than one strategy at a time, distribute the initial capital among them, and add their payoff matrices: $$F(t) = F_0 + \sum^{n_a}_1 (\mathbf{H}_{a} \cdot \Delta \mathbf{P}) + \sum^{n_b}_1 (\mathbf{H}_{b} \cdot \Delta \mathbf{P}) + \cdots + \sum^{n_z}_1 (\mathbf{H}_{z} \cdot \Delta \mathbf{P})$$A trading strategy could have from 1 to millions of trades. Trading implicitly is saying many trades, for some strategies, a lot of them. But, in either case, the payoff matrix will cover it. One could view its origin as the sum of many trades, like a payoff vector: $\sum (q \cdot \Delta p)$ where, there too, you sum the outcome of all trades to get the final cumulative outcome.

Each trading strategy could be viewed as the payoff matrix of part of a portfolio, and their sum as a portfolio of strategies that they be sequenced in time or overlapping. It is the strategy's program $\,\mathbf{H}\,$ that will tell it what to do. And if you want it to do something, you will have to program it in. Redeeming code does not pop up in our programs when needed. It is our job to determine what will be needed and plan for it in code.

Since the price matrix $\,\mathbf{P}\,$ and its difference matrix $\,\Delta \mathbf{P}\,$ are set, it will be up to the inventory holding matrix $\mathbf{H}\,$ to do all the work.

It will be the trading methods and procedures that will make a difference. The how it trades becomes the centre of attention and the thing that will differentiate strategies. $$\;(\mathbf{H}_{a} \cdot \Delta \mathbf{P}) > (\mathbf{H}_{b} \cdot \Delta \mathbf{P}) > \cdots > (\mathbf{H}_{SPY} \cdot \Delta \mathbf{P}) > \cdots > (\mathbf{H}_{z} \cdot \Delta \mathbf{P})$$

Forget about the Atlas strategy $\,\mathbf{H}^{*}.\,$ It was shown in ** Part IV** that it was almost unreachable (1 in 10$^{486+}$ should you want to try your luck). But this does not mean that you cannot design worthwhile trading strategies. Only that you should not waste your time in the search of "Holy Grails" of trading. They do exist, but they are not within your reach since you cannot even do an exhaustive search in order to identify them as such. You are practically guaranteed that going forward, your trading strategy will not be it, not even close.

Design the best trading strategy you can based on repeatable trading procedures, since when you breakdown the payoff matrix into its elementary parts, you will find $\,n \cdot \bar x,\,$ which is net of expenses as in: $$F(t) = F_0 + \sum^n_1 (\mathbf{H}_{z} \cdot \Delta \mathbf{P}) - \sum^n_1 (\mathbf{E} \mathsf{xp}.) = F_0 + n \cdot \bar x$$ where $n$ is the number of trades and $\,\bar x\,$ is the average net profit per trade.

That is what you have to contend with, nothing more, just two numbers. It does not matter the size of the payoff matrix or its content. What does however, is those two numbers and they have no philosophy, no opinions or predictive powers. They are just two numbers that resume all the trading activity over the entire trading interval no matter how long it was.

If, in the end, $\,n \cdot \bar x\,$ is all that will matter, then the effort should be concentrated in finding trading methods that will enhance both. Any increase in $\,n\,$ and/or $\,\bar x\,$ will improve overall performance.

This makes finding ways to improve any payoff matrix for any trading strategy the task of finding ways to increase the number of trades (all other things being equal) and/or increasing the average net profit per trade $\,\bar x$. For instance, $n$ is a trade counter, it could be increase by simply doing more of the same.

This more than simplifies the problem. We have taken, as in the S$\&$P500 example of ** Part IV**, the result of some 2,545,200 EOD trading decisions and reduced it all to 2 numbers: $n \cdot \bar x.\,$ Note that it is the same for any payoff matrix you design whatever its trading strategy. Therefore, every effort should be concentrated into enhancing those two numbers, naturally within all the portfolio constraints we might have which include limited funds, limited time, and uncertainty.

It is the uncertainty which will cause the most problems in trying to design a worthwhile trading strategy that will not only prosper over some past trading interval but most importantly that will survive when it will be set to trade live. If it was not for this little word, we could predict, with relative accuracy what would be coming our way and really make a fortune out of it. But, it does not appear to be the case, uncertainty there is.

I do not care much about what a strategy did over some past data, all I want is to make sure that going forward the strategy's programmed "behavior" will do about the same and also outperform expected long-term market averages. If my trading strategy cannot beat an indexer over the long term, then the better course of action was to become one, an indexer that is, and not follow that strategy whatever it was.

** $\underline{\mathsf{Related \; Files}}$**:

** Basic Portfolio Math I: $\quad \;\,$**
https://alphapowertrading.com/quantopian/Basic_Portfolio_Math.html

** Basic Portfolio Math II: $\quad \,$**
http://alphapowertrading.com/quantopian/01-Portfolio_Math_II.html

** Basic Portfolio Math III: $\quad$**
http://alphapowertrading.com/quantopian/01-Portfolio_Math_III.html

** Basic Portfolio Math IV: $\quad$**
http://alphapowertrading.com/quantopian/01-Portfolio_Math_IV.html

© 2018, June 14. Guy R. Fleury