January  22nd, 2016

A Stock Trading Strategy Experiment II

In my last article: A Stock Trading Strategy Experiment, I said it was time to do the portfolio level test. That I would take the same trading script, or slightly improved, that generated ABT's results and then use it on the other 9 candidates in the data set. The same stock list as tested in Delayed Gratification. This way I would also be able to make some strategy comparisons.

Naturally, in this portfolio test, ABT was a given. It was the test candidate used to debug the trading script. So, I already know the answer to that one. If anything, the strategy might be curve fitted to its singular price signature.

Each stock has it own signature and therefore each should perform differently. How else could it be! Still, there are some common, general attributes that can be examined, the what can happen to each individual stock over the entire trading/holding interval. A kind of behavioral averaging.

So, let's start. The output of the 10-stock portfolio test resulted in the following: 

   #1  Portfolio Summary (10 stocks - 20 years)
Portfolio Summary

 (click chart to enlarge)

At first glance, all 10 stocks performed reasonably well, see bottom line. All achieving a 20%+ CAGR over the 20-year time span. This trading script was developed only using ABT as test subject, and yet, it worked as well on the other 9 stocks, and in some cases, even did better. Actually, 7 of the stocks performed better than ABT.

I would say the results were pretty good considering.

The allocated capital for each of the stocks was set at $200k, same as ABT. That is 10 times less capital than in Delayed Gratification.

Since my programs are scalable, it would imply that this experiment did even better than the program used for the Delayed Gratification test, at least, it shows promise and I will definitely investigate further. The MACDv02 program achieved a higher average portfolio CAGR (25.97% compounded return compared to 24.60%).

MACDv02 used less code (< 500 lines) compared to around 2,900 for DEVX8 in its latest iteration. However, I don't consider that the length, or the complexity, of a program matter. It has little bearing on its output. Who cares how many lines of code or how complex a program may be? It is not what will put the money in the bank account.

It is the trading method that counts: Σ(H.*ΔP), the H in the portfolio payoff matrix.

In payoff matrix notation, I get: 10 * Σ(H(MACDv02).*ΔP) > Σ(H(DEVX8).*ΔP) meaning that had they used the same initial capital, MACDv02 would come out ahead.

Another important question would be: which performed best within one's acceptable limits, constraints, and preferences? Was MACDv02 an acceptable and reasonable compromise under uncertainty?

I will first try to describe what I saw in this test. The program is quite different, if compared to DEVX8, the one used in Delayed Gratification. However, the underlying philosophy is the same: accumulate shares for the long term and trade over the process. This is the mantra, the generalized theme in my trading strategies.

So from the start, my strategies continuously try to buy shares for the long term. If a trading rule triggers a buy order, and if there is money or collateral in the account, a purchase can take place. The primary intention is to hold on for the duration. That is how you can accumulate shares, you hold on to them. The strategy's preferred holding period is therefore to hold forever, if it can.

To greatly alleviate the problem of potential bankruptcies, the first line of code in the trading decision process is:

if PriceClose(Bar) > InitPrice then
  { you may buy at market tomorrow if you can }
else
  { forget it }

meaning that shares are accumulated only to the upside. This simple line of code has more value than a stop-loss. And since I'm looking for a positive long term return, I think the first thing a stock should do is stay afloat, above the price of my first trade, and from there prosper. If it doesn't, somewhere I did not do my research for a potential portfolio candidate properly.

Looking at the above portfolio summary, some 11,136 positions were taken over the 20-year time span. Each taken position had a $10k trade unit, and a $400 stop-loss (-4%). The initial 10-stock portfolio started with $2M ($200k each). The strategy did put $111.36M on the table over the course of 20 years, spreading its bets $10k at a time. And, ended up with $197.47M in profits.

A(t) = A(0) + Σ(H(MACDv02).*ΔP), or in numbers: A(T) = $2M + $197.47M.

This resulted in a 25.97% portfolio CAGR, with an average doubling time of about 3 years. Not bad at all. Using a 10-stock portfolio, averages are easy, simply divide by 10 the result totals, except for the trading interval, the price, the percent of winning trades, and the CAGR. You would like to compare the results with the Delayed Gratification scenario, then multiply by 10 wherever it is applicable. Note this would also raise initial capital to $20M. Your budget is smaller, then divide by 10 and go for the $1k trade unit.

What happened during those 20 years?

The program was rolling upward its stock inventory, that simple. Waiting until any position either reached its stop-loss or its stop-profit level. The stop-loss was fix as given before while the stop-profit was free to deliver more, if it could. The stop-loss setting was arbitrarily chosen, I did not even do a test to see if another figure would have given better results. Maybe I should look into this as a possible improvement to bring to the strategy, if I come to find it worth the effort.

Since the stocks were selected for their long term prospects, all that was required was to monitor them and once in a while the program would apply its trading procedures. Not a time consuming task at all. All trades are market orders for the next day at the open. A few minutes by hand, a few seconds by computer, and the job is done for the day.

Let's look closer at ABT again. 

   #2  ABT Chart
ABT Chart

 (click chart to enlarge)

The first thing to notice is that I made a few improvements over the previous program version resulting in close to 50% higher profits. I'm not against that. 

   #3  ABT Equity Curve
ABT Equity Curve

 (click chart to enlarge)

The above chart depicts the equity curve. The position's profit % distribution histogram shows the number of trades in the return space. For instance, 188 trades have for profit between 100% and 120%, and 193 positions have over 320%. 

   #4  ABT Performance Report
ABT performance report

 (click chart to enlarge)

Chart #4 gives the performance summary report. It is quite explicit, the usual kind of report produced by our simulation programs.

What are the elements that are noteworthy in the above 3 pictures?

Chart #2 says a $200k Buy & Hold on ABT with a 10.85% CAGR over 19.94 years would have produced: $200,000 * (1 + 0.1085)^(19.94) = $1,559,767. On the other hand, placing 1,079 equal bets of $10k each spread out over the same 19.94 years would have generated: $15,249,656. Almost 10 times more. At least enough to pay for the extra effort, even if it was not much since a machine was doing all the work. You started with a Buy & Hold mentality. Ready to put $200k on the table (20 trading units), and also ready to accept the general long term average market expectation (about 10%).

By having the same intention which was to also hold for the long term, you opted to slowing place $10k bet after $10k bet and when you had some profits, cashed in some to redeploy later on. But all the while gradually buying more shares than you sold. You were slowly building up an inventory to the tune that after 19.94 years you had 372,803 shares on hand valued at some $15,113,434 (see chart #2).

Chart #2 shows the general trade behavior. Trade units are simply continuously recycled forming a positive feedback loop. The notion of risk is altered here. If your intention is to hold some 20 years on your shares, daily price variations become a minor consideration, just something you look at but don't intend to do anything about, unless.

Looking at chart #3, the profit curve speaks by itself. At almost anytime during those 20 years, one could quit the game and be in the green. There are always drawdowns especially if your intention is to hold for the duration. But daily price variations as said before are a minor consideration when your linear perspective is counted in years.

The first $10k bet was executed above the initial price, and if the price went lower, the buying stopped due to the above mentioned trading rule. You were going slow, requesting the stock price to prove itself worthy of more bets by having its price go up. In this sense, you were ready to reward those stocks that rewarded you. You go for the survival of the fittest, the strongest stocks, the best performers. And they need to prove they can deliver all the way to destination, which is not tomorrow, but in some 20+ years.

Is it wise to be that slow? Well, looking at the story on chart #2, #3, and #4, with the overall view in chart #1, it might just be.

Each wave of buying and selling reinforces the trading account. You end up accumulating shares and accumulating cash reserves. You are slowly building up the portfolio over the years. It is not an instant gratification on every bet you make that you are looking for, but more the satisfaction that the majority of your bets could be profitable as show in chart #4.

Maybe the real question might be: will you accept the ups and downs of the market in exchange for better long term results? Will you accept to play chicken like, small bets at a time, always ready to take a profit because you don't know what will come next? But still have some money on the table, because you have realized a long time ago, that no money on the table is synonymous to a no profit scenario, and a no loss as well for that matter. It is a game where if you don't participate, you don't win, just as you don't lose.

The portfolio summary report giving in chart #1 is the story. The program, MACDv02 was applied to 10 stocks. All were profitable. You might not have been able to predict which one would produce the most or the least, but that was not the object of the game. Your interest was that one number in the far right bottom corner: the total result after having played the stock market game for 5,184 trading days. That was the prize, not the trade here or there that you won or lost.

I found all the numbers in chart #4 reasonable and acceptable for a long term trading system. For sure, it is not a day trading system, nor is it an HFT one. Its average holding period is a little over 8 years (2,052.57 trading days). So, it is not what you would call a swing trading system either, even if it is.

Here are the other price charts with their respective stories printed in blue by the program. 

   #5  ALL Chart
ALL Chart

 (click chart to enlarge) 

   #6  BIIB Chart
BIIB Chart

(click chart to enlarge) 

   #7  CVS Chart
CVS Chart

 (click chart to enlarge)

   #8  FDX Chart
FDX Chart

(click chart to enlarge)

   #9  GD Chart
GD Chart

(click chart to enlarge)

   #10  GILD Chart
GILD Chart

(click chart to enlarge) 

   #11  HD Chart
HD Chart

(click chart to enlarge) 

   #12  LMT Chart
LMT Chart

(click chart to enlarge) 

   #13  LOW Chart
LOW Chart

(click chart to enlarge)

I found this test had a surprise for me. I was expecting something less performing than DEVX8, my current preferred trading strategy, but MACDv02 surpassed it with flying colors. I'm not ready to change my preferences, but you can be assured that MACDv02 has now been promoted to the top of the list. I will certainly investigate more. I already have some improvements that I could bring to the trading procedures which could push performance higher, not only on one stock as ABT serving as test candidate, but for the group as a whole. MACDv02 has become a fascinating strategy in its own right showing much promise.

I would end with a question: What is the meaning of your largest future drawdown if you don't intend to sell?

There is a change in trading philosophy here. I hope you can see it, even more, that you can use it to your advantage. It is the methodology that in the end makes all the difference, and one should always keep an eye on the final destination in such a game. You will find that at the finish line, the people you will meet are most probably long term shareholders.


Created... January 22nd, 2016 © Guy R. Fleury. All rights reserved. 

Alpha Project