January 21, 2024

Over the last few weeks, I spent a lot of time fixing links in my articles that were causing 404 errors (file not found messages). These URLs had been changed for some reason or another. I have not determined the cause. Most of the job is now done: links to and within the 455 articles have been repaired. Some links within PDF and HTML files remain. These will take longer since I have to return to the programs that created them to correct the links. But I will get to it and do the job.

I write this note to apologize for any inconvenience it might have caused anyone.

While fixing the link problem, I reread articles from when I started this website in 2011. Over the years, I chronicled programs I was working on in my quest to find better long-term stock trading strategies. Trying to respond to the following: if a trading strategy cannot last or remain profitable, what is it good for since it could ultimately make you lose money? The answer was to design trading strategies with that in mind. They first had to last and be profitable.

Articles advocated that an automated stock trading strategy should have a long-term vision of what it will do going forward. Its software routines should be amenable to survive most market conditions, especially the harshest ones, since, if the trading program could not, it could mean huge drawdowns and huge portfolio loss down the road, including losing all our invested capital. That is why you do simulations to show that your strategy would not have blown up using past market data over extended time intervals.

Whatever your trading strategy is programmed to do, you will have wasted your money and precious time if it blows up in 10, 20, or more years from now. And that time will be hard to recover. Restarting from scratch in 20 years with new capital is certainly not what you seek.

Doing what your program should have taken 40 years to do in 20 years might be a tall order. For example, a 20% CAGR over 40 years will require a 44% CAGR to give the same answer in 20 years. We can easily imagine the difficulty of achieving that compounded 44% in less than 20 years to recuperate the loss of the first 20 years. Saying “oops” after going bankrupt should not be part of your strategy design. Therefore, it might be wise to plan long-term for what might happen.

The link repair job forced me to revisit some of my favorite articles that I thought should have had more impact and helped others develop similar strategies. Also noteworthy is that in all those 455 articles, I did not have a single sentence or equation that I would have removed or replaced. Everything said was accurate and deserved to be there.

I especially reread the DEVX series of articles. It is a fascinating and unusual trading strategy that worked without technical indicators and had a quasi-random-like trade triggering mechanism (meaning having mostly (~95%) random entries and exits).

Unfortunately, the strategy is based on a now-dead programming language, and I have been unable to get market data after Yahoo stopped providing it in a WL-compatible format. It leaves the strategy dead in the waters with no way to make it run again except to rewrite it in another programming language, which I would first have to learn.

Nonetheless, a description of what the strategy did could help others redesign their own, and it would have the advantage of being their creation. Variations on this strategy went from DEVX1 to DEVX10. It was based on Myst's XDEV strategy (dated WL ~2002).

Still, after having modified the code so much, the original code was barely present except for its basic structural framework (a Do-While loop), which was common to many strategies of the same type.

I opted to give it a new name since it was behaving in a totally different manner while at the same time keeping a trace of its origin, the reason behind the name DEVX. The program had gone through a complete transformation from its original 200 lines of code to over 1200 lines. In those days, 200 lines of WL code was a rather large program.

The version I preferred best was DEVX8, a scaled-down version of DEVX10. I liked its trading methods and general trading behavior. Regardless, its ongoing development was stopped due to the reasons stated above. It still had room to grow and generate even more profits. I had new functions and trading methods I would have liked to add to the program.

In DEVX8, you could not predict future prices or know when it would trade, how many shares would be bought or sold, or how long a trade might last. Nonetheless, it was designed to be scalable and was built to last since underneath it was a glorified Buy & Hold strategy of the weak type.

Based on its premise, the strategy could be described in a single sentence: accumulate shares over the long term and trade over the process.

You would trade around a core position in the selected stock using your preferred trade mechanics to create a feedback loop, where the profits generated would be fed back to the trading account to acquire more shares. The more the strategy traded, the more the generated profits would flow back into the account. Share purchases were limited by the available ongoing cash reserves, if there were any. Another way of saying no leveraging was used.

If you look at DEVX8 articles, it is what you will see. Numerous charts were published showing the strategy's general behavior. I had the program annotate the results directly on each chart as it terminated its software routines. It was all chronicled, chart by chart, modification after modification. Most of the time was spent debugging the code until it ran properly (meaning without crashing or not doing what was requested). Three successive walk-forward tests were also performed to show the strategy's resilience. The last one was a one-year walk forward. DEVX8 passed all of these tests with flying colors.

The reason why was simple too. The strategy had a long-term vision of things. It was built on the backdrop of a Buy & Hold scenario to which was added the ability to trade, making it a strategy that could profit not only from the long-term upward drift in the US market but also from trading market swings.

The following chart illustrates the strategy's trading behavior.

DEVX8 Behavior

 

As shown above, the program trades over the swings in price. The profits generated go into acquiring more shares, compounding its earlier profits multiple times. It acts as an ongoing process of recycling profits again and again. These trades occur over an increasing core position. Shares were sold on their way up while above a profit threshold, which explains the high win rate.

The chart below summarizes the strategy's performance over a 20.71-year simulation (5,385 trading days) covering the dot-com bubble (2000) and the 2007-2008 financial crisis. It is more than enough time for the strategy to make its point that it could survive significant drawdowns.

DEVX8 Profit Distribution

The above is an interesting chart. Out of the total 4,880 trades, 4,290 trades (blue dots) in the top panel represent a profitable trade, while the 590 red dots to the right show trades with a loss, albeit with a low percentage. The vertical axis gives the percentage of profit on a trade. Most trades (blue dots) show a profit of over 100%.

All trades started at zero profit from the left-hand corner at zero. From there, they fluctuate between red and blue almost randomly as they finally change to blue dots that will migrate to the blue triangular formation on the left.

If we could animate the program, we would see a succession of dots emerging in clusters from the left corner and tending to migrate to the blue formation on the left. Some dots would turn red, showing they were momentarily at a loss, and then turn blue again following a quasi-random walk to their respective exit points.

The dots to the right will require more time to reach the left group formation, as if needing more nurturing for profits to grow. Blue dots in the middle of the chart are on their migration path to the blue triangular formation on the left-hand side. They need time to mature into more sizable profits before being closed once they have enough and are allowed to exit should they win the exit of a trade ticket (the exit is a random-like process).

Without a seed, the random-like functions would trigger different trades at different times. It was illustrated in one of the articles where five such charts were shown with different and relatively close outcomes, as should have been expected.

Positions might have a hard time initially (seeing some red), but eventually, they will grow and navigate to fit somewhere within the triangular group on the left. You don't know where they will end up, but that is unimportant. What is, however, is that they somehow get there. Also, there appears to be an upper and lower acceptable profit limit for blue dots. I have not yet worked on expanding those limits. Raising both barriers would generate more profits.

The chart shows 590 still opened positions out of the 4,880 at an average loss of $ 459 (12.09% of trades). It also offers 4,290 trades with an average profit of 97.36% or $ 9,729.54 per trade. All 4,880 trades started with a $10k position size. The number of trades executed is more than sufficient to say the gathered statistics are significant and representative of the whole.

The strategy ended with a win-to-loss ratio of 87.91%, which is remarkable since the trading is performed based on a quasi-random-like trade-triggering mechanism. The win-to-loss ratio would rise if more time were given to the strategy. The strategy will have a win-to-loss ratio of 100% at any new historical high. All trades would have a positive outcome, including all the still-open positions.

The reason for this is also straightforward: the strategy only sells shares when there is a profit attached to it, and therefore, all closed trades (2,942 of them) were closed at a profit. Once a trade is closed, its blue dot will stay in place while its proceeds will be fed back to the system.

You still have 2,238 open positions, of which 1,779 are at a profit dispersed within the group of blue dots according to their appreciation rates.

Since those simulations were performed, ABT has more than doubled in price. The strategy would have traded more. It would have, again, the vast majority of those trades could exit at an even higher profit should they, in turn, have won the exit lottery.

Why emphasize this particular trading strategy? It has remarkable properties.

We all know that trading using a coin flip as a trade decision-maker has a long-term expectancy of zero. It is well documented in financial literature.

You will even find examples of a few of these published strategies on my website. They all produced about nothing or close to it. If we cannot win, playing randomly, except by chance, then why redesign another strategy based on random-like functions?

I will have to revisit this DEVX8 strategy. It is somewhere on my machine. It was last modified in 2015-16. Shortly after, Yahoo! stopped providing the market data, rendering the program useless. Before that, WL changed its programming language in 2008, making the code on its website nonoperational. So, as said before, I have a dead and extinct programming language and cannot gain access to market data for it.

However, with the descriptions in the DEVX series of articles, one could still program a new version using the same principles and assumptions. Technically, rebuild something very similar to DEVX8.

The strategy is relatively simple: you execute a Buy & Hold strategy to which you add trading methods to take advantage of price swings. But you give it a twist. You increase its core position from price swing to price swing. The new purchases will come from the generated profits as you go along. You get a growing snowball effect at almost every price swing of significance.

You should notice from the charts that sales are performed on rising prices since the program wants all positions to show a profit before exiting, even if quasi-random-like procedures perform the exit. After reaching its fluctuating profit target, a trade needs to win its exit. The trade-triggering mechanics might take months or a few days to fire a trade. The same goes for the entries. Shares are purchased when a trading window is open, and while open, trades are randomly sprinkled should funds be available to execute those trades. Most trades (~95%) must win their entry and exit tickets, controlled by these random-like functions.

It gives a trading strategy that operates primarily on quasi-random-like procedures that exploit the long-term upward drift in fluctuating market prices.

Some related articles:

The Deviation X Strategy

Deviation X

Swinging It


Created: January 21, 2024, © Guy R. Fleury. All rights reserved.