OPEN-SOURCE SCRIPT

Xander Ultimate Pro [Final Verified + Time Est - No NA Error]

1 166
🚀 Xander Ultimate Pro [Final Verified + Time Est - No NA Error]
by wijayanto_ok

The most advanced version of the Xander scalping system — now with Supply/Demand zones, EMA 200 bias filter, intelligent time estimation, and a smart recommendation engine. 100% error-free, non-repainting, and production-ready.

================================================================================
📌 OVERVIEW
================================================================================

Xander Ultimate Pro is a professional-grade Price Action trading system engineered for traders who demand precision, confirmation, and clarity. It synthesizes seven powerful analytical layers into one cohesive, visual interface:

✅ Multi-Timeframe Trend Bias using EMA 13/21/200 confluence
✅ Auto Fibonacci Retracement from confirmed swing structures
✅ Dynamic Support & Resistance with adaptive tolerance
✅ Supply/Demand Zone detection with visual box overlays
✅ Stochastic RSI + Volume confirmation for high-probability entries
✅ Smart Risk/Reward calculator with real-time ratio display
✅ Intelligent Time Estimation: "Scalp" vs "Swing" mode detection
✅ Actionable Recommendation Engine: "STRONG BUY/SELL", "WAIT", or "NO TRADE"

🎯 Best For: Timeframes 1m – 4H | Liquid assets (Forex majors, BTC/ETH, Indices, Commodities)

================================================================================
✨ KEY FEATURES
================================================================================

🔹 1. Advanced Trend Filter (Triple EMA System)
---------------------------------
• EMA Fast (13) + EMA Slow (21) + EMA 200 (Major Bias)
• Dynamic coloring with transparency:
🟢 Green = Bullish Confluence | 🔴 Red = Bearish Confluence | ⚪ Gray = Neutral/Sideways
• Adaptive label: "LT UPTREND" for daily+ timeframes, standard for lower TFs
• Sideways detection prevents low-quality entries in choppy markets

🔹 2. Auto Fibonacci Retracement
---------------------------------
• Automatically draws Fib from last confirmed Swing High/Low
• Highlights Golden Zone (0.618) as high-probability reversal area
• Directional label: "POTENSI NAIK ↗" (Bullish) or "POTENSI TURUN ↘" (Bearish)
• Non-repainting: Uses confirmed pivots only (lookback-based)

🔹 3. Dynamic Support & Resistance
---------------------------------
• Auto-detects Swing High/Low using ta.pivothigh() / ta.pivotlow()
• Horizontal dashed lines extended to current bar
• Adaptive tolerance: 0.2% for lower TFs, 0.5% for daily+ (reduces false breaks)
• Real-time line extension as new bars form

🔹 4. Supply & Demand Zone Boxes
---------------------------------
• Visual box overlays around key pivot zones
• Red box = Supply (potential sell zone) | Green box = Demand (potential buy zone)
• Configurable zone width (candles) and price tolerance
• Auto-extended 30 bars forward for proactive planning

🔹 5. Multi-Layer Entry Confirmation
---------------------------------
Component | Default Settings | Purpose
-------------------|---------------------------------|---------------------------
Stochastic RSI | RSI:14, %K:3, %D:3, OB:80, OS:20 | Momentum timing & reversals
Volume Filter | 20-period SMA comparison | Confirms institutional interest
Price Action Area | EMA zone / S/R bounce / Zone touch | Structural alignment validation

✅ BUY Signal Triggers When ALL Are True:
1. Bullish Trend (EMA13 > EMA21 AND price > EMA200)
2. Price in Buy Area (near EMA, Support, or Demand Zone)
3. StochRSI crosses UP from Oversold (<20)
4. Volume exceeds 20-period average
→ Green "BUY" triangle + green background highlight

✅ SELL Signal Triggers When ALL Are True:
1. Bearish Trend (EMA13 < EMA21 AND price < EMA200)
2. Price in Sell Area (near EMA, Resistance, or Supply Zone)
3. StochRSI crosses DOWN from Overbought (>80)
4. Volume exceeds 20-period average
→ Red "SELL" triangle + red background highlight

🔹 6. Smart Info Panel & Recommendation Engine
---------------------------------
📊 Real-Time Table (Top-Right Corner):

| Metric | Description |
|---------------|-------------|
| RECOMMENDATION| Actionable signal: "✅ STRONG BUY NOW", "⏳ WAIT MOMENTUM", "⛔ NO TRADE", etc. |
| Mode | Auto-detects: "SCALPING" (intraday) or "SWING/DAILY" (higher TF) |
| Trend | Current bias: BULLISH / BEARISH / NEUTRAL |
| Est. RR | Live Risk:Reward ratio (e.g., "1.85 : 1") |
| Next Target | Price level of nearest swing target |
| Est. Time | Projected duration: "~12 Candles (~Day)" |

🧠 Recommendation Logic:
• "✅ STRONG BUY/SELL NOW" → All entry conditions met + RR ≥ threshold
• "⏳ WAIT MOMENTUM" → Price in zone, awaiting StochRSI confirmation
• "⏳ WAIT PULLBACK" → Trend aligned, waiting for price to reach entry area
• "⛔ NO TRADE (Sideways)" → EMA confluence absent, avoid chop
• "⛔ SKIP (RR < 1:1)" → Potential reward too small vs risk

🔹 7. Intelligent Time Estimation Feature
---------------------------------
• Calculates last swing duration in candle count
• Converts to human-readable estimate based on timeframe:
- 1m–15m → "~X Candles (~Scalp)"
- 1h–12h → "~X Candles (~Day)"
- 1D+ → "~X Candles (~Swing)"
• Helps traders align position sizing and holding period expectations

🔹 8. Visual Scalping vs Swing Label
---------------------------------
• Auto-label above price action:
⚡ "POTENSI SCALPING" → Target < user-defined % threshold (default 1.0%)
🚀 "POTENSI SWING" → Target ≥ threshold
• Color-coded background for instant visual recognition
• Shows exact distance to target in percentage

🔹 9. Alert System (Production-Ready)
---------------------------------
• 🔔 "Xander BUY" → Triggers on confirmed buy signal
• 🔔 "Xander SELL" → Triggers on confirmed sell signal
• Message format: "BUY Signal | {{ticker}} | {{close}}" (customizable)
• Fully compatible with TradingView alerts: popup, email, webhook, SMS, Discord

================================================================================
⚙️ HOW TO USE
================================================================================

🔧 Initial Setup:
1. Add script to chart with timeframe 5m, 15m, 1H, or 4H (optimal range)
2. Recommended liquid instruments:
• Forex: EURUSD, GBPUSD, USDJPY, XAUUSD
• Crypto: BTCUSDT, ETHUSDT, SOLUSDT
• Indices: US30, NAS100, SPX500, GER40
• Commodities: XAUUSD, XAGUSD, OIL

🎯 LONG Entry Protocol:
1. Confirm panel shows "BULLISH" trend + "SCALPING" or "SWING" mode
2. Wait for price to enter Buy Area:
- Pullback to EMA 13-21 zone, OR
- Bounce from green Support line, OR
- Touch of green Demand Zone box
3. Confirm signal: Green BUY triangle appears + candle closes bullish
4. Verify StochRSI: Crossed up from <20 zone
5. Confirm Volume: Current bar > 20-period average
6. Check Panel: RR ≥ 1:1.5 and Recommendation = "✅ STRONG BUY NOW"

📍 Stop Loss: 1-2 ticks below lastSwingLow or Demand Zone bottom
🎯 Take Profit:
- Conservative: lastSwingHigh / Supply Zone top
- Aggressive: Fib 0.236 or 0.382 extension
- Always respect RR target ≥ 1:1.5

🎯 SHORT Entry Protocol:
1. Confirm panel shows "BEARISH" trend + mode label
2. Wait for price to enter Sell Area:
- Pullback to EMA 13-21 zone, OR
- Rejection from red Resistance line, OR
- Touch of red Supply Zone box
3. Confirm signal: Red SELL triangle appears + candle closes bearish
4. Verify StochRSI: Crossed down from >80 zone
5. Confirm Volume: Current bar > 20-period average
6. Check Panel: RR ≥ 1:1.5 and Recommendation = "✅ STRONG SELL NOW"

📍 Stop Loss: 1-2 ticks above lastSwingHigh or Supply Zone top
🎯 Take Profit:
- Conservative: lastSwingLow / Demand Zone bottom
- Aggressive: Fib 0.236 or 0.382 extension downward
- Always respect RR target ≥ 1:1.5

⚠️ Critical Filters (Do Not Ignore):
❌ NEVER trade when Recommendation = "⛔ NO TRADE (Sideways)"
❌ SKIP any signal with Est. RR < 1:1 (visible in panel)
❌ AVOID entries 5-10 minutes before/after high-impact news (NFP, CPI, FOMC)
❌ DO NOT chase entries if price is >2% away from EMA zone (overextended)
✅ ALWAYS wait for candle CLOSE beyond signal bar for confirmation
✅ ALWAYS use hard Stop Loss — never move it against your position
✅ Consider partial profit taking at 1:1 RR, let remainder run to target

================================================================================
🔍 TECHNICAL NOTES (For Advanced Users & Developers)
================================================================================

📐 Non-Repainting Architecture:
• Pivot detection: ta.pivothigh/low with rightBars = lookback → confirmed only after N candles
• All signals trigger on bar close, not intra-candle
• NA error prevention: All swing variables initialized with "not na()" guards
• Line/box management: Old objects deleted before new creation (prevents chart clutter)

📊 Adaptive Tolerance System:
• Lower TFs (1m-1H): tolerance = close * 0.002 (0.2%)
• Higher TFs (4H+): tolerance = close * 0.005 (0.5%)
• Prevents false S/R breaks on volatile assets while maintaining sensitivity

⏱ Time Estimation Logic:
lastMoveDuration = currentSwingIndex - previousSwingIndex
→ Converted to human-readable format via timeframe.period detection
→ Case-sensitive TF matching: "1m", "5m", "1h", "4h", "1D", etc.
→ Fallback: "Calculating..." until first full swing cycle completes

🧮 Risk/Reward Calculation:
// For LONG:
risk = entry_price - lastSwingLow
reward = lastSwingHigh - entry_price
RR = reward / risk

// For SHORT:
risk = lastSwingHigh - entry_price
reward = entry_price - lastSwingLow
RR = reward / risk

• Uses close price as proxy for entry (adjust manually for precision)
• Panel displays "N/A" or "Wait Swing" until valid swings are detected

🎨 Visual Optimization:
• Max limits set: max_lines_count=500, max_labels_count=500, max_boxes_count=100
• Transparent colors (color.new(..., alpha)) prevent chart clutter
• Background highlights only on confirmed signals (no visual noise)

================================================================================
⚠️ DISCLAIMER & RISK WARNING
================================================================================

🚨 CRITICAL NOTICE: This script is an analytical and educational tool only. It does NOT constitute financial advice, guarantee profits, or replace independent trading judgment.

1. ✅ Backtest Thoroughly: Validate performance in TradingView's bar replay mode across multiple market conditions (trending, ranging, high volatility) before live use.
2. ✅ Start Small: When going live, begin with minimal position size to verify real-world behavior matches backtest expectations.
3. ✅ Understand Limitations:
• Performs optimally in trending markets with clear structure
• May generate fewer signals (or whipsaws) in extreme sideways/choppy conditions
• News events can invalidate technical setups — always check economic calendar
4. ✅ Non-Repainting Confirmation:
• Signals appear only after candle close AND pivot confirmation
• Minor 1-candle lag on swing detection is intentional for reliability
• Do not anticipate signals — wait for full confirmation
5. ✅ Risk Management is Mandatory:
• ALWAYS use a hard Stop Loss on every trade
• Never risk more than 1-2% of account equity per trade
• Adjust position size based on SL distance, not signal strength

🔹 Trading forex, cryptocurrencies, indices, and derivatives involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results. Trade only with capital you can afford to lose entirely.

================================================================================
🔄 VERSION HISTORY
================================================================================

Version | Release Date | Key Updates
--------|--------------|--------------------------------------------------
1.0 | May 2026 | Initial public release: Core EMA + S/R + StochRSI + Volume + RR Table
1.1 | May 2026 | Added Supply/Demand zones, EMA 200 bias, adaptive tolerance
1.2 | May 2026 | [CURRENT] Added Time Estimation, Smart Recommendation Engine, NA error fixes, Scalping/Swing auto-label, enhanced panel

================================================================================
💬 FEEDBACK, SUPPORT & COMMUNITY
================================================================================

• 🛠 Bug Reports: Please include screenshot + timeframe + asset name + steps to reproduce for fastest resolution.
• 💡 Feature Requests: Comment on the script page or DM wijayanto_ok with detailed use case.
• 🤝 Collaborations: Open to integrating user-suggested indicators (with proper credit).
• 🌟 Show Support: If this tool adds value to your trading, a like, follow, or constructive review helps immensely.

📬 Preferred Contact: TradingView DM wijayanto_ok

================================================================================
🔖 TAGS (For Search Optimization)
================================================================================

scalping, price-action, ema, fibonacci, support-resistance, supply-demand, stochastic-rsi, volume-profile, risk-reward, swing-trading, confirmation, non-repainting, tradingview, pine-script, indicator, strategy, auto-fib, time-estimation, recommendation-engine

================================================================================
✅ PRE-PUBLISH QUALITY CHECKLIST
================================================================================

[x] Code compiles with zero errors or warnings in Pine Script v6
[x] Tested on 5+ assets across Forex, Crypto, and Indices
[x] Validated on timeframes: 5m, 15m, 1H, 4H, 1D
[x] All user inputs have logical defaults and min/max constraints
[x] Comprehensive inline comments for maintainability
[x] Full risk disclaimer and educational warnings included
[x] Alert conditions defined and tested
[x] Zero repainting behavior confirmed via bar replay
[x] NA/Null handling prevents runtime errors
[x] Visual elements respect TradingView object limits
[x] Documentation complete, professional, and mobile-friendly
[x] English language optimized for global TradingView audience

================================================================================
🙏 FINAL WORDS
================================================================================

"Plan your trade, trade your plan. Consistency > Perfection."
— Xander Trading Philosophy

Thank you for trusting Xander Ultimate Pro with your market analysis.
May your entries be precise, your risk managed, and your RR always in your favor. 🎯📈

Happy Trading,
wijayanto_ok

================================================================================
🔐 LICENSE
================================================================================

This Pine Script® code is subject to the terms of the Mozilla Public License 2.0
at mozilla.org/MPL/2.0/

© 2026 wijayanto_ok. All rights reserved.
You are free to use, modify, and share this script for personal trading purposes.
Commercial redistribution or resale of the code is prohibited without explicit permission.

================================================================================

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.