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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.