OPEN-SOURCE SCRIPT
TQQQ for the Long Term - Composer

This is “TQQQ for the Long Term,” a strategy built by a Composer power user named Dereck Nielsen originally shared on Reddit and later adopted and evolved by the Composer community. The strategy blends mean reversion and momentum to decide when to rotate between
TQQQ,
UVXY,
TECL,
UPRO,
SQQQ, and
TLT creating a portfolio with higher risk-adjusted returns than TQQQ on its own.
The script has two visual components: a table and plot as seen above. The table tracks every single underlying indicator in our strategy and their current evaluation. The plot shows a single selected indicator so you can monitor how it has changed over time. You can select a different indicator in the Inputs dropdown.
The core of “TQQQ for the Long Term” is built around two ideas: momentum and mean reversion.
When SPY is trading above its 200-day SMA, the market is trending upwards and we want to be long TQQQ unless the 10-day RSI of TQQQ and SPXL indicates the market is overbought, in which case we temporarily rotate into UVXY to capitalize on volatility.
When SPY is below its 200-day SMA, we check whether the market is oversold (in which case we'll enter bullish assets like TECL, UPRO, or TQQQ. Otherwise, we'll hold either SQQQ or TLT.

In Composer, you can backtest how this strategy would have performed and even trade it automatically. For example, from June 2022 to today, this strategy has returned over +400% with an annualized return of 82%. And when backtested as far back as the 1970s using a simplified version, it actually thrived during periods of high inflation, quantitative tightening, and even stagflation. See the full backtest, trading logic and performance data here: app.composer.trade/symphony/m8Hkj9NHOTljuTRLmVoy/details

Please note that past performance is not indicative of future results and trading involves risk.
The script has two visual components: a table and plot as seen above. The table tracks every single underlying indicator in our strategy and their current evaluation. The plot shows a single selected indicator so you can monitor how it has changed over time. You can select a different indicator in the Inputs dropdown.
The core of “TQQQ for the Long Term” is built around two ideas: momentum and mean reversion.
When SPY is trading above its 200-day SMA, the market is trending upwards and we want to be long TQQQ unless the 10-day RSI of TQQQ and SPXL indicates the market is overbought, in which case we temporarily rotate into UVXY to capitalize on volatility.
When SPY is below its 200-day SMA, we check whether the market is oversold (in which case we'll enter bullish assets like TECL, UPRO, or TQQQ. Otherwise, we'll hold either SQQQ or TLT.
In Composer, you can backtest how this strategy would have performed and even trade it automatically. For example, from June 2022 to today, this strategy has returned over +400% with an annualized return of 82%. And when backtested as far back as the 1970s using a simplified version, it actually thrived during periods of high inflation, quantitative tightening, and even stagflation. See the full backtest, trading logic and performance data here: app.composer.trade/symphony/m8Hkj9NHOTljuTRLmVoy/details
Please note that past performance is not indicative of future results and trading involves risk.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Turn your sophisticated trading logic into automated algos on Composer, no coding needed ‣ composer.trade
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Turn your sophisticated trading logic into automated algos on Composer, no coding needed ‣ composer.trade
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.