PROTECTED SOURCE SCRIPT
Telah dikemas kini Session Model

SessionModel.pine - Indicator Overview
Purpose: A deterministic session model indicator that identifies trading sessions (Asian, London, NY), builds range levels from specific time windows, detects price action states (Range → Sweep → Displacement → Rebalance), and tracks divergences across 3 index symbols.
Key Feature: Uses a fixed internal timeframe (engineTF) for all decision logic, ensuring identical results regardless of what chart timeframe you're viewing.
---
HUD Display Rows - Explanations
1. SESSION
- Values: ASIAN | LONDON | NY | WAITING
- Meaning: Which trading session is currently active
- Why it matters: Each session uses different range references (ASIAN uses NY PM range, LONDON uses Asia range, NY uses London or ORB range)
2. STATE
- Values: Range | Sweep | Displacement | Rebalance
- Meaning: Current phase of the price action state machine
- Why it matters:
- Range: Building session extremes, awaiting price structure break
- Sweep: Price penetrated range boundary and closed back inside (rejection)
- Displacement: Directional move away from the range (trend confirmation)
- Rebalance: Retracement within displacement zone before resuming direction
3. CORRELATION (SMT)
- Values: Bull | Bear | Neutral
- Color: Green (Bull) | Red (Bear) | Orange (Neutral)
- Meaning: Smart Money divergence detection between US500, US100, US30
- Why it matters:
- Bull: At least one index makes new LOW but NOT all (weak shorts = bullish)
- Bear: At least one index makes new HIGH but NOT all (weak longs = bearish)
- Neutral: All indices move same direction OR insufficient window data
4. RANGE H (Range High)
- Values: Price level or "-" (not set)
- Color: Red (matching input.color rangeHighColor)
- Meaning: The highest price reached during the active range window
- Why it matters: Upper boundary for sweep detection and displacement measurement
5. RANGE L (Range Low)
- Values: Price level or "-" (not set)
- Color: Green (matching input.color rangeLowColor)
- Meaning: The lowest price reached during the active range window
- Why it matters: Lower boundary for sweep detection and displacement measurement
6. SWEEP
- Values: High | Low | "-" (not in sweep)
- Color: Yellow (if sweeping) | Gray (if not)
- Meaning: Direction of the current sweep if state == 2
- Why it matters:
- High: Price broke above range high and closed back below (bearish rejection)
- Low: Price broke below range low and closed back above (bullish rejection)
- Shows which boundary was "swept" and rejected
7. DISP DIR (Displacement Direction)
- Values: Bullish | Bearish | "-" (not displacing)
- Color: Green (Bullish) | Red (Bearish) | Gray (Not active)
- Meaning: Direction of the current displacement move (state == 3 or 4)
- Why it matters: Confirms directional bias during displacement phase
- Bullish: Price displaced above range after sweeping low
- Bearish: Price displaced below range after sweeping high
8. LEG 50% (Displacement 50% Retracement)
- Values: Price level or "-" (not set)
- Color: Cyan/Aqua
- Meaning: 50% retracement level between displacement origin and extreme
- Formula: displacementOrigin + (displacementExtreme - displacementOrigin) * 0.5
- Why it matters:
- Key retracement zone during displacement and rebalance phases
- Often acts as resistance (if bullish displacement) or support (if bearish)
- Used in rebalance trigger logic
---
How to Read the HUD Together
Example 1: Waiting for Entry
Session: NY
State: Range
Correlation: Neutral
Range H: 4050.25
Range L: 4040.50
Sweep: -
Disp Dir: -
Leg 50%: -
→ NY session active, building range. No sweep yet, no displacement. Waiting for price action.
Example 2: Sweep Detected
Session: NY
State: Sweep
Correlation: Neutral
Range H: 4050.25
Range L: 4040.50
Sweep: Low
Disp Dir: -
Leg 50%: -
→ Price swept below range low (rejected), now countdown timer running. Likely reversal coming.
Example 3: In Displacement
Session: NY
State: Displacement
Correlation: Bull
Range H: 4050.25
Range L: 4040.50
Sweep: Low
Disp Dir: Bullish
Leg 50%: 4060.75
→ After sweeping low, price displaced bullish. SMT confirming (bull divergence on indices). 50% at 4060.75 is key retracement zone.
Purpose: A deterministic session model indicator that identifies trading sessions (Asian, London, NY), builds range levels from specific time windows, detects price action states (Range → Sweep → Displacement → Rebalance), and tracks divergences across 3 index symbols.
Key Feature: Uses a fixed internal timeframe (engineTF) for all decision logic, ensuring identical results regardless of what chart timeframe you're viewing.
---
HUD Display Rows - Explanations
1. SESSION
- Values: ASIAN | LONDON | NY | WAITING
- Meaning: Which trading session is currently active
- Why it matters: Each session uses different range references (ASIAN uses NY PM range, LONDON uses Asia range, NY uses London or ORB range)
2. STATE
- Values: Range | Sweep | Displacement | Rebalance
- Meaning: Current phase of the price action state machine
- Why it matters:
- Range: Building session extremes, awaiting price structure break
- Sweep: Price penetrated range boundary and closed back inside (rejection)
- Displacement: Directional move away from the range (trend confirmation)
- Rebalance: Retracement within displacement zone before resuming direction
3. CORRELATION (SMT)
- Values: Bull | Bear | Neutral
- Color: Green (Bull) | Red (Bear) | Orange (Neutral)
- Meaning: Smart Money divergence detection between US500, US100, US30
- Why it matters:
- Bull: At least one index makes new LOW but NOT all (weak shorts = bullish)
- Bear: At least one index makes new HIGH but NOT all (weak longs = bearish)
- Neutral: All indices move same direction OR insufficient window data
4. RANGE H (Range High)
- Values: Price level or "-" (not set)
- Color: Red (matching input.color rangeHighColor)
- Meaning: The highest price reached during the active range window
- Why it matters: Upper boundary for sweep detection and displacement measurement
5. RANGE L (Range Low)
- Values: Price level or "-" (not set)
- Color: Green (matching input.color rangeLowColor)
- Meaning: The lowest price reached during the active range window
- Why it matters: Lower boundary for sweep detection and displacement measurement
6. SWEEP
- Values: High | Low | "-" (not in sweep)
- Color: Yellow (if sweeping) | Gray (if not)
- Meaning: Direction of the current sweep if state == 2
- Why it matters:
- High: Price broke above range high and closed back below (bearish rejection)
- Low: Price broke below range low and closed back above (bullish rejection)
- Shows which boundary was "swept" and rejected
7. DISP DIR (Displacement Direction)
- Values: Bullish | Bearish | "-" (not displacing)
- Color: Green (Bullish) | Red (Bearish) | Gray (Not active)
- Meaning: Direction of the current displacement move (state == 3 or 4)
- Why it matters: Confirms directional bias during displacement phase
- Bullish: Price displaced above range after sweeping low
- Bearish: Price displaced below range after sweeping high
8. LEG 50% (Displacement 50% Retracement)
- Values: Price level or "-" (not set)
- Color: Cyan/Aqua
- Meaning: 50% retracement level between displacement origin and extreme
- Formula: displacementOrigin + (displacementExtreme - displacementOrigin) * 0.5
- Why it matters:
- Key retracement zone during displacement and rebalance phases
- Often acts as resistance (if bullish displacement) or support (if bearish)
- Used in rebalance trigger logic
---
How to Read the HUD Together
Example 1: Waiting for Entry
Session: NY
State: Range
Correlation: Neutral
Range H: 4050.25
Range L: 4040.50
Sweep: -
Disp Dir: -
Leg 50%: -
→ NY session active, building range. No sweep yet, no displacement. Waiting for price action.
Example 2: Sweep Detected
Session: NY
State: Sweep
Correlation: Neutral
Range H: 4050.25
Range L: 4040.50
Sweep: Low
Disp Dir: -
Leg 50%: -
→ Price swept below range low (rejected), now countdown timer running. Likely reversal coming.
Example 3: In Displacement
Session: NY
State: Displacement
Correlation: Bull
Range H: 4050.25
Range L: 4040.50
Sweep: Low
Disp Dir: Bullish
Leg 50%: 4060.75
→ After sweeping low, price displaced bullish. SMT confirming (bull divergence on indices). 50% at 4060.75 is key retracement zone.
Nota Keluaran
V2Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.