PROTECTED SOURCE SCRIPT

2026 Model

18
2026 Model

OVERVIEW

This Pine Script indicator is a comprehensive trading tool designed for identifying key market structure patterns, session-based trading opportunities, and higher timeframe context. It combines multiple trading concepts including Fair Value Gaps (FVGs), Turtle Soup patterns, Smart Money Technique (SMT) divergence, and session-based analysis.

CORE FEATURES

1. SESSION/KILLZONE DETECTION

What It Does:
- Identifies and highlights major trading sessions based on New York time (EDT/EST)
- Displays session labels that change color: light green for the current session, grey for past sessions
- Shows background shading for active sessions

Sessions Tracked:
- Asia Session: 8:00 PM - 12:00 AM NY time
- London AM: 2:00 AM - 5:00 AM NY time
- NY AM: 9:30 AM - 11:00 AM NY time
- NY PM: 1:30 PM - 4:00 PM NY time

How It Works:
- Uses timezone conversion to check if current time falls within each session range
- Creates labels at the start of each session
- Updates label colors every bar to highlight the active session
- Labels are positioned at a consistent Y-level (aligned with HTF boundary lines)

Killzone Status:
- Active during 1:00 AM - 12:59 PM NY time
- Displayed in the dashboard table


2. DAILY BIAS CALCULATION

What It Does:
- Determines market bias based on the relationship between the last two completed daily candles
- Only calculates on weekdays (Monday-Friday) for traditional markets
- Works 24/7 for crypto markets

Bias Logic:
- Bullish:
* Previous day's high exceeded the day before's high AND close was above previous day's high
* OR previous day's low was below the day before's low BUT close recovered above the day before's low
- Bearish:
* Previous day's low was below the day before's low AND close was below previous day's low
* OR previous day's high exceeded the day before's high BUT close fell below the day before's high

How It Works:
- Compares wicks and closes of the last two completed daily candles
- Persists the last weekday bias on weekends
- Displayed in the dashboard table


3. FAIR VALUE GAPS (FVGs)

What It Does:
- Identifies price gaps where liquidity was skipped
- Draws boxes on the chart showing potential retracement zones
- Uses adaptive thresholds that adjust to market volatility

FVG Types:
- Bullish FVG: Gap between candle 1's low and candle 2's high (price jumped up)
- Bearish FVG: Gap between candle 1's high and candle 2's low (price jumped down)

Threshold Modes:
1. ATR-based (Default): Automatically adapts to asset volatility
- Calculates threshold as: (ATR / Close Price) × 100 × Multiplier
- More sensitive for volatile assets, less sensitive for stable ones
2. Auto: Uses cumulative average of price changes
3. Manual: Fixed percentage threshold (e.g., 0.01%)

How It Works:
- Only detects FVGs on confirmed (closed) bars
- Requires the middle candle's percentage change to exceed the threshold
- Extends FVG boxes 15 bars forward
- Limits to 50 FVG boxes to prevent memory issues

Settings:
- Threshold multiplier (default: 1.0) - lower = more FVGs detected
- Minimum threshold override - ensures minimum quality
- ATR length for volatility calculation


4. HIGHER TIMEFRAME (HTF) CANDLE OVERLAY

What It Does:
- Displays the last 3-5 completed HTF candles on the right side of the chart
- Shows HTF context without cluttering the main chart
- Supports 1H, 4H, Daily, Weekly, and Monthly timeframes

Features:
- Candle Display: Shows completed HTF candles with proper wicks and bodies
- Boundary Lines: Optional vertical lines on the main chart marking HTF candle boundaries
- Labels: Optional time/day/month labels under each candle
- SMT Integration: Draws SMT lines connecting swing points on the overlay candles
- Turtle Soup Integration: Shows TS levels as horizontal lines on overlay candles

How It Works:
- Fetches HTF data using request.security() with lookahead_off to get only confirmed candles
- Positions candles to the right of the current chart using future bar indices
- Calculates boundary high/low from all visible candles for consistent line heights
- Only displays when chart timeframe ≤ HTF timeframe

Settings:
- HTF timeframe selection (1H, 4H, 1D, 1W, 1M)
- Number of candles to display (3, 4, or 5)
- Toggle boundary lines and labels


5. TURTLE SOUP PATTERN DETECTION

What It Does:
- Identifies false breakouts followed by reversals
- Draws horizontal lines at the price level that was broken and then reversed
- Works on multiple timeframes (15min, 1H, 4H)

Pattern Definition:
- Bullish Turtle Soup:
* Candle breaks below previous candle's low (wick goes lower)
* BUT closes above the previous candle's low
* Indicates a false breakdown, potential reversal up
- Bearish Turtle Soup:
* Candle breaks above previous candle's high (wick goes higher)
* BUT closes below the previous candle's high
* Indicates a false breakout, potential reversal down

Threshold System:
- ATR-based (Default): Adapts to volatility
- Converts ATR to PIPs: (ATR × Multiplier) / Pip Size
- Only triggers if the initial candle meets minimum size requirement
- Fixed PIPs: Uses a fixed minimum candle size in PIPs

How It Works:
- Checks patterns when HTF candles complete
- Finds the exact swing high/low time within the HTF candle (on lower timeframes)
- Finds when price broke through that level in the reversal candle
- Draws horizontal line from swing point to break point
- Tracks patterns for HTF overlay display

Settings:
- Timeframe selection (15min, 1H, 4H)
- Threshold mode (Fixed PIPs or ATR-based)
- ATR multiplier (default: 0.4)
- Minimum PIPs (for fixed mode)


6. SMART MONEY TECHNIQUE (SMT) / DIVERGENCE

What It Does:
- Detects divergence between correlated trading pairs
- Draws lines connecting swing points when one pair shows Turtle Soup but the other doesn't
- Only works on 4H timeframe and lower

SMT Logic:
- Bullish SMT:
* Correlated pair has bullish Turtle Soup (reversed upward)
* Current pair does NOT have bullish Turtle Soup
* Current pair stayed within previous candle's range (true divergence)
* Draws line connecting swing lows
- Bearish SMT:
* Correlated pair has bearish Turtle Soup (reversed downward)
* Current pair does NOT have bearish Turtle Soup
* Current pair stayed within previous candle's range (true divergence)
* Draws line connecting swing highs

Correlated Pairs:
- ES ↔ NQ (futures)
- SPX ↔ YM (indices)
- BTC ↔ ETH (crypto)
- GBPUSD ↔ EURUSD (forex)
- XAU ↔ XAG (metals)

How It Works:
- Fetches 4H Turtle Soup status for both current and correlated pair
- Checks if current pair showed true divergence (stayed in range)
- On lower timeframes, finds actual swing points within 4H candles
- Draws line connecting the two swing points
- Only triggers on new 4H bar close to avoid duplicates
- Displays on both main chart and HTF overlay

Settings:
- Toggle SMT display on/off


7. DASHBOARD TABLE

What It Does:
- Displays key market information in a table at the bottom-right corner
- Updates in real-time as market conditions change

Information Shown:
1. Killzone: Y/N - Whether currently in active trading hours (1 AM - 12:59 PM NY)
2. Daily Bias: Bullish/Bearish/N/A - Market direction from daily candle analysis
3. 4H Turtle Soup: Bullish/Bearish/No - Most recent 4H TS pattern (within last 5 candles)
4. 4H SMT: Bullish/Bearish/No - Most recent 4H SMT divergence (within last 5 candles)

How It Works:
- Checks arrays of TS and SMT occurrences
- Finds the most recent pattern within the last 5 completed 4H candles
- Updates only on the last bar to optimize performance


HOW IT ALL WORKS TOGETHER

Workflow Example:

1. Session Context: The indicator identifies you're in NY AM session (9:30-11 AM), highlights it in green
2. Daily Bias: Shows "Bullish" from yesterday's price action
3. HTF Overlay: Displays last 5 completed 4H candles on the right, showing higher timeframe structure
4. Turtle Soup: Detects a bearish TS on 4H - price broke above previous high but closed below it
5. SMT: If correlated pair (e.g., NQ) had bullish TS but current pair (ES) didn't, draws SMT line
6. FVGs: Identifies gaps in price that may get filled
7. Dashboard: Summarizes all this information in one place

Key Design Principles:

1. Adaptive Thresholds: Both FVG and Turtle Soup use ATR-based thresholds that adjust to volatility
2. Multi-Timeframe: Works across different chart timeframes while maintaining HTF context
3. Visual Clarity: Current session highlighted in green, past sessions in grey
4. Memory Management: Limits arrays to prevent performance issues
5. Confirmed Data Only: Uses lookahead_off to ensure only completed candles are analyzed

Best Practices for Use:

1. Timeframe Selection: Use lower timeframes (5m, 15m) for entries, but always check HTF overlay for context
2. Session Awareness: Trade during active killzones when liquidity is highest
3. Daily Bias: Align trades with daily bias for higher probability
4. Turtle Soup: Look for TS patterns at key support/resistance levels
5. SMT Divergence: Use SMT to identify when one pair is leading/diverging from correlated pair
6. FVG Fills: Watch for price to return and fill FVG gaps


TECHNICAL DETAILS

Performance Optimizations:
- Limits arrays to 50 elements (FVGs, TS, SMT)
- Only updates dashboard on last bar
- Clears and redraws HTF overlay each bar to prevent duplicates
- Uses efficient time-based lookups for swing point detection

Timezone Handling:
- All sessions use New York time (America/New_York)
- Handles EDT/EST automatically
- Daily bias uses exchange timezone for daily candles

Symbol Support:
- Works with forex, futures, stocks, crypto
- Automatically detects JPY pairs for correct pip calculation (0.01 vs 0.0001)
- Handles 24/7 markets (crypto) vs traditional market hours


SETTINGS SUMMARY

Display Settings:
- Show FVGs
- Show HTF Candle Overlay
- Show Session Times
- Turtle Soup Threshold Mode (Fixed PIPs / ATR-based)
- Turtle Soup ATR Multiplier
- ATR Length

FVG Settings:
- FVG Threshold Mode (Auto / Manual / ATR-based)
- FVG Threshold Multiplier
- FVG Manual Threshold (%)
- Minimum Threshold Override (%)
- FVG ATR Length

HTF Candle Overlay:
- HTF Overlay Timeframe (1H, 4H, 1D, 1W, 1M)
- Number of Candles (3, 4, 5)
- Show HTF Candle Boundaries
- Show HTF Candle Labels

HTF Turtle Soup Settings:
- Show HTF Turtle Soup
- Turtle Soup Timeframe (15, 60, 240)
- Lookback Candles

SMT Settings:
- Show SMT


This indicator is designed to provide a comprehensive view of market structure, combining multiple trading concepts into a unified tool for better trading decisions.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.