August 14, 2018

Yesterday, I put the following text in a forum on Quantopian. The subject of discussion was gaming stock trading strategies in a multi-strategy portfolio scenario. It stressed the importance of the few best trading strategies over the long term. It also covered strategy selection.

It should be viewed within the context it was presented. See article: The Gaming of Stock Trading Strategies and related articles below.

My suggestion is: pick something, whatever it is and deal with it. The future will not bring you back the past. However, your trading procedures if not your trading policies could make it so that you will win nonetheless. And that is where one should concentrate. Whatever trading strategy you design, you will not be able to be wrong all the time. Try it, you will see. And if you do manage that feat with a large number of trades, I'm a potential buyer of that strategy.

Your program will not adapt to what is coming if it is not programmed to do so. That sounded relatively simple.

Out of the 2,000 something stocks in the QTU stock universe, you are asked to pick some 500+ stocks based on some fundamental data, factors, indicators, or whatever data series you can find that has merit in your eyes or somebody else's.

So, every day, or whichever day you want, but at least once in a while, you need to pick one combination of stocks from n!/(k!∙(n-k)!) possible choices. Which means you pick one such group of stocks out of 5.6^486+ possible combinations. That is not a small number!

I say all the computers on this planet could not even make a dent in such a search problem for the best combination, even if you gave those machines 10 billion years to do so. Let alone do a Monte Carlo on the thing. And, this applies that you look at past or future data.

You can imagine that the problem is even harder to solve, if not currently impossible when dealing with future data. At least, over past data, you had only one recorded timeline available, only one price matrix P. Going forward, you enter a probabilistic quasi-infinite multiverse quagmire where more than chaos dominates.

It is as if some do not realize how singular and unique their trading strategies really are. It might have been interesting over some past market data, but that was just an appetizer to give you a taste of what your trading strategy could do and how it could behave. The real test, the live test is still out there to be had. That one will take time to show its merits. And, I think it will take more than just a few months.

Whatever your program selects, it is in its own tiny, really tiny speck in this humongous universe of possible variations on its huge universe of possible themes. A way of saying that your program might be so unique that there is nothing identical out there.

Therefore, one should not worry about someone reverse engineering their code. If you make your code public in some way, like putting it on someone else's machine for all to see, clearly your protection against other's quest to reverse engineer just disappeared.

Can you over-fit if the trading strategy you designed is so unique that it will do what it did for the test you ran, but will have to face a totally new price matrix P going forward?

You built this program, it is set in stone with hard-coded trading procedures. You know that future price series will be different, but seem to not accept that your program will stay the same. And, then you want it to give you the same results as your backtest on new data going forward.

Doing a backtest is only to give you an indication that what you have in mind might have worked in the past and could, therefore, be somehow applicable going forward. If your trading procedures are “technically” sound, they should apply going forward whatever will be thrown at them. That is where your trading strategy needs to specialize in order to produce the best portfolio payoff matrix. Will it be the best? Most probably not. Not even close. It is not the object of the game. Will it be good enough to outperform your peers, or what is out there? This will depend entirely on you and what you put in your code. I will add: definitely, you can outperform.

You want to know if your strategy has value? Then do the homework, make the long-term tests. Give it adverse conditions, put in all the frictional costs, make it endure. See and analyze what it does and how it behaves in all types of markets, especially over extended periods of time. Enhance the strengths, filter the trading decisions even override them, and eliminate or at least attenuate the weaknesses.

The price matrix P you are seeing is the same for everyone. It is not something you control. The only way you can be different will be the strategy you implement in your code. The outcome will be your portfolio's payoff matrix: Σ(H∙ΔP). You need a long-term vision of what your trading strategy is going to do. Going from one trade to the next, period to period, is too short-sighted. Getting to the finish line just to say: “... oops”, most certainly is not the way to go. Plan for that finish line, it is way farther than 6 months. Backtest not just over a few years like I often see on Quantopian. Make sure that your trading strategy can handle it, meaning by that, that it can survive what will be thrown at it for years and years.


Related Articles:

The Math of the Stock Trading Game is Quite Simple
The Math of the Stock Trading Game is Still Simple 

Created... August 14,  2018, © Guy R. Fleury. All rights reserved