3D
Hello everyone,
First of all, I would like to thank you very much for the exciting and detailed strategy proposed by @Epi. It inspired me to test its applicability and performance by analyzing it on my own. Using a short Python script, I evaluated the strategy by accessing the Yahoo Finance database to test different parameter combinations.
Approach
The focus was on TIPS (Treasury Inflation-Protected Securities) and the S&P500. For both asset classes, I examined moving averages - both Simple Moving Averages (SMA) and Exponential Moving Averages (EMA) - with time windows from 100 to 240 days, in increments of 5, and their combinations.
In addition, I tested the strategy over different time periods: ten consecutive ten-year periods between 2000 and 2025. The aim was to evaluate both the stability and the performance of the parameters over different market phases.
Results
SMA vs. EMA:
The EMA did not deliver satisfactory results in any of the scenarios tested. The SMA, on the other hand, showed consistently better performance values.
Parameter optimization:
For TIPS, an SMA with a period of 165 days emerged as a stable peak value, regardless of the decade considered. For the S&P500, the optimal parameters varied somewhat more - here the best SMA value ranged between 140 and 165 days, depending on the time period considered. It is noteworthy that an SMA of 165 consistently delivered the best results across all ten-year periods in both asset classes (TIPS and S&P500).
Alternative rebalancing strategies:
Additionally, I investigated whether shifting into gold or gold x2 instead of cash could provide an improvement. The result was sobering:
Gold x2 significantly worsened performance.
Gold as a rebalancing option only led to slightly worse results, but offered no recognizable added value compared to the original strategy.
Top results
The best three combinations are listed below, based on the average of the 10 ten-year periods:
(EDIT: I invested in the S&P500 x2 for the test, by the way).
SP_SMA TIPS_SMA AltAsset Mean_Sharpe Mean_CAGR Mean_MaxDD Mean_Vol
165 165 Cash 0.671534 0.125473 -0.240317 0.182836
160 165 Cash 0.662812 0.122270 -0.240301 0.180637
165 155 Cash 0.662389 0.122090 -0.240321 0.180596
Assumptions and restrictions
To better reflect reality, I have taken into account a tax-free allowance of 1,000 euros per year, while taxes of 25% were deducted for profits in excess of this amount. However, the implementation of this model is quite rudimentary, as I only spent a limited amount of time on these tests. I did not consider the TER of the ETFs used.
Open questions and optimization possibilities
I invite you to critically scrutinize the results and point out possible errors in my analysis. It would be great if you could share suggestions for improvement - both for the code and for the strategy itself.
In particular, I would be happy to hear about alternative investments that might be suitable as a rebalancing option during the phases in which we are divesting from the S&P500.
Thank you very much for your support and suggestions!
First of all, I would like to thank you very much for the exciting and detailed strategy proposed by @Epi. It inspired me to test its applicability and performance by analyzing it on my own. Using a short Python script, I evaluated the strategy by accessing the Yahoo Finance database to test different parameter combinations.
Approach
The focus was on TIPS (Treasury Inflation-Protected Securities) and the S&P500. For both asset classes, I examined moving averages - both Simple Moving Averages (SMA) and Exponential Moving Averages (EMA) - with time windows from 100 to 240 days, in increments of 5, and their combinations.
In addition, I tested the strategy over different time periods: ten consecutive ten-year periods between 2000 and 2025. The aim was to evaluate both the stability and the performance of the parameters over different market phases.
Results
SMA vs. EMA:
The EMA did not deliver satisfactory results in any of the scenarios tested. The SMA, on the other hand, showed consistently better performance values.
Parameter optimization:
For TIPS, an SMA with a period of 165 days emerged as a stable peak value, regardless of the decade considered. For the S&P500, the optimal parameters varied somewhat more - here the best SMA value ranged between 140 and 165 days, depending on the time period considered. It is noteworthy that an SMA of 165 consistently delivered the best results across all ten-year periods in both asset classes (TIPS and S&P500).
Alternative rebalancing strategies:
Additionally, I investigated whether shifting into gold or gold x2 instead of cash could provide an improvement. The result was sobering:
Gold x2 significantly worsened performance.
Gold as a rebalancing option only led to slightly worse results, but offered no recognizable added value compared to the original strategy.
Top results
The best three combinations are listed below, based on the average of the 10 ten-year periods:
(EDIT: I invested in the S&P500 x2 for the test, by the way).
SP_SMA TIPS_SMA AltAsset Mean_Sharpe Mean_CAGR Mean_MaxDD Mean_Vol
165 165 Cash 0.671534 0.125473 -0.240317 0.182836
160 165 Cash 0.662812 0.122270 -0.240301 0.180637
165 155 Cash 0.662389 0.122090 -0.240321 0.180596
Assumptions and restrictions
To better reflect reality, I have taken into account a tax-free allowance of 1,000 euros per year, while taxes of 25% were deducted for profits in excess of this amount. However, the implementation of this model is quite rudimentary, as I only spent a limited amount of time on these tests. I did not consider the TER of the ETFs used.
Open questions and optimization possibilities
I invite you to critically scrutinize the results and point out possible errors in my analysis. It would be great if you could share suggestions for improvement - both for the code and for the strategy itself.
In particular, I would be happy to hear about alternative investments that might be suitable as a rebalancing option during the phases in which we are divesting from the S&P500.
Thank you very much for your support and suggestions!
•
1212
•@LDA Wow! Great reaction! Thanks for that!
A few comments:
1. sma165 looks a bit random and like overfitting. What economic justification would there be for this value? I find SMA150 to be more justifiable as the average of the two most frequently observed SMAs 100 and 200.
2. try long-dated government bonds as an out-of-market asset. However, you may then need additional rules to avoid high drawdowns like 2022. But perhaps it is sometimes best to simply stand on the sidelines and hold cash?
3. why do you deduct 25% tax? 2x leveraged equity ETFs fall under the 30% partial exemption, so in the end it's only 18% tax. With OutOfMarket assets it may be different again.
4. an important point: does your test work with currency-hedged ETFs/indices? The signals in USD often differ significantly from those in EUR. The strategy is US-centric, and your test must take this into account.
5) I would find it interesting to backtest an international variant, i.e. MSCIWorld and International Inflation Protected Secs. Can you test that? Unfortunately not possible with PV.
A few comments:
1. sma165 looks a bit random and like overfitting. What economic justification would there be for this value? I find SMA150 to be more justifiable as the average of the two most frequently observed SMAs 100 and 200.
2. try long-dated government bonds as an out-of-market asset. However, you may then need additional rules to avoid high drawdowns like 2022. But perhaps it is sometimes best to simply stand on the sidelines and hold cash?
3. why do you deduct 25% tax? 2x leveraged equity ETFs fall under the 30% partial exemption, so in the end it's only 18% tax. With OutOfMarket assets it may be different again.
4. an important point: does your test work with currency-hedged ETFs/indices? The signals in USD often differ significantly from those in EUR. The strategy is US-centric, and your test must take this into account.
5) I would find it interesting to backtest an international variant, i.e. MSCIWorld and International Inflation Protected Secs. Can you test that? Unfortunately not possible with PV.
•
22
•3D
@Epi Sure, with pleasure. It was only the first throw.
1. i had periods tested independently of each other, each 10 years and in the period from 2000-2025. if you had started at the beginning of each year 2000-2015 and implemented this strategy for 10 years (until the end: 2010-2025), the combination 165 / 165 would have been the best on average. Of course, this analysis is adjusted to the years 2000-2025. Longer periods would probably yield different results.
2 I would be happy to give it a try. I just find cash boring, but that's more of a headache for me.
3 I've made a rough estimate. But I'm happy to assume 18% in the following, then the result will of course be nicer.
4. good hint! I didn't pay attention to that. I'll check it right away.
5 I'll take a look. No guarantee, of course.
1. i had periods tested independently of each other, each 10 years and in the period from 2000-2025. if you had started at the beginning of each year 2000-2015 and implemented this strategy for 10 years (until the end: 2010-2025), the combination 165 / 165 would have been the best on average. Of course, this analysis is adjusted to the years 2000-2025. Longer periods would probably yield different results.
2 I would be happy to give it a try. I just find cash boring, but that's more of a headache for me.
3 I've made a rough estimate. But I'm happy to assume 18% in the following, then the result will of course be nicer.
4. good hint! I didn't pay attention to that. I'll check it right away.
5 I'll take a look. No guarantee, of course.
•
11
•@LDA Thank you! I'm looking forward to it.
Regarding the taxes: your result corresponds quite well to my backtest on PV. You came to 12.5%pa with 25% tax, I came to 13.3%pa with 18%.
Since there is still the option of insurance, where you only have to deduct 1%pa from the CAGR, a test without any taxes is also quite useful as a reference. 👍
Regarding the taxes: your result corresponds quite well to my backtest on PV. You came to 12.5%pa with 25% tax, I came to 13.3%pa with 18%.
Since there is still the option of insurance, where you only have to deduct 1%pa from the CAGR, a test without any taxes is also quite useful as a reference. 👍
•
11
•3D
@Epi
Well, I have only looked at ETF consistently in USD. Tickers: ^GSPC, TIP, SSO and GLD.
Test at 18% in continuous model (10 years each):
=== Top 3 combinations (by mean Sharpe) ===
SP_SMA TIPS_SMA AltAsset Mean_Sharpe Mean_CAGR Mean_MaxDD Mean_Vol \
40 165 165 Cash 0.735795 0.137082 -0.239206 0.182224
38 165 155 Cash 0.725835 0.133400 -0.239209 0.179971
33 160 165 Cash 0.725677 0.133490 -0.239195 0.180041
The top combination 165/165 remains at a CAGR of 13.7%pa.
Excluding tax (0%), the top result looks like this:
=== Top 3 combinations (by mean Sharpe) ===
SP_SMA TIPS_SMA AltAsset Mean_Sharpe Mean_CAGR Mean_MaxDD Mean_Vol \
40 165 165 Cash 0.911523 0.169572 -0.23616 0.181738
38 165 155 Cash 0.899429 0.165053 -0.23616 0.179436
33 160 165 Cash 0.897650 0.164913 -0.23616 0.179586
Top combo remains 165/165 at CAGR 17%pa.
Note: Could it be that the S&P500 x2 has only existed since 2006? This means that our strategy only applies from 2006 onwards and therefore the CAGR should be higher.
(
EDIT: However, the data for the strategy from 2006 with 18% would look like this:
=== Top 3 combinations (by mean Sharpe) ===
SP_SMA TIPS_SMA AltAsset Mean_Sharpe Mean_CAGR Mean_MaxDD Mean_Vol \
40 165 165 Cash 0.786565 0.154436 -0.239206 0.197697
38 165 155 Cash 0.779914 0.151394 -0.239208 0.195083
33 160 165 Cash 0.775764 0.150493 -0.239195 0.195424
)
Please give me a few tickers that I should try out. They should all be available on Yahoo, otherwise I won't be able to access them.
Well, I have only looked at ETF consistently in USD. Tickers: ^GSPC, TIP, SSO and GLD.
Test at 18% in continuous model (10 years each):
=== Top 3 combinations (by mean Sharpe) ===
SP_SMA TIPS_SMA AltAsset Mean_Sharpe Mean_CAGR Mean_MaxDD Mean_Vol \
40 165 165 Cash 0.735795 0.137082 -0.239206 0.182224
38 165 155 Cash 0.725835 0.133400 -0.239209 0.179971
33 160 165 Cash 0.725677 0.133490 -0.239195 0.180041
The top combination 165/165 remains at a CAGR of 13.7%pa.
Excluding tax (0%), the top result looks like this:
=== Top 3 combinations (by mean Sharpe) ===
SP_SMA TIPS_SMA AltAsset Mean_Sharpe Mean_CAGR Mean_MaxDD Mean_Vol \
40 165 165 Cash 0.911523 0.169572 -0.23616 0.181738
38 165 155 Cash 0.899429 0.165053 -0.23616 0.179436
33 160 165 Cash 0.897650 0.164913 -0.23616 0.179586
Top combo remains 165/165 at CAGR 17%pa.
Note: Could it be that the S&P500 x2 has only existed since 2006? This means that our strategy only applies from 2006 onwards and therefore the CAGR should be higher.
(
EDIT: However, the data for the strategy from 2006 with 18% would look like this:
=== Top 3 combinations (by mean Sharpe) ===
SP_SMA TIPS_SMA AltAsset Mean_Sharpe Mean_CAGR Mean_MaxDD Mean_Vol \
40 165 165 Cash 0.786565 0.154436 -0.239206 0.197697
38 165 155 Cash 0.779914 0.151394 -0.239208 0.195083
33 160 165 Cash 0.775764 0.150493 -0.239195 0.195424
)
Please give me a few tickers that I should try out. They should all be available on Yahoo, otherwise I won't be able to access them.
•
11
•@LDA That looks good!
The 2x leverage ETFs on S&P500 have not been around as long as the backtest goes back. That's why I created a synthetic 2xSPY via 100% leverage and 3% financing costs for the long backtest, as already written in the article. This tracks the 2xS&P500 ETF quite accurately.
The 2x leverage ETFs on S&P500 have not been around as long as the backtest goes back. That's why I created a synthetic 2xSPY via 100% leverage and 3% financing costs for the long backtest, as already written in the article. This tracks the 2xS&P500 ETF quite accurately.
•
11
•3D
I have now also replicated the S&P500 x2 synthetically - works well. I have to say that I really like this strategy! Really outstanding performance with manageable risk (at least according to the history). I find the strategy's handling of situations like the early 2000s, 2008 & 2009, and 2022 particularly impressive (& the fact that the corona slump was filtered out so well was a stroke of luck ;)). I would like to share a few pictures, but I couldn't find this function here. But then here is a short example in figures: 2007 - 2010: CAGR: 12.11%, mDD: -21.42%, Vola: 21.78%, Sharpe Ratio: 0.56. The strategy has come out of this period with a juicy plus, while the S&P500 has still not fully recovered - of course, it doesn't have to happen that way again.
I am now having the signals issued according to the strategy and will probably try my luck with it in the future - at the moment we are sitting on the sidelines (strategy says 31.12.24: hold cash). Nevertheless, a big thank you to @Epi for this wonderful idea! If you (@Epi ) have any ideas for expanding this approach in the future, please let me know, I would also make myself available for systematic backtesting.
I am now having the signals issued according to the strategy and will probably try my luck with it in the future - at the moment we are sitting on the sidelines (strategy says 31.12.24: hold cash). Nevertheless, a big thank you to @Epi for this wonderful idea! If you (@Epi ) have any ideas for expanding this approach in the future, please let me know, I would also make myself available for systematic backtesting.
•
22
•@LDA I'm glad you appreciate the strategy. I actually think it's quite a game changer that makes the classic B&H world ETF obsolete. But only a few people see it that way, I don't know why.
Anyway, as I said, I would be interested in an international version. Initially only synthetic, as there is no 2XMSCIWorld. But if something like that is ever launched, I might even find it more interesting than a purely US-focused strategy. Can you manage that?
Anyway, as I said, I would be interested in an international version. Initially only synthetic, as there is no 2XMSCIWorld. But if something like that is ever launched, I might even find it more interesting than a purely US-focused strategy. Can you manage that?
•
11
•••
2D
@Epi @derphux
So, I did it with the same model structure with the MSCI World (URTH). Unfortunately, the history only goes back to 2012, so we are only looking at 2012-2025 here.
Result with 0.18 taxes:
- CAGR: 12.41%
- Max drawdown: -23.30%
- Volatility: 20.04%
- Sharpe Ratio: 0.62
Here without taxes:
- CAGR: 13.81%
- Max drawdown: -23.30%
- Volatility: 19.92%
- Sharpe Ratio: 0.69
Here the S&P500 in the same period for comparison:
- CAGR: 18.73%
- Max drawdown: -27.56%
- Volatility: 20.90%
- Sharpe Ratio: 0.90
Important note: I took a look at your model (@Rmann) on PV. You use not only the MA but also a dual momentum over several periods between index and TIPS. This model structure naturally improves the performance again and reduces the drawdown. Incidentally, the MA 200 provides the best service here. I have recoded your model using Python and tested it: your model seems to be "perfect" as far as possible. I wouldn't change the parameters any more.
All in all, it also seems to work well with the MSCI World, but that's not surprising as the MSCI World is largely made up of the S&P500 (to put it bluntly). By the way, I also tested the Nasdaq 100... I wouldn't do it. Similar returns, huge drawdowns.
One more note: For those who want to trade on the signals but don't want to spend money on the full version of PV: ChatGPT o1 is quite powerful, with precise instructions it manages to implement the model setup very well in Python, no programming skills needed. If you are interested you can look up the keywords: Python and Jupyter Notebook at ChatGPT. ChatGPT can answer the rest. Estimated effort for a beginner to build their own model (with know-how development): approx. 3-5 hours. But it's worth it! I "taught" myself how to code using ChatGPT as part of my ongoing master's thesis, and with a little interest it goes faster than you think.
So, I did it with the same model structure with the MSCI World (URTH). Unfortunately, the history only goes back to 2012, so we are only looking at 2012-2025 here.
Result with 0.18 taxes:
- CAGR: 12.41%
- Max drawdown: -23.30%
- Volatility: 20.04%
- Sharpe Ratio: 0.62
Here without taxes:
- CAGR: 13.81%
- Max drawdown: -23.30%
- Volatility: 19.92%
- Sharpe Ratio: 0.69
Here the S&P500 in the same period for comparison:
- CAGR: 18.73%
- Max drawdown: -27.56%
- Volatility: 20.90%
- Sharpe Ratio: 0.90
Important note: I took a look at your model (@Rmann) on PV. You use not only the MA but also a dual momentum over several periods between index and TIPS. This model structure naturally improves the performance again and reduces the drawdown. Incidentally, the MA 200 provides the best service here. I have recoded your model using Python and tested it: your model seems to be "perfect" as far as possible. I wouldn't change the parameters any more.
All in all, it also seems to work well with the MSCI World, but that's not surprising as the MSCI World is largely made up of the S&P500 (to put it bluntly). By the way, I also tested the Nasdaq 100... I wouldn't do it. Similar returns, huge drawdowns.
One more note: For those who want to trade on the signals but don't want to spend money on the full version of PV: ChatGPT o1 is quite powerful, with precise instructions it manages to implement the model setup very well in Python, no programming skills needed. If you are interested you can look up the keywords: Python and Jupyter Notebook at ChatGPT. ChatGPT can answer the rest. Estimated effort for a beginner to build their own model (with know-how development): approx. 3-5 hours. But it's worth it! I "taught" myself how to code using ChatGPT as part of my ongoing master's thesis, and with a little interest it goes faster than you think.
•
22
•@LDA Thanks for that! I really need to have a look at Pythonscripts via ChatGPT in a quiet minute.
Regarding your tests: if I understand correctly, you used MSCIWorld with US TIPS Signal. Systematically this is difficult because US liquidity is not world liquidity. I would therefore rather use a EUR-hedged Global Inflation Protected Government Bonds ETF. Yes, there is such a thing! LU0290357929
That should do the trick.
Regarding your tests: if I understand correctly, you used MSCIWorld with US TIPS Signal. Systematically this is difficult because US liquidity is not world liquidity. I would therefore rather use a EUR-hedged Global Inflation Protected Government Bonds ETF. Yes, there is such a thing! LU0290357929
That should do the trick.
••