OPEN-SOURCE SCRIPT

XAUUSD Multi-Timeframe Bias Scanner

118
🎯 Purpose & Overview
This is a sophisticated trading indicator that analyzes XAUUSD (Gold) across 5 different timeframes simultaneously to determine market bias and trend direction.

⚙️ Core Components
2. Bias Calculation Engine
The heart of the indicator uses 5 technical factors to score each timeframe:

Technical Factors (Weighted):
Moving Average Alignment (30 points)

Bullish: EMA(9) > EMA(21) > EMA(50)

Bearish: EMA(9) < EMA(21) < EMA(50)

Price vs MA Position (20 points)

Score increases when price above MAs

Score decreases when price below MAs

RSI Momentum (20 points)

Bullish: RSI > 60 or > 50

Bearish: RSI < 40 or < 50

MACD Signals (15 points)

Bullish: MACD line > Signal line AND > 0

Bearish: MACD line < Signal line AND < 0

Volume Confirmation (15 points)

Volume spikes with price movement add confirmation

📊 Timeframe Analysis
Five Timeframes Monitored:
5-minute - Short-term noise (10% weight)

15-minute - Intraday direction (15% weight)

1-hour - Key intraday bias (25% weight)

4-hour - Primary directional bias (30% weight)

1-day - Overall trend context (20% weight)

Bias Scoring System:
0-100 Scale (50 = Neutral)

STRONG BULLISH: ≥70 (Green)

BULLISH: 55-69 (Lime)

NEUTRAL: 46-54 (Gray)

BEARISH: 31-45 (Orange)

STRONG BEARISH: ≤30 (Red)

🎨 Visual Features
1. Comprehensive Table Display
pinescript
var table biasTable = table.new(position.top_right, 3, 7, ...)
Shows a color-coded table with:

Timeframe name

Numerical bias score (0-100)

Strength description with color coding

2. Chart Visual Indicators
Background coloring based on overall bias

Label markers for strong bullish/bearish conditions

Real-time label showing all timeframe scores

3. Alert System
Triggers when overall bias crosses 70 (bullish) or 30 (bearish)

Configurable with sound options

🔄 How It Processes Data
Data Flow:
Requests security data for each timeframe using request.security()

Calculates technical indicators for each TF separately

Scores each TF based on 5 technical factors

Computes weighted overall bias

Updates visual displays and checks alert conditions

💡 Trading Applications
Bullish Scenarios:
Multiple timeframes show bullish alignment

Higher timeframe bias supports lower timeframe direction

Overall score > 70 indicates strong bullish conviction

Bearish Scenarios:
Multiple timeframes show bearish alignment

Higher timeframe bias confirms lower timeframe moves

Overall score < 30 indicates strong bearish conviction

Conflict Detection:
When timeframes show conflicting biases

Caution required - market may be consolidating

Wait for alignment before taking trades

🎚️ Customization Options
Users can modify:

Timeframe weights

Technical indicator parameters

Alert thresholds

Visual display preferences

Scoring sensitivity

📈 XAUUSD Specific Optimizations
The indicator considers Gold's unique characteristics:

High volatility periods

ATR-based volatility adjustments

Volume confirmation for breakouts

Multiple timeframe confirmation for trend reliability

This creates a powerful tool for identifying high-probability trade setups in XAUUSD by ensuring traders have a complete multi-timeframe perspective before entering positions.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.