June 3rd, 2014

Bizarre Trading Behaviors

About a week or so ago I started doing the inventory of my trading strategies, a project that has been delayed for over a year due mostly to procrastination and lack of time. It's a big project. I'll have to go through over 200 trading strategies of mine and document what each trading procedure does. Then determine their relative importance and the why they contributed to overall performance. Hopefully, this should translate into designing even better trading scripts or at least selecting the best of the crop.

The underlying theme in my trading methodology is to accumulate shares for the long term while at the same time trade over the process. I often use existing trading strategies and modified them to suit my needs. It's like fixing, remodeling, and adding new features or extensions.

I want to isolate the best behaved trading procedures found in previous strategy designs that have shown added value under simulated test conditions. All my trading strategies used different means and trading methods to reach their objectives. The next step would then be to design an enhanced trading script comprising a best feature set. It would still have to operate over the long haul (20+ years) and at the portfolio level.

The first selected strategy was one I recently discussed in a LinkedIn forum where I participate. It is based on the Livermore Market Key. This strategy was published in the early 1940's. It was also featured in my Livermore Challenge in June 2011 (see the simulations menu area). Based on the tests of the original version of the Livermore Market Key (LMK) there was not much to be expected from that strategy. It barely provided a positive return over the 6 years simulation performed on 43 preselected stocks. See the Livermore Challenge for more details.

To recall, the challenge was issued June 1st 2011, and was documented live in a forum of the old Wealth-Lab legacy site. The challenge was canceled within a few hours after I presented some of my own improvements which showed outstanding performance results.

Over the next 3 days, other tests were done to show that performance could still be improved upon. The strategy worked at the portfolio level even if the entire data set was changed by selecting two other different data sets of 43 stocks each: data set 2 and data set 3.

To note, this trading script was written a few days short of 3 years ago. Therefore, any testing now will have about 3 years of out of sample data (OOS). It is like having the trading script see 3 years of its future. Changing the portfolio stock selection entirely would make the 6 year trading interval completely OOS data.

To show that the "original" Livermore Market Key trading script did not improve over time, it was sufficient to run the program again and see the results. I opted to use AXP (part of the DJIA) which I had not tested before and which is representative of its era. Using the original LMK program on the AXP price data series produced the following:

   Livermore Market Key (Original Version) Last 6 years
Livermore Original Script May 24th 2014

 

The above chart shows the last 11 months of a 6 year simulation (1,500 trading days) with the last 3 years being OOS (some 750 trading days). There is no surprise here. Preliminary observations would be that the original version did what was expected which was nothing much (again see the challenge).

You had a trading strategy completely defined by its trend definitions. A rigid, yet flexible, trend definition structure which should have given a definite positive edge to the trading methodology. But none of that could be seen from the test results. On the contrary, all one could conclude was that there was nothing there, absolutely nothing. What ever Livermore's legendary reputation was, for sure, he could not have traded according to "his" 1940's defined and published methodology. It could at most serve as a possible explanation for what he did. No where can you find any data that he did any kind of simulations based on his trading methods. All I see him saying is: "I think that the market works this way", but this is said without providing proof or any supporting facts.

Note also that from a candidate like AXP that outperformed the averages, the original LMK script was not even able to generate a profit... It should be easy to understand why or at least give plausible explanations for its lack of performance.

The Modified Versions

One of the modified versions of the program which was made to incorporate a stock accumulation process proved to be more that worthwhile as can be seen in the chart below:

   Livermore Market Key:  Last 6 years (modified version 0.06)
Livermore Improved Version May 25 2014


So what are the differences in these two trading strategies? First, the improved version made more trades (479 compared to 79). It also accumulated shares over the trading interval, at each swing buying a little more than it was selling. The funny thing however is the way it treated stop losses. When you evaluate their contribution to the whole, you find that it is minimal. Technically bringing nothing performance wise to the mix. However, removing them will really deteriorate overall performance. This is counterintuitive. Removing something of no consequence should not have changed the answer by much. And yet, as much as ¾ of the cumulative profits would just disappear if the stops were removed. After investigation, you realize that the stops were not there for protection but to return cash to the trading account and thereby enabling further purchases.

But there are more peculiar things that resulted from the modifications. The first thing of importance is its long term view of things. Being into an accumulative mode, the system would tend to accumulate shares for the long term, in essence, trying to have some of its shares on a Buy & Hold strategy. To enable this accumulative process, the strategy used over 90% random entries, again not what could be called an orthodox trading procedure. Even if you had a valid entry signal, a trade had a higher probability of not being taken due to the outcome of the random function. You removed this random entry algorithm and performance would fall drastically. The funny thing is that if you tried to put all entries subject to the random function algorithm, performance would again drop significantly. As if there was a kind of synergy in all this. It was as if the about 10% of trades that responded to the trading logic was opening the door for the randomly generated trades if and only if their number came up that day.

From the above AXP 6 years test, one would conclude that the modifications brought to the original LMK trading script were more than worthwhile. On this relatively short duration, it managed to produce interesting results. Even with 3 years of OOS data, it did not break down but continued to thrive.

The improved version did perform better, but as a trading script designer, I wanted to show more. This represented a problem. How to show that the trading procedures of this strategy were good for more than a one horse pony? So I opted to expand the test.

My simulations in the past have usually been done using 3 different preset data sets of 43 stocks each (see the simulation menu for some of these tests). But now, it was time to make it more difficult. If the trading strategy had some merit, it would have to pass the following test.

First, a change of data set and then extend the trading interval to about 25 years. This would mean that the trading strategy would not have seen any of the data that was used in its design. Therefore, no curve fitting to something that the trading strategy had never seen. No esoteric considerations except a trading script against all odds that will have to adapt to new data. Not only that, but it would have to survive some 19 years, if not 25 years, of OOS data.

Needing to have the simulation be worthwhile, I opted to use the 30 stocks of the DJIA. I already knew that AXP performed well on the 6 years test, just as I knew that the trading script performed well in the simulations 3 years ago on other data sets. So the question should be: will it be better over the now 25 years backtest? But most importantly, would this "improved" trading strategy do its thing over the 30 stocks comprising the Dow Jones Industrial Average?

The Dow Test

The first step was to perform the test on the original LMK trading script. Whatever pretensions it might have, they would be dispelled or acknowledged by this 25 years simulation. The 30 DJIA stocks are sufficiently representative of the market to give the original LMK script every opportunity to show its merits. Now was the time for it to shine if it could.

The LMK original trading script over its 25 year simulation produced the following:

   Livermore Market Key (original version) 
LMK original version $5000 bets


Not what could be classified as stellar performance levels. It did not even manage to stay above water. Some 24.9 years wasted in the pursuit of nothingness. For those promoting the Livermore Market Key system or providing courses on its trading methods, I think they should perform this kind of test before claiming the unsubstantiated virtues of the original LMK trading methods. IMHO, they should consider linking to this web page to show that at least one person has performed a long term stock test on the original LMK trading strategy.

My appraisal of the original LMK trading strategy is that there is nothing there. And being based on trend definitions, either trend following did not work or the definition were no better than triggering random trades. On this I opt for the trend definitions themselves to be worthless. But you also have to add that some of the trading procedures used were not to this script's advantage. As if the strategy was shouting itself in the foot. If you design your trading strategy with some built-in flaws, should you be surprised if it does fail?

The LMK Modified Version 0.06

I knew even before doing the test that performance would be there. I did not know by how much, nor did I know how each individual stock would perform using the same trading strategy for close to 25 years. But if there was a test to be done, this was the one. If it failed, then it would have shown that some trading strategies, even if we think they are good, do break down on unseen data (something expected by almost everyone). On the back end, there was 3 years of OOS data, not just a few weeks or months, but 3 years. While on the front end, there was another 16 years of OOS data for each of the 30 stocks. This trading script was designed some 3 years ago and tested over the prior 6 years. But this time, all the data would be different from any of the previous tests.

The simulation was performed under the same testing conditions as for the original version: $5,000 bets with an initial capital of $100k for each stock; this way both strategies can be easily compared. It produced what follows:

   Livermore Market Key (improved version 0.06) May 25 2014
Livermore Market Key (improved version) May 25 2014


The 24.9 year simulation time span with most price series being for 6,450+ trading days (24.8 years) were sufficient to show relevance. AXP had not been part of any of my past back tests, and certainly not on a 24.8 year test. All I did was run the script once on those 30 DOW stocks and record the results, what ever they were. I'm putting emphasis on all this because too often I hear so much criticism that there seems to be absolutely no way to satisfy some. If you do a 6 year test, they want a 20 year test. If you respond and do a 20 year test, they come back and want a 50 year test. Well this is it and it is sufficient to make my points.

What the above table shows is that out of the 59,507 trades, 47,501 of those trades were showing some profit; an amazing 79.8% of all trades. This without even really trying. The numbers just came out that way. And 59,507 trades over the period is more than sufficient to show relevance. Each stock had its own path over the entire trading interval. Only AXP had seen the program before, and even there, for only 3 of its prior 6 year test. Now, it did perform better, going from 5.5M on its 6 year test to 143.5M on this 24.8 year test. This showed that the "improved" trading strategy did not break down on the back end OOS data, nor did it break down for its 16 years of prior test data. I find this quite remarkable and should put aside many of the silly notions expressed by some strategy developers. Things like: 'all trading strategies break down in time', well NO, not all of them. People should do their homework.

To show scalability, I had to make a test using the same trading script, but this time with $1,000 bets. The table below shows the results:

   LMK Modified Version 0.06 (with $1,000 bets)
LMK modified version 0.06 with $1,000 bets


If you wanted more, you simply increase the bet size. This can easily be expressed using the payoff matrix notation:

Σ(H(V06_5000).*ΔP) ≈ Σ(5*H(V06_1000).*ΔP) ≈ Σ(50*H(V06_100).*ΔP)

LMK (Version 0.06) using $5,000 bets generated about 5 times more profits than if using $1,000 bets and 50 times better than if using $100 bets. This is easily understandable. However, note that for the $100 bet case, this was quite an inefficient use of capital. You needed at least 1,000 trades before using most of available capital. This meant that most of the time there was significant market under exposure. Nonetheless, it could be an excellent way to build a retirement account for anyone having limited means and that could invest in the market for the long haul (all a little bit at a time). The $100 bet scenario produced the following:

   LMK Modified Version 0.06 (with $100 bets)
LMK version 0.06 with $100 bets


This shows that even playing with $100 bets, someone could accumulate an interesting nest egg. The initial capital requirement is a lot higher than needed. This scenario should be a progressive type of play, like providing the capital on a needed basis rather than maintaining excessive reserves doing nothing. One could even consider his/her contribution to their 401(k), IRA or other retirement plans as a feasible long term solution. And based on the above tests, which showed scalability, playing $200 bets should produce about twice as much profits.

Strategy Evaluation

The question is: why did the original LMK trading script fail? There are many reasons. The first of which is that its trend definition structure was useless, it was slowly undermining taken positions by limiting their potential profits. Not only that but most of its shorts and stops also resulted in losses. In fact, only 2 stocks out of 30 generated a profit on their short positions over the 24.9 year simulation. Of the 2,916 shorts taken, only 599 generated a profit (20.86%). This was a big drag on performance. So the first thing to do to improve performance on that strategy was to stop shorting altogether.

The LMK version 0.06 is the result of just a few hours work. Just by providing the initial result for the June 2011 LMK challenge (see the challenge), I knew that just eliminating shorts would not be enough to make it a remarkable trading strategy. More had to be done, much more. So version 0.06 is more than just an improvement, its a redesign. There were so many modifications that it changed the program's very nature. Very little of the original program was left standing or used. As a consequence LMK version 0.06 should definitely be renamed to something else.

What this undertaking shows is that an old trading strategy (1940's) that was redesigned 3 years ago to simulate trading over a 6 years time interval also worked over the past 24.9 years on a data set which was not even part of the training data set. The strategy might very well succeed in outperforming for the next 25 years. At least it crossed its first hurdle, it was more than positive over the last 24.9 years.

Is the LMK version 0.06 the best that one can do? I don't think so. There are a lot of modifications and improvements that could be brought to this modified version 0.06 that would make it even more productive. For one thing, it does not manage long term accumulating profits very efficiently which is why that with time its CAGR slowly decreases. Say a stock accumulated 500,000 shares over the 24.9 years, a $1.00 move would increase available "paper profits" by $500k, which could then be used $5k at a time: an unproductive process. But nonetheless, as it stands in its present state, the $5,000 bet size scenario is nothing to sneeze at.

This was the first in the list to be re-analyzed out of the 200+ trading strategies I've worked on. There is a lot more work to do.

My Remarks

Usually, 25 year simulations are the apanage of academic papers. And most of the time it is to show that the most expected outcome for a stock trading strategy is to obtain about the same performance level as the long term market averages. Very few dare put on the table 25 years trading tests. IMHO, more should do so. That you have a trading strategy that spans a few years and is doing well at the portfolio level is commendable. But this stock market game is for the long term and is evaluated on a CAGR basis. It's all about compounding and reducing doubling times.

You won't know how far your trading strategy can go until you test it under long term trading conditions; the first of which is by doing backtests over 20 years or more. From a long term perspective, short term trades have a high degree of randomness as first cause for their volatility.

It does not really matter how you do it, what trading rules you use, just that you do it. For instance the above tests based on the modified version of the LMK trading strategy (version 0.06) behaved unexpectedly. Things like removing its stop loss procedures (which were insignificant to the overall performance having a lot less than a 1% impact) showed that it had a much greater consequence on long term portfolio results if removed. As said before this is kind of contrary to popular assumptions. You invite the execution of your stop losses simply because in the end they greatly improve overall results, not because they are stop losses but because they return cash to the account that can be redeployed. You also had random entry trades, a lot of them, which were taken with low probability even if there was a buy signal. But they needed a non-random buy signal trade to ignite their reluctant conditional participation not as volatility clusters but random cluster of trades.

Something that most traders don't see or do not want to consider is that as your portfolio grows, day trading becomes more and more difficult. Not that the opportunities are not there, they are more than plenty enough, but as the portfolio grows, so need the trade size. Otherwise, your overall performance will marginally decrease with time; which is the case in the LMK version 0.06.

There are so many ways to trade profitably over the long term. It is up to each one of us to determine how we will tackle the problem, what type of trades we want to make. I view the LMK version 0.06 as a rough gem that needs to be polished some more (with for instance better trading procedures to better use accumulating profits, or better positioning of trades since on that side it is not that great either).

What I also found interesting was to see the $100 bet scenario work out so well. A scenario where you could simply feed the strategy with its $100 bets as needed. A slow process but still good enough to build a decent retirement nest egg with little effort.

As I was explaining today, I consider my trading methods as Buffett like in nature except they are being operated at first with a much lesser stake at hand. Having a long term view of things, and knowing that additional capital can come your way, you simply do what you did before when you started. You either add more stocks to the mix which will use the added capital or increase bet sizes which will have the same effect; or use a mix of both.

Mr. Buffett already has solved this problem a long time ago. His problem was how to use the cash coming in generated by his holdings. He simply re-invested them by buying more stuff. I view what he did as: A(t) = A(0) + Σ(H(1 + r + g)^t.*ΔP) where g was his reinvestment policy and r the average market return. And I think this is how he outperformed the long term averages. The same applies to my trading methods, you get more cash along the way, you re-deploy it according to the methodology.

The advantage you can gain is in the trading over the stock accumulation process. It will be like taking profits on some shares on every swing of significance and making these profits available as reinforcement to your stock accumulation procedures. It has the ability to transform the above equation into: A(t) = A(0) + Σ(H(1 + r + g + T)^t.*ΔP) which technically will outperform Mr. Buffett percentage wise. By adding options to the mix, you can also collect on the time decay of options as if you were renting part or all of your stock inventory. The profits from your covered calls will also contribute to your overall performance and transform the above equation into: A(t) = A(0) + Σ(H(1 + r + g + T + CC)^t.*ΔP). Being a long term buyer (your accumulation side of the equation), you can also sell naked puts, this will be like buying stocks at a discount that you already wanted to hold for the long term in the first place and result in: A(t) = A(0) + Σ(H(1 + r + g + T + CC + NP)^t.*ΔP).

I view this as simplicity at its best, just an expression of some common sense. And that is what my web site tries to explain in detail. Everything you can do can contribute to your overall long term performance. All this will help you reduce the doubling time; your most important point of interest.


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

Alpha Project