Strategy Enhancers

In the previous notebooks, The Payoff Matrix, The Game Inside, and Strategy Design Defects, I have tried to cover some aspects of the strategy design process. Even the payoff matrix was reduced to a simpler expression. I used the payoff matrix for over a decade without reducing it any further, accepting that it was the most concise expression I could find to express the total outcome of a trading and/or investment portfolio.

Yet, with: $\, n \cdot \bar x\,$.$\,$ I get a simpler representation. Two numbers: one, the last number of an incremental sequence while the other a simple average which will have an asymptotic limit. I had to look at what it all implied.

Just as with the payoff matrix: $$A(t) = A_0\, + \displaystyle{\sum_{i=1}^n (H}\,.^*\Delta{P}) $$

I had to find ways to re-express my earlier findings within the confines of this new formulation. I was saying the exact same thing, but in a different way. Using: $A(t) = A_0\, + n \cdot \bar x \,$, it had two of the terms identical, leaving: $$\displaystyle{\sum_{i=1}^n (H}\,.^*\Delta{P}) = n \cdot \bar x$$ If you want to enhance a trading strategy that has only two variables with one acting as a counter, it might bring its own set of problems. How do you enhance a trading strategy if: $\,A(t) = A_0\, + n \cdot \bar x\,$, is all you have to work with?

There are not that many options. You raise $n ^{\uparrow}$, the number of trades, you raise $\bar x ^{\uparrow}$, the average profit per trade, or you raise both. The limit on $n$ might be unrestricted, it could be as large as a trading system can support. However, this is not the case for $\bar x$, where it has already been shown that $\bar x$ does tend to a limit as $n$ increases to a large number. However, this limit $\bar x$ is not set in stone. Each stock trading strategy having its own signature will also have its own $\bar x$ level. As if saying: that trading strategy generates on average an $\bar x$ in the range of such and such as $n$ increases.

Raising $\bar x$ will be more difficult than just raising $n$. It is evident that if you make twice the trades as you did before maintaining the same average profit, you should get double the profits. Doubling $n$ has the same effect as doubling the bet size which will require more capital exposure.

It is very simple: $n$ counts. More than some people think since $\bar x$ tends to a limit as $n$ increases. By its very nature, viewing the game as: $n \cdot \bar x$, is changing the game. In a program that intends to trade a lot, it will require some kind of opportunity detection algorithm where $n$ is playing the central role and not necessarily $\bar x$, even though both matter. It will be much easier to double $n$ than to double $\bar x$, especially when $n$ will grow to be large.

The efforts deployed in increase $\bar x$ will also have a major impact on a trading strategy. On a million trades, reaching $\bar x +1$ will matter, the plus one is still a million dollars.

Compensating the CAGR Decay

One enhancement already proposed was to compensate for the linear side of a trading strategy playing in a CAGR world. All that was required was to trade more, increase $n$ at a scaled rate proportional to the portfolio's appreciation rate. This was governed, as presented in Strategy Design Defects by the following equation:

$$ \,\, n = \displaystyle \frac {A_0 \cdot \lbrace (1+r)^t - 1\rbrace}{\bar x}$$

Was also shown that you could compensate for fixed trading barrier decay. A side effect of operating using percentage price targets and percent stop losses of equal magnitude. That problem was solved by compensating for the degradation by increasing the profit target by a factor: $\frac{1}{1-f}$ which remedied the situation. See Strategy Design Defects for more details, or check my paper on Fixed Fraction:

Enhanced Trading Procedures

The mission is simple: increase performance levels with what you got. I have already shown that increasing $n$ in a linear game could help stabilize, flatten the CAGR (preventing its decay) over an extended period of time, even on a trading strategy that underperformed long term.

As if a bonus, the system itself was supplying the needed funds to carry out the operation. It required less than 2.5% of accumulating profits to do the job, and it had for side effect to more than double the output of the trading strategy.

It was not like pushing the machine to its limits. Just using a small fraction of accumulated profits with technically little added risk. You were gradually doing more of the same thing, buying a little more shares as prices were going up. And this, for the majority of stocks, since these stocks were purchased while the SPY (the average) was rising. You were helping yourself make more profits and letting the market pay the bill to let you maintain your long term CAGR level and thereby double your portfolio profits.

If it was that easy to do, what else can be done?

The $\Delta x$ Gambit

One element not emphasized enough was raising $\,\bar x$. This is much harder than it seems since as $n$ increases, it tends to a limit, a constant. See Strategy Design Defects for more explanations.

But, nothing stops anyone from increasing it anyway. Its controlling function is: $$\bar x = \displaystyle{\frac {\sum_{i=1,\,j=1}^{n,\,k}(H\,.^*\Delta{P})}{n}}$$ which we want to enhance. I will need its other representations:

$$ \,\, \bar x = \displaystyle \frac {A_0 \cdot (1+r)^t - A_0}{n}$$

and show its contribution in a more elaborate function: $$A(t) = A_0\, + \lbrack (1+f(l)) \cdot n \cdot (1+f(z)) \cdot \bar x \cdot (1+f(v))\rbrack \, = A_0\, + n \cdot \bar x $$

The CAGR flattening was done using 2.5% of ongoing reserves to increase $n$, and this translated into: $(1+f(z)) = (1+0.025)^t$.

Now, what is desired is to have $\bar x$ increase with time too.

This means we would need a value for function $f(v)$. We could start by trying to increase $f(v)$ at the same rate as $f(z)$ and see how everything reacts. It too needs to be proportional to the portfolio's growth rate as illustrated in the equation above.

This would transform the equation into:

$A(t) = A_0\, + \lbrack (1+0) \cdot n \cdot (1+0.025)^t \cdot \bar x \cdot (1+0.025)^t\rbrack $

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

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

The impact will be an increase in the payoff matrix: $$A(t) = A_0\, + \displaystyle{\sum_{i=1}^n }(H\cdot (1+0.025)^t\,.^*(\Delta{P}\cdot (1+0.025)^t)) $$ which will result in: $$A(t) = A_0\, + \displaystyle{(1+0.0506)^t\cdot \sum_{i=1}^n } (H\,.^*\Delta{P}) $$ thereby providing an enhanced performance level by a better use of generated profits. Then, some people are surprised that when you touch their trading strategies, you can push them further than they can. Yes, I can do that, and anyone can too, it is relatively easy.

This will be a gradual process distributed over the entire time line of the series. In the beginning, adding 2 shares on a 100-share trade, and maybe requesting $\$\,2.50$ more profit on an average trade of $\,\bar x = \$\, 100.00$, or $(1.025)\cdot \Delta p$. Nothing exaggerated to say the least, asking a $\$\, 100.00$ stock to rise to $\$\, 102.50$ or a $\$\, 20.00$ stock to rise to $\$\, 20.40$ before taking the profit, on average.

Since the $2.5\%$ increase in $n$ was sufficient to flatten the long term CAGR, the $2.5\%$ increase in $\bar x$ pushes the CAGR to rise over time. Ever so slightly in the beginning, almost imperceptible, but still rising. And that is what a trading strategy should do. Have an increasing CAGR over time, a way of increasing the spread, between your performance level, and the market average. Show some alpha generation.

This rise in $\,\bar x$ is simply a request for a better price to exit a position. And all it does is gradually put a little bit more money back in the account which then can be used to buy other shares, participating as well in this engineered positive feedback loop.

Pushing Further

This is not the limit of what one could do with their trading strategies. But it should be evident that if $f(z)>0$ and $f(v)>0$, then it will have a positive impact on the payoff matrix and raise its total return in CAGR terms since the factor is a power factor. Some are looking for $alpha$ all over the place, when they could build it right in their own trading strategies themselves.

Of note is that no specific trading strategy $H$ was mentioned as the above could apply to about any stock trading strategy. We could also adopt a more limiting view of the portfolio management problem. Putting $f(v)$ and $f(z)$ equal to zero, then, none of this would be visible or necessary.

A Limiting View

If you buy all the shares of all the stocks in the market you will get a very big payoff matrix: $$ \displaystyle{\sum_{i=1}^n (H_M}\,.^*\Delta{P}) $$ which tends, in the long run, to average close to major indexes. As depicted, it is the total market. One could say: SPY tends to the market average, or that the market average tends to SPY. Either way, if you are holding the entire market, you are the market. Naturally, this is pushing it to the limit, but still the following gneralization could stand:

$$\overline{CAGR}_{Market}\longleftrightarrow \,\, ≈\, \overline{CAGR}_{INDU} \longleftrightarrow \,\, ≈\, \overline{CAGR}_{SPY} \longleftrightarrow \,\, ≈\, \overline{CAGR}_{S\&P500} $$

or any other kind of index that might represent the market as a whole over the long haul.

Whatever trading method you want to use, you will get an infinitesimal fraction of this market. Like taking a very small sample of what is out there. And in all probability, as you select more and more as sample, the more your sample will approach known averages. Your portfolio will tend to long term averages, as so frequently illustrated in financial literature.

This to say that in the long run, your $\overline{CAGR}$ expectancy will be about the same as the market average. And this whatever trading method you want to devise. It could be stated something like this:

$$ \frac{A_0 +{\sum_{i=1}^n (H}\,.^*\Delta{P})}{A_0} -1\, \longrightarrow \,\overline{CAGR}_{Market} \longrightarrow \,\, ≈\, 10\% $$

You should get this market $\overline{CAGR}$ just by participating, just from the market exposure. A simple Buy $\&$ Hold of an index would give you those results if you could hold for the duration. You could buy SPY and be done with it: $\,\overline{CAGR}_{SPY}\longrightarrow \,\overline{CAGR}_{Market} \longrightarrow \,\, ≈\, 10\% $

It is that you want more, or at least, you should. You know what the long term expectancy is, but you want more, and are ready to do a little bit more to get it.

The Holding Matrix

The portfolio payoff matrix has for composition: $\sum_{i=1}^n (H_{prt}\,.^*\Delta{P}) $, where the holding matrix: $H_{prt}=B\,.^{-}S$, a buy quantiy matrix minus a sell quantity matrix. Each data element of the holding matrix could be viewed as: $h_{i,\,j} = h_{i-1,\,j} + b_{i,\,j} - s_{i,\,j} $. Is added to the existing inventory or removed from it the quantity purchased or sold. This does not give the buy or sell trigger, the reason for the inventory change, only the quantity traded. However, in itself, it becomes the trading strategy due to the implicit inventory movements. So the inventory is the running total of all shares held in each individual stocks over the trading interval. That it be one day long or 10,000 days long (≈ 40 years).

The price matrix $P$ is the recorded price for each stock in matrix format, columns for stocks, rows for time events, with: $\Delta p = p_{i,\,j} - p_{i-1,\,j} $.

Since $n$ is just the counter, $\sum_{i=1}^n i = n $, all trades are sequentially numbered, irrelevant of their size; view it as the trade id recorded for each trade. The Buy matrix will be: $b_{i,\,j} = q_{i,\,j} \cdot p_{i,\,j}$, while the Sell matrix will have: $s_{i,\,j} = q_{i,\,j} \cdot p_{i+\Delta t,\,j}$. In my EOD (end of day) programs, I'm accustomed to having $B$ and $S$ as sparse matrices. In Quantopian, they will be more populated. Especially, if $n$ needs to be the largest it can. The design of the decision matrix will have for elements: $d_{i,\,j} \in \lbrack 0,\,1 \rbrack $, a take the trade or not. This will be my big change: moving to the minute level. It is going to be interesting.

I will need to time scale the functions I have, and probably design some new ones which could help in other areas. One thing I know, there will be more data to manage, more trading decisions to be performed, more monitoring so that all the functions behave as instructed. Decision vectors, buy and sell vectors will have an impact on the growing inventory matrix adding rows and rows as the strategy evolves.

For those that have not noticed, all this is me preparing my game plan. Figuring out where I will put more emphasis. I started with the impression that I should concentrate on $\bar x$, raise the average profit per trade. But now, I want to increase both $n$ and $\bar x$, and make $n$ as large as possible.

The Nature of the Problem

This will not change the nature of the problem. I will still need to compensate for structural strategy defects. But I also intend to add some enhancers, not just some deficiency correctors. I will be looking for accelerators aimed at improving long term performance, even if at times, at the expenses of short term portfolio volatility.

I consider there are two kinds of losses. Those that occur that involve your trading capital which would have you below $A_0$, and those where you are in a drawdown where some paper profit has declined but still with $A_0$ more than intact. Losing some paper profit does not have the same impact as losing one's capital. There will always be drawdowns. That is an integral part of the game which can not be escaped, even when using enhanced trading methods.

As giving in these notebooks, since $n \cdot \bar x$ is all there is, I will need functions to improve upon the following equation as previously cited:

$$ \displaystyle {A(t) = A_0\, + \lbrace (1+l) \cdot n \cdot (1+z) \cdot \bar x \cdot (1+v)\rbrace}$$

The difference will be that each of the functions will be functions of other functions, giving the ability to control what they are going to do based on my preferences.

$$A(t) = A_0\, + \lbrack (1+f(f(l))) \cdot n \cdot (1+f(f(z))) \cdot \bar x \cdot (1+f(f(v)))\rbrack \, = A_0\, + (1 +g(t)) \cdot n \cdot \bar x $$

With such a function $g(t)$, I would be able to gain some control over the output of the portfolio in time, push it in the direction I want, when I want it to. I can even extract those controlling factors to make them accessible for outside the program. Making the trading strategy response to outside the program choices.


What was presented in these equations did not talk about $H$, the trading methods or its composition. It does not even identify $H$ as being a particular type of strategy. $H$ is simply a generic term for a stock trading strategy. And as such enables to view all trading strategies on the same footing. Giving the ability to compare trading strategies on whatever criteria we want. But, probably the most important will be in CAGR terms. What is the output of your trading strategy compared to benchmarks? Can you exceed the benchmarks, by how much, and for how long?

For me, the how long is the most important. If your trading strategy can not reach the finish line, or can not exceed the benchmarks, I would see nothing there worth pursuing.

© 2016, September 16th. Guy R. Fleury