OPEN-SOURCE SCRIPT
Order Block Matrix [Alpha Extract]

The Order Block Matrix indicator identifies and visualizes key supply and demand zones on your chart, helping traders recognize potential reversal points and high-probability trading setups.
This tool helps traders:
🔶 CALCULATION
The indicator processes chart data to identify and analyze order blocks:
Order Block Detection
Inputs:
Detection Logic:
🔶Volume Analysis
Volume Profiling:
Strength Assessment:
Pine Script®
🔶 DETAILS
Visual Features
Volume Profile Histograms:
Block Visualization:
Screener Table:
Interpretation
🔶 EXAMPLES
The indicator helps identify key trading opportunities:
Bullish Order Blocks
Bearish Order Blocks

Combined Strategies
🔶 SETTINGS
Customization Options
Order Block Detection:
Visual Style:
Color Settings:
Screener Table:
The Order Block Matrix indicator provides traders with powerful insights into market structure, helping to identify key levels where smart money is active and where high-probability trading opportunities may exist.
This tool helps traders:
- Visualize key order blocks with volume profile histograms showing liquidity distribution.
- Identify high-volume price levels where institutional activity occurs.
- rank historical order blocks and analyze their strength based on volume.
- Receive alerts for potential trading opportunities based on price-block interactions.
🔶 CALCULATION
The indicator processes chart data to identify and analyze order blocks:
Order Block Detection
Inputs:
- Price action patterns (consolidation areas followed by breakouts).
- Volume data from current and lower timeframes.
- User-defined lookback periods and thresholds.
Detection Logic:
- Identifies consolidation areas using a dynamic range comparison.
- Confirms breakout patterns with percentage threshold validation.
- Maps volume distribution across price levels within each order block.
🔶Volume Analysis
Volume Profiling:
- Divides each order block into configurable grid segments.
- Maps volume distribution across price segments within blocks.
- Highlights zones with highest volume concentration.
Strength Assessment:
- Calculates total block volume and relative strength metrics.
- Compares block volume to historical averages.
- Determines probability of reversal based on volume patterns.
isConsolidation(len) =>
high_range = ta.highest(high, len) - ta.lowest(high, len)
low_range = ta.highest(low, len) - ta.lowest(low, len)
avg_range = (high_range + low_range) / 2
current_range = high[1] - low[1]
current_range <= avg_range * (1 + obThreshold)
high_range = ta.highest(high, len) - ta.lowest(high, len)
low_range = ta.highest(low, len) - ta.lowest(low, len)
avg_range = (high_range + low_range) / 2
current_range = high[1] - low[1]
current_range <= avg_range * (1 + obThreshold)
🔶 DETAILS
Visual Features
Volume Profile Histograms:
- Color-coded bars showing volume concentration within order blocks.
- Gradient coloring based on relative volume (high volume = brighter colors).
- Bull blocks (green/teal) and bear blocks (red) with varying opacity.
Block Visualization:
- Dynamic box sizing based on volume concentration.
- Optional block borders and background fills.
- Volume labels showing total block volume.
Screener Table:
- Real-time analysis of order block metrics.
- Shows block direction, proximity, retest count, and volume metrics.
- Color-coded for quick reference.
Interpretation
- High Volume Areas: Zones with institutional interest and potential reversal points.
- Block Direction: Bullish blocks typically support price, bearish blocks typically resist price.
- Retests: Multiple tests of an order block may strengthen or weaken its influence.
- Block Age: Newer blocks often have stronger influence than older ones.
- Volume Concentration: Brightest segments within blocks represent the highest volume areas.
🔶 EXAMPLES
The indicator helps identify key trading opportunities:
Bullish Order Blocks
- Support Zones: Identify strong support levels where price is likely to bounce.
- Breakout Confirmation: Validate breakouts with volume analysis to avoid false moves.
- Retest Strategies: Enter trades when price retests a bullish order block with high volume.
Bearish Order Blocks
- Resistance Zones: Identify strong resistance levels where price is likely to reverse.
- Distribution Areas: Detect zones where smart money is distributing to retail.
- Short Opportunities: Find optimal short entry points at high-volume bearish blocks.
Combined Strategies
- Order Block Stacking: Multiple aligned blocks create stronger support/resistance zones.
- Block Mitigation: When price breaks through a block, it often indicates a strong trend continuation.
- Volume Profile Applications: Higher volume segments provide more precise entry and exit points.
🔶 SETTINGS
Customization Options
Order Block Detection:
- Consolidation Lookback: Adjust the period for consolidation detection.
- Breakout Threshold: Set minimum percentage for breakout confirmation.
- Historical Lookback Limit: Control how far back to scan for historical order blocks.
- Maximum Order Blocks: Limit the number of visible blocks on the chart.
Visual Style:
- Grid Segments: Adjust the number of volume profile segments.
- Extend Blocks to Right: Enable/disable extending blocks to current price.
- Show Block Borders: Toggle border visibility.
- Border Width: Adjust thickness of block borders.
- Show Volume Text: Enable/disable volume labels.
- Volume Text Position: Control placement of volume labels.
Color Settings:
- Bullish High/Low Volume Colors: Customize appearance of bullish blocks.
- Bearish High/Low Volume Colors: Customize appearance of bearish blocks.
- Border Color: Set color for block outlines.
- Background Fill: Adjust color and transparency of block backgrounds.
- Volume Text Color: Customize label appearance.
Screener Table:
- Show Screener Table: Toggle table visibility.
- Table Position: Select positioning on the chart.
- Table Size: Adjust display size.
The Order Block Matrix indicator provides traders with powerful insights into market structure, helping to identify key levels where smart money is active and where high-probability trading opportunities may exist.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Access more of our systems and insights at alphaextract.xyz
All analysis provided by Alpha Extract is for educational and informational purposes only.
All analysis provided by Alpha Extract is for educational and informational purposes only.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Access more of our systems and insights at alphaextract.xyz
All analysis provided by Alpha Extract is for educational and informational purposes only.
All analysis provided by Alpha Extract is for educational and informational purposes only.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.