OPEN-SOURCE SCRIPT

[TehThomas] - Order Blocks

303
█ OVERVIEW

This Order Blocks indicator identifies institutional-level support and resistance zones using fractal pattern recognition combined with Fair Value Gap (FVG) filtering. Order blocks represent areas where large institutional orders have been placed, creating significant price reactions when retested. This indicator uses a 5-bar fractal pattern to detect market structure breaks and highlights the last bearish or bullish candle before a strong impulse move.

█ KEY FEATURES

- Fractal-Based Detection: Uses 5-candle fractal patterns to identify key market structure highs and lows
- FVG Filtering: Optional Fair Value Gap confirmation ensures order blocks are followed by true market imbalances
- Automatic Mitigation: Order blocks are automatically removed when price breaks through them
- Overlap Prevention: Prevents cluttered charts by avoiding overlapping order block zones
- Customizable Display: Full control over colors, labels, line heights (body/wick), and maximum blocks shown
- Dual Polarity: Detects both bullish (OB+) and bearish (OB-) order blocks independently

█ HOW IT WORKS

The indicator scans price action for fractal patterns where the middle candle forms a local extreme (highest high or lowest low among 5 bars). When price breaks above a fractal high or below a fractal low, the script identifies the last opposing candle in the impulse move as the order block.

For bearish order blocks, it finds the highest bullish candle before a fractal low is broken, marking institutional selling pressure. For bullish order blocks, it locates the lowest bearish candle before a fractal high is breached, indicating institutional buying.

When FVG filtering is enabled, the indicator confirms that a Fair Value Gap (a 3-candle imbalance where price leaves an unfilled gap) occurred within the specified distance from the order block. This combination increases the probability that institutional traders are present in these zones.

█ SETTINGS

Bullish Order Block Settings
- Show/hide bullish order blocks
- Customize fill color and border color
- Toggle OB+ label display

Bearish Order Block Settings
- Show/hide bearish order blocks
- Customize fill color and border color
- Toggle OB- label display

Label Settings
- Label size: Tiny, Small, Normal, or Large
- Label text color customization

General Settings
- Bars Back to Check (10-200): Lookback period for order block detection
- Filter by FVG: Requires Fair Value Gap confirmation
- Max Bars Between OB and FVG (1-6): Distance tolerance for FVG filtering
- Line Height: Choose between Body or Wick for order block boundaries
- Prevent Overlapping OBs: Avoids drawing overlapping zones
- Max Order Blocks to Display (1-50): Limits active blocks on chart
- Length of Boxes (10-100): Horizontal projection length

█ HOW TO USE

1. Add the indicator to your TradingView chart
2. Configure settings based on your trading timeframe and style
3. Watch for OB+ labels (bullish order blocks) as potential support zones where price may bounce
4. Watch for OB- labels (bearish order blocks) as potential resistance zones where price may reverse
5. Wait for price retracement to the order block zone before taking entries
6. Use confirmation signals like volume spikes or reversal patterns at the order block
7. Place stop loss just outside the order block boundary to manage risk
8. Monitor mitigation: Order blocks disappear when price breaks through them completely

█ TRADING STRATEGY EXAMPLES

Bullish Order Block Strategy
Wait for a market structure shift from bearish to bullish. When price creates a bullish impulse breaking a fractal high, identify the OB+ zone. Enter long positions when price retraces to test the bullish order block, placing stop loss 10-20 pips below the zone's low. Target previous highs or resistance levels.

Bearish Order Block Strategy
Monitor for market structure shift from bullish to bearish. After price creates a bearish impulse breaking a fractal low, locate the OB- zone. Enter short positions when price retraces to test the bearish order block, placing stop loss 10-20 pips above the zone's high. Target previous lows or support levels.

FVG-Confirmed Entries
Enable FVG filtering to only display order blocks validated by Fair Value Gaps. These aligned setups increase probability as they combine institutional order placement with market inefficiencies. Trade retracements to these high-confluence zones for better risk-reward ratios.

█ IDEAL FOR

- ICT Traders: Follows Inner Circle Trader methodology for institutional order flow
- Smart Money Concepts: Tracks where large players place orders
- Swing Traders: Identifies key support/resistance for multi-day holds
- Price Action Traders: Pure chart-based approach without lagging indicators
- Breakout Traders: Confirms structure breaks with fractal patterns
- Forex, Crypto, and Stock Markets: Works on all liquid markets and timeframes

█ TECHNICAL SPECIFICATIONS

- Max Boxes: 500
- Max Labels: 500
- Detection Method: 5-bar fractal pattern recognition
- Mitigation Logic: Automatic removal when price breaks order block boundaries
- Time Projection: Uses time offset calculations for box extension
- Array Management: Dynamic array cleanup to prevent memory issues

█ NOTES & DISCLAIMERS

- Order blocks work best when combined with overall market context and trend analysis
- Not all order blocks result in price reversals; use proper risk management
- FVG filtering may reduce the number of signals but increases quality
- Fractal patterns require 5 bars to form, causing a 2-bar delay in detection
- Works optimally on higher timeframes (4H, Daily) for institutional footprints
- This indicator does not guarantee profitable trades; always use stop losses
- Past performance of order blocks does not predict future results
- Compatible with other ICT concepts like liquidity sweeps and market structure

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.