OPEN-SOURCE SCRIPT
Cập nhật US Market Timing

Disclaimer: Results are hypothetical and do not take into account taxes and fees. This is for informational purposes only and is not financial advice. People can and do lose money investing and trading. Invest responsibly.
US Market Timing strategy designed for long-only position trading. It focuses on multi-month trends rather than day trading, specifically optimized for major US indices like the Nasdaq-100 (QQQ) and S&P 500 (SPY).
Here is a breakdown of how the strategy operates:
Core Strategy Logic
The system uses a "dual-index confirmation" approach. It looks at the S&P 500 (SPX) for the broad market regime and the Nasdaq-100 (QQQ) for specific execution signals.
Entry Conditions (The "Buy" Signal)
To enter a trade, four specific conditions must be met simultaneously:
Exit Conditions (The "Sell" Signal)
The strategy uses two distinct methods to get out of a trade:
Key Technical Components
Performance Notes
Best Results: QQQ, MDY, IWM, SPY and their leveraged counterparts (QLD, SSO).
Drawdown: Historically, it has significantly outperformed "Buy and Hold" in terms of risk-adjusted returns, often cutting the Max Drawdown of the Nasdaq in half (e.g., QQQ ~28% drawdown vs. much higher during the dot-com era).
Timeframe: Designed for daily charts with trades lasting several months.
US Market Timing strategy designed for long-only position trading. It focuses on multi-month trends rather than day trading, specifically optimized for major US indices like the Nasdaq-100 (QQQ) and S&P 500 (SPY).
Here is a breakdown of how the strategy operates:
Core Strategy Logic
The system uses a "dual-index confirmation" approach. It looks at the S&P 500 (SPX) for the broad market regime and the Nasdaq-100 (QQQ) for specific execution signals.
Entry Conditions (The "Buy" Signal)
To enter a trade, four specific conditions must be met simultaneously:
- Broad Market Strength: The SPX daily low must stay above its 21-day EMA for 4 consecutive days.
- Growth Confirmation: The QQQ daily low must be above both its 14-day and 21-day EMAs.
- Momentum Check: The current QQQ close must not be weaker than the previous three days (preventing buying into a dip that's turning into a slide).
- Trend Intensity: The SPX ADX (Average Directional Index) must be above 16, ensuring the market is actually trending and not just chopping sideways.
Exit Conditions (The "Sell" Signal)
The strategy uses two distinct methods to get out of a trade:
- The Trend-Based Exit (Loose Stop): This triggers if the SPX 7-day SMA crosses below the 107-day SMA while the QQQ is showing price weakness (closing below its 21-day EMA). This is designed to capture the bulk of a major bull run.
- The Safety Exit (Tight Stop): A hard stop is set at 3.5% below the entry price. However, it only triggers if the QQQ is also trading below its 50-day SMA, acting as a double-confirmation to avoid being "shaken out" by minor volatility.
Key Technical Components
- 21-day EMA - Used as the primary "floor" for price action.
- ADX (13-period) - Filters out "flat" markets; requires a value > 16 to trade.
- 7/107 SMA Cross - Determines the long-term trend shift for exits.
- QQQ/SPX Correlation - Uses SPX for the macro trend and QQQ for the micro timing.
Performance Notes
Best Results: QQQ, MDY, IWM, SPY and their leveraged counterparts (QLD, SSO).
Drawdown: Historically, it has significantly outperformed "Buy and Hold" in terms of risk-adjusted returns, often cutting the Max Drawdown of the Nasdaq in half (e.g., QQQ ~28% drawdown vs. much higher during the dot-com era).
Timeframe: Designed for daily charts with trades lasting several months.
Phát hành các Ghi chú
Disclaimer: This is not financial advice. All results are hypothetical and do not account for taxes and fees."US Market Timing" strategy designed for long-only position trading. It focuses on multi-month trends rather than day trading, specifically optimized for major US indices like the Nasdaq-100 (QQQ) and S&P 500 (SPY).
Here is a breakdown of how the strategy operates:
## Core Strategy Logic
The system uses a "dual-index confirmation" approach. It looks at the S&P 500 (SPX) for the broad market regime and the Nasdaq-100 (QQQ) for specific execution signals.
Entry Conditions (The "Buy" Signal)
To enter a trade, four specific conditions must be met simultaneously:
Broad Market Strength: The SPX daily low must stay above its 21-day EMA for 4 consecutive days.
Growth Confirmation: The QQQ daily low must be above both its 14-day and 21-day EMAs.
Momentum Check: The current QQQ close must not be weaker than the previous three days (preventing buying into a dip that's turning into a slide).
Trend Intensity: The SPX ADX (Average Directional Index) must be above 16, ensuring the market is actually trending and not just chopping sideways.
Exit Conditions (The "Sell" Signal)
The strategy uses two distinct methods to get out of a trade:
The Trend-Based Exit (Loose Stop): This triggers if the SPX 7-day SMA crosses below the 107-day SMA while the QQQ is showing price weakness (closing below its 21-day EMA). This is designed to capture the bulk of a major bull run.
The Safety Exit (Tight Stop): A hard stop is set at 3.5% below the entry price. However, it only triggers if the QQQ is also trading below its 50-day SMA, acting as a double-confirmation to avoid being "shaken out" by minor volatility.
## Key Technical Components
21-day EMA Used as the primary "floor" for price action.
ADX (13-period) Filters out "flat" markets; requires a value > 16 to trade.
7/107 SMA Cross Determines the long-term trend shift for exits.
QQQ/SPX Correlation Uses SPX for the macro trend and QQQ for the micro timing.
## Performance Notes
The author notes that while the strategy was tested on various assets, it is highly optimized for US Indexes.
Best Results: QQQ, MDY, IWM, SPY, and their leveraged counterparts (QLD, SSO).
Drawdown: Historically, it has significantly outperformed "Buy and Hold" in terms of risk-adjusted returns, often cutting the Max Drawdown of the Nasdaq in half (e.g., QQQ ~28% drawdown vs. much higher during the dot-com era).
Timeframe: Designed for daily charts with trades lasting several months.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.