OPEN-SOURCE SCRIPT
Güncellendi

Order Flow Imbalance Recovery Planner [AGPro Series]

1 505
Order Flow Imbalance Recovery Planner [AGPro Series]

🧠 Core Idea

Can a high-volume displacement pocket recover with enough absorption and follow-through to become actionable chart context?


📌 Overview / What it does

Order Flow Imbalance Recovery Planner [AGPro Series] maps high-volume displacement candles, converts them into practical imbalance recovery pockets, and evaluates whether price can recover that pocket with measurable response.

The script produces imbalance pockets, recovery rails, continuation corridors, invalidation shelves, target reference rails, event labels, and a compact AG Pro dashboard with a 0-100 recovery score.

This script does not read live order book data, footprint data, bid/ask tape, or true exchange-level order flow. It uses chart-available volume, relative volume, candle displacement, wick response, and recovery behavior as a practical visual proxy.


🎯 Purpose & Design Philosophy

The script was built for traders who want a structured way to study volume imbalance recovery instead of reacting to every large candle.

Many displacement candles look important at first, but the useful question is whether price can return to the pocket, absorb pressure, and recover the key rail.

The design supports a context-first workflow: identify the imbalance, observe the test, evaluate the recovery quality, and then read the current state.


⚡ Why This Script Is Different

Most tools mark volume spikes or wide candles as isolated events.

This script does NOT treat every high-volume candle as a signal.

Instead, it builds a recovery pocket, scores the reaction around that pocket, separates test conditions from READY conditions, and keeps invalidation visible.


⚙️ Methodology

1. Context Detection

The script searches for directional displacement candles with elevated relative volume, meaningful candle range, and sufficient body commitment.

2. Reference Mapping

When a valid imbalance is found, the script maps a recovery pocket and a recovery rail around the displacement body.

3. Reaction Evaluation

Price interaction with the pocket is evaluated through retest behavior, close location, wick response, relative volume, freshness, and failure distance.

4. Visual Output

The script displays the active pocket, recovery rail, target rails, invalidation shelf, event labels, bar state color, and dashboard state.


🗺️ How to Read the Chart

Zones represent the active imbalance recovery pocket.

The recovery rail marks the key level price needs to reclaim or lose before the context improves.

Labels highlight new imbalance pockets, pocket tests, ready recovery events, invalidations, and expirations.

Colors:
• Teal = bullish recovery context
• Pink = bearish recovery context or failed context
• Gold = neutral or wait state
• Indigo = monitor or reference state

The panel summarizes imbalance state, recovery score, flow response, risk, and action.


🚦 Signals & States

• Bull Imbalance → a bullish high-volume displacement pocket has been mapped

• Bear Imbalance → a bearish high-volume displacement pocket has been mapped

• Pocket Test → price is interacting with the active imbalance pocket

• Ready Recovery → the recovery score has reached the required threshold

• Invalidated → price has moved beyond the active failure edge

• Expired → the imbalance pocket is too old to remain active


🔔 Alerts Logic

Alerts can trigger when a new imbalance pocket is locked, when price tests the active pocket, when recovery reaches READY status, or when the context is invalidated.

Alerts are attention markers only. They are not trade instructions and do not guarantee future price behavior.


🧩 Confluence Logic

The context becomes stronger when high relative volume, large displacement, clean pocket retest, wick absorption, and recovery close align around the same pocket.


📊 When to Use

• After high-volume displacement candles

• During pullback and recovery phases

• Around breakout continuation attempts

• When studying absorption after aggressive movement

• On liquid symbols with reliable volume data


⚠️ When NOT to Use

• Very low-liquidity markets

• Symbols with unreliable volume data

• Extremely noisy sideways sessions

• News-driven spikes with unstable spreads

• Markets where chart volume does not represent meaningful participation


🎛️ Key Inputs

• Minimum Displacement Range → controls how large a candle must be relative to ATR

• Minimum Body Ratio → filters weak candles with too much wick noise

• Minimum Relative Volume → controls how much volume confirmation is required

• Minimum Ready Score → controls how strict the READY state is

• Projection Bars → controls how far active pockets and rails extend

• Visual Settings → control labels, zones, right-side tags, panel, font size, and bar colors


🖥️ Interface & Visual Design

The dashboard is designed as a quick decision-support panel, not a separate oscillator.

The chart uses a clear hierarchy: pocket first, recovery rail second, labels third, and targets only after recovery context becomes relevant.

The goal is to keep the chart premium, readable, and useful at first glance.


🧪 Practical Usage Workflow

1. Read the panel state

2. Locate the active imbalance pocket

3. Check whether price is testing or recovering the pocket

4. Review the recovery score and risk

5. Compare the output with broader market structure


🔍 Interpretation Guidelines

A READY state means the script has detected enough recovery behavior around the imbalance pocket to mark the context as worth attention.

It does not mean price must continue.

Use the output as structured context together with trend, liquidity, volatility, and higher-timeframe conditions.


🚫 What This Script Is NOT

This script is not a prediction engine.

It is not a true order book, footprint, or bid/ask delta tool.

It is not an automated trading system.

It does not provide guaranteed signals.

It is not financial advice.


⚠️ Limitations & Transparency

The script uses chart-available data only.

Volume quality differs between markets, brokers, exchanges, and asset classes.

Timeframe changes may alter the appearance and timing of imbalance pockets.

Extreme volatility may produce rapid invalidation or repeated displacement events.


🧠 Market Context Notes

Order-flow style interpretation should always consider liquidity, volatility, structure, and session context.

A strong recovery pocket in a clean trend may carry more practical meaning than the same pocket inside a noisy range.


🧾 Use Case Examples

When price creates a high-volume bullish displacement candle and later retests the pocket, the script evaluates whether the retest shows enough absorption and recovery strength to become a READY context.

When price loses the recovery edge, the script marks invalidation rather than keeping the setup visually alive.


🧱 System Philosophy

AGPro Series tools are designed as decision-support engines.

The goal is not to simplify markets into blind signals, but to organize complex price behavior into readable structure, state, and risk context.


🔐 Non-Promise Statement

No script can provide certainty.

No signal guarantees continuation, reversal, or profit.

Outputs should be interpreted as analytical context only.


📉 Risk Disclosure

Trading involves risk.

Users are responsible for their own decisions, risk management, and trade execution.

This script is for educational and analytical purposes only and does not provide financial advice.


📚 Educational Note

Use this tool to study how volume displacement, imbalance pockets, absorption, and recovery behavior interact across different markets and timeframes.
Sürüm Notları
🔧 UPDATE NOTES - 1.1

This update focuses on visual hierarchy, label discipline, centered zone readability, and panel usability.

The core purpose of the script remains unchanged.
This release improves how the existing imbalance recovery logic is presented, organized, and interpreted on the chart.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

• Version header cleanup
Corrected the script header version line and updated the release to Version 1.1.

• Centered zone badge system
Reworked the imbalance pocket text into a separate centered badge so the pocket remains readable without relying on embedded box text.

• Cleaner continuation review badge
Added a separate centered continuation badge for active recovery corridors, improving visual clarity during READY recovery states.

• Reduced default label crowding
Adjusted default label behavior by using a longer cooldown, a smaller retained label count, and pocket-test labels disabled by default.

• Adaptive projection control
Added an adaptive higher-timeframe projection option so pockets and rails can stay visually balanced across intraday and higher-timeframe charts.

• Right-side tag cleanup
Shortened right-side tag text for the recovery rail, pocket edges, and target rails to reduce chart-edge congestion.

• Expanded panel controls
Added broader panel placement options, refined theme choices, and support for larger panel and label text sizes.


------------------------
Visual Improvements
------------------------

• Improved chart readability by moving pocket and corridor text into dedicated centered badges.

• Reduced visual clutter so recovery events, pocket structure, and target rails are easier to interpret at first glance.

• Refined the visual hierarchy between imbalance pockets, recovery rails, invalidation shelves, target rails, and right-side tags.

• Adjusted label density and spacing to avoid repeated labels dominating volatile chart sections.


------------------------
Interface & Usability
------------------------

• Optimized the panel layout while preserving the single merged blue AG Pro header row.

• Improved label readability through cleaner defaults and expanded font-size control.

• Added more panel location choices for better fit across different chart layouts.

• Enhanced the visual experience without changing the core imbalance recovery logic.


------------------------
Behavior Notes
------------------------

This update does not change the core analytical logic of the script.

The displacement detection, imbalance pocket construction, recovery score, invalidation shelf, target rails, event logic, and alerts remain conceptually consistent with the prior release.

The goal is to improve clarity and usability, not to introduce new predictive behavior.

Users should interpret outputs the same way as before, but with improved visual structure.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool.

Market conditions such as volatility, liquidity, volume quality, and timeframe differences may affect how imbalance pockets, tests, and recovery states appear.

Outputs should always be interpreted within broader market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only.

It does not provide financial advice or guaranteed trading outcomes.

Users remain responsible for their own decisions.
Sürüm Notları
🔧 UPDATE NOTES - v1.2

This update focuses on readability and decision transparency.

The core purpose of the script remains unchanged.
This release hardens label contrast and adds an honest follow-through statistic
so the strength of READY recoveries is easier to judge at a glance.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

• Stop-Aware Recovery Follow-Through Rate
A new "Recovery Rate" panel row reports how often a fresh READY recovery went on
to reach the first target rail before the invalidation edge was crossed. A win
means the first target was reached first and a loss means the invalidation edge
was crossed first. This reuses the planner's own target and invalidation levels,
now measured across history. Recoveries that resolve neither way inside the
imbalance window are left uncounted, and the row shows the sample size and reads
"Building" until enough recoveries have completed. This adds context to the live
recovery score without changing how the score or any state is calculated.

• Hardened Label Contrast
Every event label, centered badge, and right-side tag now selects its text color
from the brightness of its own background, so bullish, bearish, neutral, accent,
and target elements stay legible. This corrects light text that previously sat on
light bearish and neutral fills.

• Simplified Pocket Badge
The centered pocket badge now reads "Bull Pocket" or "Bear Pocket" without the
redundant second line, keeping it narrower and reducing overlap with the
recovery corridor badge when both are active.


------------------------
Visual Improvements
------------------------

• Improved chart readability by hardening label, badge, and tag contrast

• Reduced visual clutter by trimming the centered pocket badge text

• Refined visual hierarchy so recovery and target elements stand out clearly

• Preserved the existing pocket, corridor, shelf, rail, and tag layout


------------------------
Interface & Usability
------------------------

• Optimized panel layout with a new recovery follow-through row

• Improved label readability for better chart interaction

• Adjusted default visual presentation for a more balanced appearance

• Enhanced overall user experience without changing core logic


------------------------
Behavior Notes
------------------------

This update does not change the core analytical logic of the script.

The displacement detection, pocket, recovery rail, scoring, target, and
invalidation logic behave the same as before. The Recovery Rate is an
observational statistic only.

Users should interpret outputs the same way as before, but with improved visual
structure and added follow-through context.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool.

Market conditions such as volatility, liquidity, and timeframe differences may
affect how imbalances, recoveries, and the recovery rate appear.

The recovery rate is a historical observation on the current chart and does not
predict future recoveries. Outputs should always be interpreted within broader
market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only.

It does not provide financial advice or guaranteed trading outcomes.

Users remain responsible for their own decisions.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.