OPEN-SOURCE SCRIPT
QQQ Timing

This is a trend-following position trading strategy designed for the QQQ and the leveraged ETF QLD (ProShares Ultra QQQ). The primary goal is to capture multi-month holds for maximal profit.
Key Instruments & Performance
The strategy performs best with QLD, which yields far superior results compared to QQQ.
TQQQ (triple-leveraged) results in higher drawdowns and is not the optimal choice.
Important: The system is not intended for use with other indexes, individual stocks, or investments (like crypto or gold), as performance can vary widely.
Buy Signals
The strategy's signals are rooted in the S&P 500 Index (SPX), as testing showed it provides more reliable triggers than using QQQ itself.
Primary Buy Signal (Credit to IBD/Mike Webster): The SPX triggers a buy when its low closes above the 21-day Exponential Moving Average (EMA) for three consecutive days.
Refinement with Downtrend Lines: During corrective or bear periods, results and drawdowns can be significantly improved by incorporating downtrend lines. These lines connect lower highs. The strategy waits for the price to close above a drawn downtrend line before executing a buy. This refinement can modify the primary signal, either by allowing for an earlier entry or, in some cases, completely nullifying a false signal until the trend change proves itself.
Risk Management & Exit Strategy
Initial Buy Risk: A 3.7% stop loss is applied immediately upon the initial entry.
Initial Exit Rule: An exit is required if the QQQ's low drops below the 50-day Simple Moving Average (SMA).
Note: The 3.7% stop often provides protection when the initial buy occurs below the 50-day SMA. However, if QQQ is already trading above its 50-day SMA at the time of the SPX signal (indicating relative strength), historically, it has been better to use the 50-day SMA rule to give the position more room to run.
Trend Exit (Profit-Taking): To stay in a strong trend for the optimal amount of time, the long position is exited when a moving average crossover to the downside is triggered, based around the 107-day Simple Moving Average (SMA).
Key Instruments & Performance
The strategy performs best with QLD, which yields far superior results compared to QQQ.
TQQQ (triple-leveraged) results in higher drawdowns and is not the optimal choice.
Important: The system is not intended for use with other indexes, individual stocks, or investments (like crypto or gold), as performance can vary widely.
Buy Signals
The strategy's signals are rooted in the S&P 500 Index (SPX), as testing showed it provides more reliable triggers than using QQQ itself.
Primary Buy Signal (Credit to IBD/Mike Webster): The SPX triggers a buy when its low closes above the 21-day Exponential Moving Average (EMA) for three consecutive days.
Refinement with Downtrend Lines: During corrective or bear periods, results and drawdowns can be significantly improved by incorporating downtrend lines. These lines connect lower highs. The strategy waits for the price to close above a drawn downtrend line before executing a buy. This refinement can modify the primary signal, either by allowing for an earlier entry or, in some cases, completely nullifying a false signal until the trend change proves itself.
Risk Management & Exit Strategy
Initial Buy Risk: A 3.7% stop loss is applied immediately upon the initial entry.
Initial Exit Rule: An exit is required if the QQQ's low drops below the 50-day Simple Moving Average (SMA).
Note: The 3.7% stop often provides protection when the initial buy occurs below the 50-day SMA. However, if QQQ is already trading above its 50-day SMA at the time of the SPX signal (indicating relative strength), historically, it has been better to use the 50-day SMA rule to give the position more room to run.
Trend Exit (Profit-Taking): To stay in a strong trend for the optimal amount of time, the long position is exited when a moving average crossover to the downside is triggered, based around the 107-day Simple Moving Average (SMA).
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.