July 22, 2019
This is a follow-up to my last Quantopian post.
A more elaborate and detailed explanation for the equation used can be found in my third article of a series:
This is, I think, the 7th strategy I have enhanced or repurposed in Quantopian forums using parts of the equation given in that article. Another dozen or so simulations have been chronicled on my website over the years based on the same general equation.
The equation is designed to control the position sizing over the whole trading interval subject to price fluctuations, portfolio constraints, and preset goals.
Of interest in that article, the strategy's trading decision making was delegated to the CVXOPT optimizer which was also somewhat trade-agnostic in the sense that we did not know at what times and in what quantities the stocks it traded would be traded. In fact, I see it more as a variation to the conditions illustrated in the previously mentioned notebook.
I wrote my last two books on that subject. One to illustrate and demonstrate that theoretically, it would hold using randomly generated price series, and the more recent one to demonstrate the practical side of it; that it would also apply using actual historical stock prices. Both using the CVXOPT optimizer.
The optimizer will only detect something if there is something there in the first place. That too was effectively demonstrated by building multiple scenarios of 20,000 randomly generated portfolios each having 200 stocks of randomly generated prices.
I find that gaining the ability to control the position sizing under divers market conditions can be a major alpha extractor, not just for a trade here and there but for all trades over the entire trading interval. And this is what the position sizing equation permits, seeks, and execute.
The very first thing a trading strategy has to do is survive over the long term, and there it should be measured in decades and not just a couple of years as many of the portfolio simulations on Quantopian do exhibit.
The next thing they need to do is to perform above market averages and above their peers. Also, all frictional costs should be accounted for, otherwise, a strategy might be running on the fumes of those not considered costs. I do not think that the presented notebook scenario is considering those frictional costs, and if it is the case, then they would be a drag on performance. Nonetheless, a slight nudge to the equation controlling parameters would be more than sufficient to compensate those costs.
There are many ways to achieve outstanding results. Of the 7 enhanced, reengineered, and illustrated strategies I have covered in these forums, all had a different architecture, a different stock selection process, different trade mechanics, but still I managed to use some variant or parts of the cited equation to raise performance to higher levels, including all frictional costs except leveraging charges which would tend to reduce overall performance but that can also be compensated for.
Each strategy had a different protection mechanism in place but overall applied to about the same general trading regions with fuzzy boundaries. This is understandable, whenever we try to predict what is coming next, it is still an uncertain terrain which will unfold the way it wants to and not necessarily the way we might anticipate. It is why we have to adapt and maybe control the way we interact with all that uncertainty.
From my observations, I cannot change the price matrix P, whatever its size. It is recorded history. Nor can I change the price difference matrix ΔP which is just the period to period price variation. And going forward, I will not be able to control or even influence those two matrices either.
However, I can control the way I participate in the market through the intermediary of the stock holding matrix H that it be over past or future price data. H is the residual of two matrices: H = B – S, where all trades are accounted for. H is the total ongoing inventory after all the buying and selling.
We can transform the total payoff matrix into Σ(H∙(1+g(d,j))t∙ΔP) and adhere to the g(d,j) holding enhancer function since, on average, we should design it to be positive which in turn will increase overall performance due to compounding its bet sizing capabilities.
This is what was demonstrated in using the above-mentioned notebook. Enhancing overall performance, from start to finish with every trade being affected, and this, even without knowing what would be traded, at what times or in what quantities. But nonetheless, outperforming the market's benchmark (SPY) and most probably a lot of other players.
Created. July 22, 2019, © Guy R. Fleury. All rights reserved.