OPEN-SOURCE SCRIPT
EMA Crossover Strategy [15M]

EMA Crossover Strategy [15M] — Stats Panel + Pip/$ Tracking + Chop Filter
A clean, rules-based EMA crossover strategy built for XAUUSD (Gold) on the 15-minute timeframe, with multi-timeframe signal confirmation, dynamic risk/reward boxes, and a full live stats panel.
🔧 How It Works
Signals are generated when the Fast EMA (5) crosses the Slow EMA (13) on the higher timeframe. The stop loss is placed at the EMA intersection point, and the take profit is calculated automatically using your chosen Risk:Reward ratio (default 2:1).
📊 Features
✅ Multi-timeframe EMA crossover detection (no repainting)
✅ Dynamic SL placed at EMA intersection — not a fixed pip distance
✅ Automatic TP calculated from your RR ratio
✅ Visual Risk/Reward boxes anchored by time (stay pinned when scrolling/zooming)
✅ VWAP filter — only takes longs above VWAP, shorts below
✅ ADX chop filter — avoids sideways markets below your ADX threshold
✅ EMA separation filter — skips signals when EMAs are too close together
✅ Stats panel (bottom left) — total trades, win rate, net RR, pips captured/lost, net $/oz
✅ Active trade panel (top right) — live entry, SL, TP, risk in pips and price
✅ JSON alerts for webhook/bot integration
✅ TP ✓ and SL ✗ hit labels on chart
⚙️ Inputs
SettingDefaultDescriptionHigher Timeframe15MHTF for EMA signalsFast EMA5Fast EMA lengthSlow EMA13Slow EMA lengthRR Ratio2.0Risk:Reward multiplierVWAP FilterOnTrend direction filterADX FilterOnChop/sideways filterADX Threshold20Minimum ADX for a valid signalEMA Sep FilterOnMinimum EMA gap filterPip Size0.1Set to 0.1 for XAUUSD (OANDA)
📌 Notes
Built and optimised for XAUUSD on OANDA — adjust pip size for other brokers or instruments
Uses barmerge.lookahead_off to prevent repainting
Drawings are anchored by time (xloc.bar_time) so they stay correctly positioned when scrolling or changing zoom
Alerts fire in JSON format — ready for webhook or bot automation
⚠️ Disclaimer
This script is for educational and informational purposes only. Past performance is not indicative of future results. Always manage your own risk.
A clean, rules-based EMA crossover strategy built for XAUUSD (Gold) on the 15-minute timeframe, with multi-timeframe signal confirmation, dynamic risk/reward boxes, and a full live stats panel.
🔧 How It Works
Signals are generated when the Fast EMA (5) crosses the Slow EMA (13) on the higher timeframe. The stop loss is placed at the EMA intersection point, and the take profit is calculated automatically using your chosen Risk:Reward ratio (default 2:1).
📊 Features
✅ Multi-timeframe EMA crossover detection (no repainting)
✅ Dynamic SL placed at EMA intersection — not a fixed pip distance
✅ Automatic TP calculated from your RR ratio
✅ Visual Risk/Reward boxes anchored by time (stay pinned when scrolling/zooming)
✅ VWAP filter — only takes longs above VWAP, shorts below
✅ ADX chop filter — avoids sideways markets below your ADX threshold
✅ EMA separation filter — skips signals when EMAs are too close together
✅ Stats panel (bottom left) — total trades, win rate, net RR, pips captured/lost, net $/oz
✅ Active trade panel (top right) — live entry, SL, TP, risk in pips and price
✅ JSON alerts for webhook/bot integration
✅ TP ✓ and SL ✗ hit labels on chart
⚙️ Inputs
SettingDefaultDescriptionHigher Timeframe15MHTF for EMA signalsFast EMA5Fast EMA lengthSlow EMA13Slow EMA lengthRR Ratio2.0Risk:Reward multiplierVWAP FilterOnTrend direction filterADX FilterOnChop/sideways filterADX Threshold20Minimum ADX for a valid signalEMA Sep FilterOnMinimum EMA gap filterPip Size0.1Set to 0.1 for XAUUSD (OANDA)
📌 Notes
Built and optimised for XAUUSD on OANDA — adjust pip size for other brokers or instruments
Uses barmerge.lookahead_off to prevent repainting
Drawings are anchored by time (xloc.bar_time) so they stay correctly positioned when scrolling or changing zoom
Alerts fire in JSON format — ready for webhook or bot automation
⚠️ Disclaimer
This script is for educational and informational purposes only. Past performance is not indicative of future results. Always manage your own risk.
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.