March 26, 2013

 

Following the previous article: Designing a Trading Machine, it's time to start designing it. Some considerations or constraints will first be addressed, and from there start to give a structure to a trading strategy that will or should survive over the years.

 
Since the design is to be automated, some trading functions will be needed to explain not only the intention but also the overall expected outcome.
 

 From Winning the Game 1.1, it was set that a wealth accumulation function could be stated as:

 
W(t) = QioPio + Σt(H.*ΔP)                                                     (1)
 
where H and ΔP are matrices of n days by d stocks, and where QioPio is the initial vector of shares bought Qio of the ith stock and for each of the d stocks in the portfolio at their respective initial prices Pio. The wealth function W(t) represents the result of the initial investment in each of the stocks to which is added the sum of all their respective generated profits or losses over the entire trading interval.
 
The model W(t) should be considered sufficient to express at any time t the outcome of any trading strategy whatever it is. Profits will depend on the d selected stocks ΔP and on the applied trading strategy H for the duration of the investment period.
 
The inventory matrix H is a set of discrete functions with jumps causing the inventory holdings in each stock to change over the trading interval. All these inventory jumps are the result of either a discretionary decision process and/or the outcome of a trading script. Either way, a decision surrogate is required. Somehow, someone or some program needs to change the inventory levels as prices evolve. Not changing the inventory after the initial purchases is also a valid strategy; it has a special name: Buy & Hold.
 
The wealth accumulation function W(t) should be viewed as a long-term process. You don't build a stock portfolio over the weekend and intend to play for a day or two; the time horizon should be in terms of years, if not to say, a lifetime. There needs to be a goal somewhere, some reason to make the money: building a retirement account, finding ways to better preserve what you have worked for, or having your money work for you for a special cause. Whatever the motivation, the game is about multiple decisions with constraints. Some are market-related, and others are due to limits set by yourself or your account size.
 
We each view markets differently, we have theories on how it works and on how we can extract profit from it using our own knowledge of how markets will evolve over time. However, just in case the market does not behave according to plan, our trading strategies should be designed to prevail even in those circumstances. It is our responsibility to design trading strategies that can survive over time. Also note that from the start, the game is in favor of the long-term player.
 
The objective is not to reach for the holy grail, the objective is to design an automated trading strategy that can first be profitable, and then, ultimately outperform other long-term competing investment strategies, nothing less.
 
From equation (1), we can deduce the constraints within which a trading strategy has to operate. Surely, the available initial capital is a major constraint on whatever you intend to do: Buy & Hold, trade infrequently, swing trade, or day trade; all will have to be in such a way that W(t) > 0, meaning that you have not lost all your capital, or in academic term; your portfolio is self-financing. If over your trading horizon you reach: W(t) = 0, then game over, quit or start anew with new funds.
 
The wealth increase factor can be easily calculated:
 
W(t)                  Σt(H.*ΔP)
------    = 1 +   ------------------                                    (2)
W(0)                   W(0)
 
The payoff matrix only deals with money: profits or losses generated over the entire trading period. Only the stock selection made and the trading decisions matter; the process by which the holding inventory will or will not change over time. It's this decision surrogate that merits further investigation. This translates to the same thing as designing a profitable trading strategy: finding ways so that, in the aggregate, the number of inventory changes made, on average, are to the portfolio's long-term benefit.
 
As a bare minimum, you want Σt(H.*ΔP) > 0. Imagine trading 20 years for peanuts, barely being positive, because you did not have the foresight to plan for what could or will be.
 
By reversing the outcome, one could calculate or estimate what would have been required to achieve given goals. Start at the finish line, go back to see what would have been required to get there, and then reverse the process to determine what is needed, doable, sustainable, and realistic to go from start to finish when the finish line is 20+ years from now.
 
To have the wealth function increase at an exponential rate over time will require that: W(t) = W(0)(1+r)t = W(0) + Σt(H.*ΔP). This will require designing a trading strategy to satisfy this equation.
 
The same thing was expressed using integrals in Winning the Game 1.1:
 
A(t) = Ao  +  t Q(t)dP
 
By reversing equation (2) to fulfill long-term objectives, we can determine what would be required to achieve preset goals. As was presented in the article: On Doubling Time; there are limits to what you can do. The degree of difficulty increases as doubling time is reduced. For example, to achieve 20% CAGR over 20 years requires a doubling time of 3.81 years. This means that your portfolio needs to double, on average, every 3.81 years over the next 20 years to reach your goal. And the higher you want to go, the more difficult it will become.
 
Reaching low-performance level is relatively easy, operating at a 5% CAGR requires 14.25 years to double one's portfolio, ample time to achieve your goal and also ample time to put a portfolio to sleep. 
 
This leads to the need to express the payoff matrix on a trade-by-trade basis:
 
Σt(H.*ΔP) = (ΣQin)Pit - Σt(QinPin)                                        (3)
 
In plain text, equation (3) says that the generated profits over the trading interval are the results of the current value of the inventory held at current prices minus their costs. Notice the parenthesis. Then this becomes a numbers game with what was the profit margin and how many times has this occurred or preferably will occur in the future. For sure, past history is no guarantee of future events, but nonetheless, numbers are numbers. And when the sample required is very large, one can build some confidence intervals on the analyzed data. It will still not be a guarantee of future outcomes, but by doing more and more tests on prevailing data, one can at least gain confidence in his/her trading methodology.
 
If your trading strategy does 1 million trades over the past 20 years over a dataset of 100 stocks, then I would expect to have quite a large number of trades going forward. I don't know what the number will be, but I do know that it will be quite large.
 
If you want over 20% CAGR over the next 20 years, then how many trades will it take? What kind of edge will you offer? How many opportunities are there that can sustain your edge? And how many can you take, at any one time, based on your available capital?
 
You want to reach 10 times your original stake in 20 years' time. What are the numbers required to achieve this goal? Did you know that an average 12.5% CAGR is sufficient? A 16.16% CAGR over 20 years will result in multiplying your initial stake by 20. These are not exaggerated numbers; they are easily reachable objectives, and by designing appropriate trading strategies, they can be reached by anyone.
 
All questions that need some answers. Whatever the strategy you want to implement, it better be reasonable, otherwise, you are just fooling yourself. If you want better than 20% CAGR over the next 20 years, be prepared to offer more as a trading methodology. The game might have, in probability, an asymptotic outcome approaching 1 for long-term players and investors, but it nonetheless is a numbers game.
 
(to be continued)...
 
Here is a preview of what I did yesterday using a script I never played with before. It is made to show that the number of trades matters; and that even if you do not win all the time, the objective remains, and that is to reach the long-term goal.
 
AAPL fuzzy march 26
(click to enlarge)

Created... March 26, 2013,    © Guy R. Fleury. All rights reserved.