June 8, 2014

Still in the process of re-evaluating my old trading strategies. This time the selected strategy is the BBB System (BullPower and BearPower Balance). It was designed in 2003, and its author also published it in Stocks & Commodities magazine (October issue). This means at least 10 years of out-of-sample (OOS) data. One can do a 10-year walk-forward test on this one since it has been literally frozen in time.

The original BBB System was relatively simple (the trading logic itself was less than 50 lines of Wealth-Lab code). It was based on the turning up or down of the spread between the BullPower and BearPower indicators. Nothing extraordinary, a kind of variation on a MACD theme where you sold at the highest divergence and bought the turning point up from the lowest divergence.

This served as the trend definition and, therefore, made this strategy a trend-following system aiming to be in the market when the trend was up and not at all when the trend was down. The strategy was trying to capture the up leg of a price swing. It's not necessarily a bad idea, considering how many times you will have a price rally in a stock as it fluctuates.

I classify the BBB System as having a strong trend definition. It has only two states: the trend is moving up, or it is moving down; no in-between, no moving sideways definition. So it's perfectly logical that the trading script will want to enter trades only when the trend is turning up and stay in position until the trend reverses.

What is wrong with that strategy? Well, from the start, it was designed to underperform, and it did. Not that it broke down with time, but it never had a chance to succeed in the first place. Based on my test, it had a 65% chance of winning its bets, and yet it performed miserably. The primary reason was the low level of risk. The BBB System made a $5k bet on the turning up of the spread from a negative value, then waited for the turn down from a positive level to exit where it took its profit or loss. This said that about 5% of its available capital would be used at any one time! The second reason it failed to generate any significant profits was that it made too few trades, even if it made over 1,100 trades over its 25-year test. You had both: monetary underexposure and time or market underexposure.

In payoff matrix notation, with H being the Buy & Hold, a napkin calculation would give:

Σ(0.05*0.50*H.*ΔP) = Σ(0.025*H.*ΔP) = 2.5%*Σ(H.*ΔP)

just 2.5% of the Buy & Hold as a long-term expectation for this strategy due to its 5% monetary exposure and its close to 50% time exposure.

Such a combination under the 24.9-year simulation on the 30 DOW stocks produced the following:

BBB System (original 2003 version) 

BBB original version

(click to enlarge)

What the above table resumes is a total waste of time and resources. The last column shows the ending cash value in the account, independent of the still 16 opened positions. It ends the test with less than a 3% market exposure. How could it ever have aspired to any significant CAGR (compounded annual growth rate) over the 25-year testing period?

The BBB strategy was ill-designed from the start, and no one should be surprised by the low performance level. Yet, this strategy was praised in Stocks & Commodities magazine at the time, even if the author might not have really completed his homework. At least, the above simulation says: don't even bother with this one.

There might have been an alternative to this strategy, and that would have been to apply the trading script on a portfolio watch list of, say, 100 selected stocks and take the signaled trades on the group (letting it absorb all the capital it needed). But I have not previously explored that alternative, and I don't expect that it will generate much either. What I should find if I did would be about the same as the above test. The only place where it could do something might be on a small stake, like $100k total, where it would pick here and there some trades and show an ending profit. But still not enough to even beat the Buy & Hold strategy. And by adding more capital, the situation would only get worse. Meaning that as you added to the initial capital, you would do worse and worse than the Buy & Hold. It would, therefore, miss on all counts. I have little interest in pursuing that avenue of research.

My Improved Version: Mod 01

My modifications to the BBB System program were in the trading logic and data smoothing areas, which would imply almost all over the place. After smoothing the data for the various indicators used, changing their nature a bit, and adding some, I installed new trading logic procedures to allow multiple positions in order to better use available capital. An exit of all positions was used as a means to close still-opened positions. This resulted in trade clusters after entry signals and a unique exit for all taken trades. Thereby, you pumped money into the market, waited, took your profit or loss on the full exit, and then repeated the process. It's a simplified but quite accurate representation of what was going on. In essence, a simple trading system. Even if mathematically sophisticated and complicated to structure. It was relatively easy to implement.

These modifications were designed some 3 years ago, with now 3 years of OOS data and also 16 years of data previously not seen by this Mod 01 strategy. To add a little spice, all the stocks used in this test have not been seen by this trading script either. This alone represents quite a challenge to any trading script.

The same testing conditions were applied as in the Livermore Market Key (LMK) case; initial capital: $100k for each stock with a $5k bet size.

After performing this test, I was kind of a little discouraged. Not that the test was bad. On the contrary, it was very, very good. My feeling then was: how will I be able to explain what it does or its obtained results? As the test progressed, I could see the numbers going up and down, but mostly up.

There were implications in this Mod 01 design that went beyond the trading strategy itself. The long-term perspective (25 years) was changing my perception of the problem. Only two other of my programs (LMK and partially ADD3) have gone through a 25-year test before. This is the first time that BBB Mod 01 has seen such a long trading interval with the DOW dataset. So, here is how it came out. I too, have to accept what the program did. After all, it is just a program.

BBB Modified Version 01 ($5k bet size)

BBB Mod 01 $5k case

(click to enlarge)

The above results are impressive indeed, about 5 times better than the LMK 0.06 presented in my previous note. Not a 5% or 50% improvement, but a 500% higher performance level over the long term. I find it remarkable, even if I am alone in seeing the finesse that went into the design of its trading procedures.

Nonetheless, there are still correctable weaknesses, even in my design. Now that I have seen how it behaved over those 25 years, I can understand better what could be done to improve performance and know before implementing some of those modifications what the expected outcome might be.

For instance, the strategy ends up mostly in cash (over 90%+ in cash). The reason is simple, as the portfolio grows, the $5k bets represent less and less as a percentage of total equity. As if less and less of the available resources are invested as time progresses. It represents a major avenue to improve performance further. A side benefit was the gradual reduction in portfolio volatility since most of the equity ended up in cash.

BBB Mod 01 is a trading strategy that welcomes computerized assistance. Look at the number of trades performed over the testing period, and you might appreciate that clustering is done at two levels and, at times, with some leveraging. However, also with time, the leveraging process totally disappears due to the excessive build-up in cash reserves.

The $100 Bet Scenario

After the Livermore Market Key (version 0.06) tests, I had to do the same with the BBB Mod 01 strategy and have it trade with $100 bets. I already knew the answer since the trading strategy was scalable. It would have to be about 50 times less than the $5k bet-size case, as shown above. Once you say things like that, you have to make the test just to show that it is the case. So, here are the results:

BBB Modified Version 01 ($100 bet size)

BBB Mod 01 $100 case

(click to enlarge)

Just playing $100 bets as time progresses and accepting trade clustering with an all-out exit, one could achieve such results over the long term. Not over a few weeks or months, but over a 25-year period. Not just on one stock, but on a portfolio of 30 stocks with some of which not necessarily your best choice. You were changing the excitement of day trading to let your computer program do all the work.

As in the LMK case, one could make an estimate for the $1,000 bet size scenario. Using the payoff matrix notation, as in the previous note, this could be expressed as:

Σ(H(Mod01_5000).*ΔP) ≈ Σ(5*H(Mod01_1000).*ΔP) ≈ Σ(50*H(Mod01_100).*ΔP)

Therefore, multiplying the $100 case by 10 or dividing the $5k case by 5 would give a decent estimate of the $1,000 bet size case. A ballpark figure would be about $1.08B, with most of it ending in cash (90%+) as in the other two presented cases. Again, once you say something like that, you have to check. It does take time to test and record everything needed, including snapshots of each generated chart. Here are the results:

BBB Modified Version 01 ($1,000 bet size)

BBB Mod 01 ($1,000 bet size case)

(click to enlarge)

I think the above tables are sufficient to make the point on scalability for this BBB Mod 01 trading strategy. Compare all three tables and use the one you prefer based on your accessible capital or your usual trade size. It's up to the trader to select his/her preferred bet size. And as can be seen, the bet size can have a major impact on a trading strategy.

As a side note from these tests, and using a fixed amount trade size, one could extrapolate and extend Q*P = K to:

Σ(2*H(TS_K).*ΔP) ≈ Σ(H(TS_2K).*ΔP)

which translates to if you put twice as much money on each trade for a particular trading strategy, you should expect twice the results. Therefore, this says that if you want to play a $10k scenario, you should be ready to provide at least twice as much capital as in the $5k scenario to execute.

Strategy Evaluation

The same trading explanations apply to all 3 BBB Mod 01 tables. The major difference is in the bet size. Using the payoff matrix notation, we have:

Σ(H(Mod01_5000).*ΔP) ≈ Σ(5*H(Mod01_1000).*ΔP) ≈ Σ(50*H(Mod01_100).*ΔP)

where the approximation holds. Therefore, someone wanting to play the $200 bet size scenario should get about double the $100 bet size results. The same holds for someone wishing to trade the $10k size. Note that the $5k bet is just 100 shares of a $50 stock, certainly not something that will rock the DOW.

What makes this trading strategy outstanding? The 2 charts below illustrate what is happening (the examples are on BA (Boeing) from the $1k scenario):

BA (Boeing) Mod 01 ($1,000 bet size - last 11 months)

BA Mod01 $1,000 bet size last 11 months

(click to enlarge)

BA (Boeing) Mod 01 ($1,000 bet size -Aug. 2009 to May 2010)

BA Mod 01 ($1,000 bet size - Aug 2009 - May 2010)

(click to enlarge) 

Trades are taken in clusters as a way to scale in a position. Some of the trades are the result of a random function (some 2-3%), while the others are there as a method to average in a bigger position than the $1k bet. At some point, all shares are sold (see red down arrow). As seen on the charts, you accumulate shares (most on the way up), and then you sell them all for either a profit or a loss. The first chart shows the case where a whole trade cluster is sold at a profit. This process is repeated all the time on all the stocks over the full trading interval. Each time hopefully adding cash to the trading account. The second chart shows the same trading behavior in a prior time zone. You don't win all the trades, see the % won column in the above 3 tables, but you do win on most of the trades (in the Mod 01 case, more than 80% of trades generated profits, just a little bit more than in LMK 0.06).

The 2-3% of trades that are the result of a random function also benefit from the 80% of profitable trades. It's like an added small bonus since, on average, about 80% of those random trades will generate a profit. Does this say: here is another improvement area?

The strategy was designed to accumulate shares while the trend was defined as up, and then, on a sign of weakness in the price trend (like it stopped going up), to sell all shares on hand. This is exactly what the above two charts show. You scooped your allocatable trades over a period of time, waited some time, and then sold everything on hand no matter at what price those shares were acquired with a net result of making a profit or a loss. Apparently, this trading procedure was more than successful.

Earlier, I said that I was kind of discouraged when I saw the first test results based on the $5k scenario. The numbers were, like too good, but that is what came out of the trading script applied to the 30 stocks of the DOW. The big difference here was that instead of continuously accumulating shares for the long term (as used in the LMK 0.06 script), where I used some of those accumulating techniques, Mod 01 was selling all its accumulated shares from time to time. This had the effect of pumping cash into the trading account to the point that it became hard to use all the cash reserves. And thereby incrementally decreasing the strategy's potential.

My Analysis of BBB Mod 01

Unorthodox trading methods can turn out to have value. Of the two tested trading strategies thus far (LMK and BBB on 25-year tests), the palm definitely goes to BBB Mod 01. Its test results were really impressive.

The trade clustering enabled averaging into position in order to have more skin in the game and to spread the whole position over time (see the charts above). It took time to get into a position cluster, and it took some time before getting out. This had for side-effect to indirectly contribute to its success.

Imagine putting on your machine a strategy like BBB Mod 01 and providing the $100 bets as required by the program to find yourself with a trading account in the $100M region after 25 years... with a lot of cash to spare along the way since it ends mostly in cash. Now, look at the $5k scenario...

This is a program on a machine based on end-of-day (EOD) data that issues next-day market orders at the open. For those accustomed to the Wealth-Lab code, any buy market order would be written as: " BuyAtMarket( Bar + 1, ' ' )", which translates to, buy tomorrow according to your bet size at the open. This program could be operated from anywhere on the planet and take only a few minutes a day. There is not even a need to be accurate on the entry or the exit. You could take the whole day to execute all the orders, even skip a day or two, and it would not make much of a difference on the bottom line where it counts.

So, my 10-best list currently stands with, in first place, BBB Mod 01, in second place, ADD3, and as a distant third, LMK (version 0.06). Of note, LMK was developed in early June 2011, while Mod 01 was in May 2011 and therefore predates LMK.

I can see many ways to improve on both of these strategies. It would appear from these tests that it's relatively easy to design trading strategies that can not only last but prosper over 25-year simulations. At present, I would say: my count is 2 on 2.

It might be a good time to mention opportunity costs, even if there are only 2 strategies that have been presented. I'll look at the $5k bet size scenarios for both strategies. First, the stock selection is the same in both cases. Each strategy implements its trading procedures differently but on the same price series and over the same duration. It's the manner in which each one proceeded to make their trading decisions over time that made the difference.

With only 2 strategies to choose from, one might say it's a 50/50 bet. Well, not exactly. It's more like no competition at all. If you pick BBB Mod 01, you could end up with $4B more of added cash in your trading account compared to LMK 0.06. This makes it a one-choice choice: you pick your best performer. As said, both strategies start on the same footing: the same dataset over the same time interval using the same initial capital. By not picking BBB Mod 01, you would leave $4B on the table as opportunity costs from this single strategic decision.

Σ(H(Mod01_5000).*ΔP) – Σ(H(LMK_V06_5000).*ΔP) ≈ $4B

This is to put some emphasis on the importance of designing the best trading strategy you can since, in the end, it can really matter, and a lot. Not designing BBB Mod 01, you would be left with your then current best choice, which would be LMK 0.06. And since you would not know anything about BBB Mod 01, you could be satisfied with LMK 0.06 when, in reality, the pursuit of BBB Mod 01 had considerable value. And since Mod 01 was developed first, some of its procedures would have been carried forward to LMK 0.06, where the change in trading philosophy was not sufficient to overcome Mod 01. There are some attributes or attitudes you don't like in Mod 01, simple: correct them and make them adapt to your own style of trading. But for sure, don't just throw it away.

My second point would be that your bet size also matters greatly. Look at the above tables to see the difference between the $100, $1,000, and $5,000 bet size scenarios. This is why I advocate that one should find as much capital as he or she can to start with. Both strategies can easily be adapted to any cash inflow as time progresses. IMHO, I find that it's just preferable to start strong and early, you're playing a CAGR game after all.

Other Considerations

An automated trading strategy in its most basic form could be expressed as: ...if this, then buy, and ...if that, then sell. It is a series of trading decisions to be made to manage a portfolio over the long term. Its performance, measured in CAGR, has a direct impact on your doubling time. And the most important doubling time of all is the next one to be achieved. It alone represents the same as what you would have achieved from the very beginning of your endeavor up to now (you go from 4 to 8 times your portfolio, and then after reaching 8, from 8 to 16, ...). It is the trader/speculator/investor's responsibility to make this doubling time as short as he/she possibly can. To which I would add with as little effort as possible.

In a simplified way, this could be expressed as Σ(H.*D.*ΔP), where the change in inventory is transferred to a decision matrix D. It is this decision matrix that controls how and why the inventory will change and in what direction.

The BBB Mod 01 trading script has some hidden features. One of which, for lack of a better word, is kind of a trade control knob. It was designed to regulate market participation by controlling the number of trades taken at any one time. By itself, it is already a means to improve Mod 01's performance level. A kind of trade accelerator/decelerator. At the time, my intent was to also design a supervisor function to adjust the trade control knob but never took the time to do it. Now might be a good time. Yet, another hidden trait was the ability to amplify, to scale up or down the trade size itself, where more emphasis would be applied when in an uptrend. This feature would have much merit now that it is known that Mod 01 generates a lot of cash reserves.

The problem with a trading script is that before any kind of backtest you want to make, you are freezing its code for the duration of the test (25 years). It becomes: that's the code, and that's the outcome. You make a backtest, and within minutes or hours, you have your answer on trading procedures that would have had to be implemented 25 years prior (that's 6,500 trading days ago). Your computer will do all the backtests you want without ever complaining. But when going live, the problem changes. You can use your backtests to give you guidelines to follow and set your trading procedures in stone or have them adapt to circumstances.

But first of all, you will have to make a strategic choice: which trading strategy will you implement? From your arsenal of possible choices, which one will you prefer going forward? It's sometimes a tough choice and at times a no contest as in these two trading strategies. The other thing is that your one live-chosen trading script will have to face the future: 25 years of unpredictable data series. That is a long time of waiting and supervising a trading script just in case something goes wrong.

The Mod 01 program was designed over 3 years ago and was tested only on a few stocks over the then preceding 6 years of price data. The number of trade control knobs appears to have been tested even less, but I found traces of it in a program prior to Mod 01. It must have been one of those features that I carried forward.

But this feature could be carried outside the program going forward, as well as the trade size amplifier. Two control knobs to manually regulate from the outside the kind of participation and exposure to the market one would want as time progresses. You would be able, from the outside, to request attitude changes in the trading philosophy: increase or decrease the number of trades going forward or scale up or down the trade size at will, depending on your perception of market conditions, and you would still end up winning the game.

The Mod 01 program is there just as a proof of concept. If the trend definition used had any value, then it would easily show up on a backtest. How would it show its value? Very simple, it would generate profits over the long term. This means that Mod 01's definition of a trend is much better than in the original version of the BBB System since there, based on a reasonable backtest, it failed to generate any worthwhile profits. Also, the trading procedures used must have had a major impact since even a trend definition is not enough to achieve those performance levels.

When you do a 25-year portfolio level backtest (say 30+ stocks), using your favorite trading strategy over an unselected dataset, you can be sure that such a test will give you more than some indication as to the worthiness of your trading ideas or concepts regarding how profitable your strategy could have been. And if you can't, using your strategy, even outperform the Buy & Hold over the 25-year period, then what should you do? I know I would suggest that you keep on searching.

The above presentation is intended to show avenues to explore. Sometimes, thinking differently than "acceptable norms" can lead to looking at a problem from a different perspective. It is not by doing the same thing as everybody else that you will obtain better results than everybody else.

It's by pushing the limits to go just a little further than what you would have thought you could. You have the advantage of being able to stand on the shoulders of those that preceded you. The BBB Mod 01 script shows a lot of promise, and I can see a dozen places where I could add trading procedures and controls made to improve its overall performance. And I think: so could you.

This is why I do not give away my trading scripts, even if, technically, on this one, I just did. What I want those interested in such things to do is simply do their homework and redesign from scratch the ideas and concepts presented here. This way, you will not only understand what you are doing, but you will also understand why, and this will give you the confidence you need to proceed. Also, the solution you will find will probably be unique and adapted to your vision of the game. In reality, in the end, there is only one person you need to convince, and that is you.

I hope that all of this "stuff" is useful to some in some way. At the very least, it was for me, just by formally expressing it.

Created... June 8, 2014,    © Guy R. Fleury. All rights reserved.