First, I usually do not comment on this kind of strategy. Initial capital too low. But nonetheless, there are interesting things in it.
The original strategy has its merits for small accounts. At least, it outperforms market averages.
I prefer @Vladimir's simplification. Going from 250 to 11 lines of code, and still producing higher returns.
The strategy overall could have supported leveraging, even at 1.9, and higher stakes.
The attached algo was done using @Vladimir's version with $10 million as initial capital over the period 01-01-2003 to 9-04-2020 (about 17.16 years). My interest in is long-term strategies, the reason for my longer trading interval and the higher stakes.
I added some code to estimate the leveraging costs to see its impact on the overall return.
The estimated leveraging cost for this $10 million portfolio was in the vicinity of $25.5 million. Not a negligible sum, but the trading strategy would still have a net liquidation value of about $115 million. Netting the portfolio a 15.3% CAGR over the period.
Considering that ETFs were used and they usually do not go bankrupt, it would have been a simple and applicable trading strategy. It would have survived and performed reasonably well. At least above market averages.
@Vladimir's simplifications should be welcomed. They did simplify the code considerably. Sorry, I have not taken the time to read the original code.
The
order_target_percent
does not matter much here. Right from the start, the fix-fraction weights are set in stone making the strategy rebalance periodically on those weights. Ways to improve further would be to modulate the leveraging and the weights depending on the state of the market. But I will not take the time to do such a thing. I find the CAGR still too low.
Nonetheless, going for higher stakes has its drawbacks too. For instance, due to the 4-ETF scenario, the ending bet size comes in at $35 million each. And one should realize that those kind of bets would be required to achieve the above 15.3% CAGR. Also, about 19% of the total potential portfolio value would have been for paying those leveraging fees.
Whatever way a trading strategy is improved, meaning higher CAGR, less volatility, or whatever, including changing the ETF selection, it should be fine. You are in a game where the outcome “the way you like it” outclasses everything else. Notwithstanding, I still prefer @Vladimir's version.