Aug. 4, 2020

The following was posted in a Quantopian forum on a trading strategy I greatly modified in order to have it follow its payoff matrix equation directives. It is also the fifth walk-forward performed on this trend-following trading strategy over the past 3.5 months. The strategy used a leveraged adaptive exponential betting allocation function to increase its long-term performance.

Another Walk-Forward

My previous post was about my fourth walk-forward which was also, de facto, an out-of-sample simulation. This new notebook will be the strategy's fifth walk-forward to be chronicled here. It is based on the initially posted strategy which served as starting point. However, that strategy was considerably modified to answer mostly to equations rather than factors or indicators. Was also changed the strategy's overall objectives by using some behavioral trade reinforcement procedures to increase its compounded returns. It used adaptive modulated leverage and an exponential bet sizing function to increase its average profit per trade while seeking higher volatility. Return degradation compensation measures were also applied, not to a great extent mind you, but sufficiently to reduce it. I'm still learning Python, meaning that this can be improved even further.

It Still Deals With Market Noise

This did not stop the strategy from dealing mostly with market noise. Not in predicting market-noise, but just taking action after prices had moved one way or the other for whatever reason. The strategy is designed as a trend-following system trading some 400-momentum ranked stocks. The portfolio was rebalanced on a weekly basis over its 17-year simulations.

It is the rebalancing method used that controls the number of trades that will be taken. We can even make reasonable estimates as to the expected number of trades E[n] that will be executed over the life of the portfolio.

Compounding Bet Allocation

What makes the strategy worthwhile is the compounding on its bet allocation structure, its projected growing bet size. It was expressed as u(t) = F(t) / j. This trading unit function automatically made the strategy scalable and also fully invested. Maybe a better way of expressing it would be: u(t) = (F(t) ∙ (1 +γavg)t) / j where γavg is the average rate increase place on the betting function. Note that all these curves are erratic, chaotic, and random-like. But that should not stop you from using them as objective functions and make them do what you want them to do.

Protective Measures

The strategy used a different method for its protective measures. Instead of going to bonds or cash in periods of market turmoil, it went short. It started to go short about 20 times over the 17+ years of trading. Most of the short attempts were short-lived, only 5 cases went fully short as the market declined further. And as protective measures, they did the job where it counted most, during the 2008 financial crisis and during the coronavirus pandemic.

Leverage

Leveraging was used to accelerate performance. It was considered as an added expense of doing business. As long as the added alpha could cover the added leveraging expense and more. It would generate higher profits which were reinvested into the system to buy even more shares as u(t) increased.

An automated trading strategy has for long-term mission, starting with its initial capital, to generate all the cash it needs to make its trades. In simulations, strategies are designed and forced to generate these added funds from within. It is the added net profit per trade that enables taking larger positions as profits increase. The counterpart also holds: if overall profits decline, the bet size should too, as per the above bet sizing equation.

A Walk-Forward

To do a walk-forward, you need to let some time pass. In notebook 4, the time interval was from 2003-01-03 to 2020-6-11 (17.16 years). This notebook covers from 2003-01-03 to 2020-7-24 with an added 6 weeks. I know it is not much of a walk-forward, but it is still a walk-forward nonetheless. Over those 7 backtests, it is still over 3 1/2 months of walk-forward. At least, it does demonstrate that the strategy did not break down going forward.

Here is this new walk-forward: notebook 7.

It made the point that leveraging even at the 1.5x to 1.6x range can generate outsized returns. Here are some of the numbers extracted from those 7 simulations.

Summary Stats

(click to enlarge)

All the notebooks followed the equations given below in their own way with small variations on some of the variables as the total outcome was “forced” to go higher. Most of these changes were of an administrative nature, decisions that were or could be taken from outside the program if desired. Which is why I often say: it is a matter of choice what you want to do with your automated trading strategy. You are the one to determine how aggressively you want to trade. But, one thing is sure, you have to be consistent with your overall goals and trading objectives. And these objectives better comply with the underlying math of the game.

From the above table, it can be observed that final numbers for portfolio metrics such as max drawdown, annual volatility, beta, Calmar ratio, Sharpe ratio, and daily turnover were relatively stable over the 17 some years simulations of those 7 notebooks. And yet, the CAGR progressively rose as more pressure was applied to some of the payoff matrix equation variables. This is kind of counterintuitive. We were all taught that to increase long-term returns, we had to accept more risks. And yet, putting pressure on equation variables, you could increase portfolio performance from what amounts to making administrative decisions.

Average Net Profit Per Trade

Of note in the above table is the gradual increase in the average net profit per trade xavg as the simulations progressed from NB-1 to NB-7. This was achieved with a relatively minor increase in beta and annual volatility. As time was increased along with trade aggressiveness, the CAGR increased.

Some wonder how can this be done when you have equations governing the thing? The answer is relatively simple: you concentrate on the different variables in these equations. When broken down, these equations are just equivalent expressions for the whole strategy's payoff matrix:

F(t) = F0 + \$X = F0 + Σ (H ∙ ΔP) = F0 + n ∙ xavg = F0 + y ∙ rb ∙ j ∙ E[tr] ∙ u(t) ∙ E[PT] = F0 ∙ (1 + g + α – Σ expt)t

Anything that does not affect these variables is of no consequence to the bottom line. One could segment some of these variables as was done with n and xavg or elaborate on more sophisticated ones.

If you do the same thing as everyone else, should you not expect to get about the same results? If your trading strategy is not made to last, where is it going CAGR wise?

If you need to innovate to control your own payoff matrix equation, should you not at least try? From my observations, whatever you do and/or however you do it, the above rebalancing payoff matrix equation will prevail, so, why not learn to manage it and control it?

Related Books:

I have two books that are highly related to this article. The first is the theoretical side which was developed using randomly generated price series. The trading procedures used enabled jumping over the market's efficient frontier to produce higher returns.

Beyond the Efficient Frontier

The second book dealt with the practical side where these trading methods were applied to long-term real market data demonstrating the use and application of a portfolio's payoff matrix.

Reengineering Your Stock Portfolio

My recent articles do cover this same subject quite extensively. And they could be sufficient to understand the trading mechanics at work.

Aug. 4, 2020, © Guy R. Fleury. All rights reserved.