OPEN-SOURCE SCRIPT
QQE Trend Strategy [Long/Short]

QQE Trend Strategy [Long/Short]
A dual-band QQE (Quantitative Qualitative Estimation) strategy built on Pine Script v6.
Two independently tuned QQE bands — Fast and Slow — provide both responsive and filtered trend signals, with an optional 50-line direction filter and percentage-based stop loss.
━━━━━━━━━━━━━━━━━━━━━━━
🔹 HOW IT WORKS
━━━━━━━━━━━━━━━━━━━━━━━
QQE transforms RSI into a smoothed oscillator, then applies a double-EMA ATR trailing band to detect trend reversals.
When the QQE line crosses its trailing band:
- Bullish crossover → Buy signal
- Bearish crossover → Sell signal
Two band systems run in parallel:
- Fast Band (lower factor) — more responsive, earlier signals
- Slow Band (higher factor) — smoother, fewer false signals
Select which band drives your entries via the Signal Band setting.
━━━━━━━━━━━━━━━━━━━━━━━
🔹 FEATURES
━━━━━━━━━━━━━━━━━━━━━━━
- Dual QQE Bands (Fast + Slow)
→ Both plotted simultaneously for confluence analysis.
- 50-Line Direction Filter (optional)
→ When ON: Long entries only above 50, Short entries only below 50.
→ Helps eliminate counter-trend trades in strong trending conditions.
- Trade Direction control
→ Both / Long Only / Short Only
- Stop Loss (optional, percentage-based)
→ Calculated from average entry price.
→ Updated on every bar while in position.
- Display toggles
→ Fast Band, Slow Band, Histogram, Background Color, Bar Color, Signal Markers
→ All independently switchable — use as a standalone indicator or a full strategy.
- Commission & Slippage
→ Defaults: 0.03% commission, 1 tick slippage.
→ Adjustable via Strategy Properties tab without editing the script.
━━━━━━━━━━━━━━━━━━━━━━━
🔹 ALERT CONDITIONS (3 total)
━━━━━━━━━━━━━━━━━━━━━━━
- 🟢 Buy Signal — Bullish QQE trend reversal detected
- 🔴 Sell Signal — Bearish QQE trend reversal detected
- ⚡ Any Signal — Either direction triggered
All alerts include ticker and timeframe: {{ticker}}, {{interval}}
━━━━━━━━━━━━━━━━━━━━━━━
🔹 SETTINGS
━━━━━━━━━━━━━━━━━━━━━━━
- RSI Length : 14 (default)
- Smooth EMA Length : 5 (default)
- Fast Band Factor : 2.618 (default)
- Slow Band Factor : 4.236 (default)
- Signal Band : Slow (default)
- Lot Size : 1.0 (default)
Increase the Band Factor to reduce signal frequency.
Decrease it for more responsive entries on shorter timeframes.
━━━━━━━━━━━━━━━━━━━━━━━
⚠️ DISCLAIMER
━━━━━━━━━━━━━━━━━━━━━━━
This script is for educational and backtesting purposes only.
Past performance does not guarantee future results.
Always apply proper risk management before using any strategy in live markets.
A dual-band QQE (Quantitative Qualitative Estimation) strategy built on Pine Script v6.
Two independently tuned QQE bands — Fast and Slow — provide both responsive and filtered trend signals, with an optional 50-line direction filter and percentage-based stop loss.
━━━━━━━━━━━━━━━━━━━━━━━
🔹 HOW IT WORKS
━━━━━━━━━━━━━━━━━━━━━━━
QQE transforms RSI into a smoothed oscillator, then applies a double-EMA ATR trailing band to detect trend reversals.
When the QQE line crosses its trailing band:
- Bullish crossover → Buy signal
- Bearish crossover → Sell signal
Two band systems run in parallel:
- Fast Band (lower factor) — more responsive, earlier signals
- Slow Band (higher factor) — smoother, fewer false signals
Select which band drives your entries via the Signal Band setting.
━━━━━━━━━━━━━━━━━━━━━━━
🔹 FEATURES
━━━━━━━━━━━━━━━━━━━━━━━
- Dual QQE Bands (Fast + Slow)
→ Both plotted simultaneously for confluence analysis.
- 50-Line Direction Filter (optional)
→ When ON: Long entries only above 50, Short entries only below 50.
→ Helps eliminate counter-trend trades in strong trending conditions.
- Trade Direction control
→ Both / Long Only / Short Only
- Stop Loss (optional, percentage-based)
→ Calculated from average entry price.
→ Updated on every bar while in position.
- Display toggles
→ Fast Band, Slow Band, Histogram, Background Color, Bar Color, Signal Markers
→ All independently switchable — use as a standalone indicator or a full strategy.
- Commission & Slippage
→ Defaults: 0.03% commission, 1 tick slippage.
→ Adjustable via Strategy Properties tab without editing the script.
━━━━━━━━━━━━━━━━━━━━━━━
🔹 ALERT CONDITIONS (3 total)
━━━━━━━━━━━━━━━━━━━━━━━
- 🟢 Buy Signal — Bullish QQE trend reversal detected
- 🔴 Sell Signal — Bearish QQE trend reversal detected
- ⚡ Any Signal — Either direction triggered
All alerts include ticker and timeframe: {{ticker}}, {{interval}}
━━━━━━━━━━━━━━━━━━━━━━━
🔹 SETTINGS
━━━━━━━━━━━━━━━━━━━━━━━
- RSI Length : 14 (default)
- Smooth EMA Length : 5 (default)
- Fast Band Factor : 2.618 (default)
- Slow Band Factor : 4.236 (default)
- Signal Band : Slow (default)
- Lot Size : 1.0 (default)
Increase the Band Factor to reduce signal frequency.
Decrease it for more responsive entries on shorter timeframes.
━━━━━━━━━━━━━━━━━━━━━━━
⚠️ DISCLAIMER
━━━━━━━━━━━━━━━━━━━━━━━
This script is for educational and backtesting purposes only.
Past performance does not guarantee future results.
Always apply proper risk management before using any strategy in live markets.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.