October 23, 2015

In my previous article: A Case Study, commenting on the DEVX6 strategy, I said: "...those added lines ...could be used in the trading process itself since they were pretty good at isolating most of the trade clusters". It raised questions: why not use them? Can you get something extra using that information? Visually, those lines seem to be doing a decent job.

So, I went back to the DEVX6 program (June 2014 edition) and started looking at what I could do to improve its trading in general.

I wanted something path-independent; this way, it could be applicable at all times. It should also improve performance; otherwise, why bother? It should be stock-independent; otherwise, again, why bother?

So I came up with: delayed gratification. You are in for the long term anyway, so you could simply delay some of those sales and technically tend to increase the Δp spread, et voilà: 

NDAQ Oct. 16 - Plus 4 lines of code

NDAQ Oct 16 +4 lines of code

(click chart to enlarge)

I added 4 lines of code using the red line displayed on the chart. It increased NDAQ's profitability by $15M! May I say this again: 4 lines of code added to the 2,028 already there.

The impact on the overall strategy: you traded a little bit more: 8,942 trades, of which you closed 5,826 for a higher average Δp. Of the 3,116 positions still opened, all are profitable and could be liquidated, leaving $48.6M in the account, a 28.54% CAGR! An increase of 3.5 alpha points. You ended with $23.5M in cash, $3.5M more. It accumulated 458.000 shares valued at $25M. That is 250,000 more shares than without the code modification, all valued at a higher price. And once again, 100% of all taken positions are profitable (at the end of the test).

It worked on a few other stocks I tested. So, I would consider its mission accomplished on all fronts: using the red line, making it stock independent, making it path independent, and generating more profits. May I say this again: 4 lines of code!

The next step was to show that it was applicable to other selected stocks, more than just one or two. There was only one way to show this, and it was to perform a comparative test.

I chose to do the same test over the same stocks as last June, which also used the DEVX6 program (the same June 2014 version used on the first NDAQ example). This way, I will be able to see the equivalent of about 4 months of walk forward and the effect of the delayed gratification as if a totally out-of-sample test was performed since none of those stocks would have seen the new 4 lines of code. This will be a 20-year test, long enough to say: an extended period of time.

See the June test as it was performed. It had required 2 new lines of code over its prior version.

And now, it got 4 more lines of code. It all adds up, you know...

So, my task was set. Perform the test and report back whatever the results. We have had a turbulent summer in the market so it should be interesting to see how everything behaved, and also show what could be the value of 4 lines of code which essentially say: "if this, then wait, else". If you don't program these things in your code, how could they ever help your own trading strategies?

BTW, just as a side note, if you want to manage large funds or even get to that level, I find it only normal to show that your trading strategies can handle them. And if you can't show it, well, make your own conclusions.

I put the above in public view on a LinkedIn forum prior to testing; to force me to report back whatever the results. I also observed in that forum that few, if not no one, have dared pass such a judgment on the output of their test results before the testing was completed.

The real question should be: will I get whacked or not? I know some would really like this. My mental calculations on this methodology say no, definitely no. Nonetheless, due to the quasi-random-like entries of that trading strategy, I won't know by how much until the test is performed! But I would repeat now: just 4 lines of code! What a difference it can make.

So, off I went with some work to do.

<...a few hours later...>

Time to report. A drum roll, please...

Yes. Those 4 lines of code have significant value. The gratification delay added $226M to the portfolio, over 10 times what it started with! And yet, all I told the program was to wait another day before you sell (at times more than one day).

Here are the numbers of this new test, reported in the same format as the June 8 test. Always the need to compare things.

DEVX6 – Test Summary - Oct. 20 $10k trading units

DEVX6 Oct 20 Summary

(click chart to enlarge)

While the Dow declined by 3% over the period, with 7 out of the 10 stocks showing declines, the DEVX6 program (+ its new 4 lines) still managed to outperform in 9 out of the 10 stocks. So the added value has to come from the methodology itself and the gratification delay. If this is the case, it should be visible in the data.

Was added 61 trading days (about 12 weeks) to the 10 price series. All new data that the trading strategy has never seen before since the added 4 lines were done using another watchlist of mine. And yet, the strategy managed to extract, in a down market (-3%), an extra $226M. It should be interesting to see where it came from:

DEVX6 - Summary Differences Oct. 20 $10k trading units

DEVX6 Oct 20 Summary Differences

(click chart to enlarge)

The difference table above shows the impact of the gratification delay. There were less closed positions in all 10 stocks, as a matter of fact, 6,181 positions less than in the June 8 test. But this is not a bad thing in my type of scenario. The primary objective remains to accumulate shares over the long term, and not selling the shares can help do the job.

The delayed gratification would have caused the 109,000 closed positions to be sold at about the same price or better (some better, others worse), but mostly at higher average prices. That is why you inserted the delay.

The test was to show what would have been the impact on a portfolio of stocks. It required doing the test over something comparable, thus using the June 8 test as a comparative base.

Selling on average at a higher price would have generated more cash which was then made available to acquire additional shares. In the process taking on 5,072 more positions over the 20-year time span.

Positions that you don't close stay in the portfolio, waiting for a better price. The delayed gratification plus the strategy's propensity to accumulate shares helped push the inventory higher, accumulating some 2.2M additional shares compared to the June 8 test. Pushing the inventory value higher by $139M in a generally down market! When prices go up again, you will have 2.2M shares pushing harder to benefit the portfolio.

Even the cash reserve increased by $21.9M over the period to a grand total of $892M. The profit in the still-opened positions increased by $92M, showing that delaying gratification had its merit in more than one way. The percent of winning trades for 9 out of the 10 stocks was close to or above 95%. Six of the stocks had their percent winning trades close to or above 98%. Two of which were at 100%, meaning their remaining opened positions were all at a profit.

So, I would say that delayed gratification was a resounding success. A procedure that by itself added some alpha to the portfolio. Note that the strategy could do even better if it made better use of its accumulating cash reserves, which at the end of the test represented some 59% of the total portfolio ($892M).

Maybe one should consider delayed gratification as something extra he/she can add to their own trading strategies.

Hope you found this interesting. I liked the idea of making more even in a down market. I consider this does corroborate my prior claims.

Created... October 23, 2015,    © Guy R. Fleury. All rights reserved.