OPEN-SOURCE SCRIPT
Güncellendi

AG Pro MFI Flow Imbalance [AGPro Series]

1 721
AG Pro MFI Flow Imbalance [AGPro Series]

Overview

AG Pro MFI Flow Imbalance is a directional money-flow study built to evaluate whether buying pressure and selling pressure are developing in a balanced way or becoming meaningfully one-sided. Instead of using the classical Money Flow Index as a simple overbought/oversold gauge, this script reframes money flow as an imbalance problem. The objective is not to predict future price with certainty, and it is not presented as a standalone trading system. Its role is to help traders inspect how strongly flow is leaning to one side, how persistent that imbalance has become, and whether the condition is expanding, stabilizing, fading, or returning toward balance.

This publication is designed around a very specific analytical question: is money flow distributed relatively evenly between both sides, or is participation clustering in a way that suggests directional dominance? That is the core problem the script is trying to organize visually. In practical terms, the script separates positive and negative money flow, normalizes the relationship between them, smooths the result for readability, and then classifies the current state using threshold bands, persistence logic, event labels, and a compact summary panel. The result is a tool focused on flow asymmetry rather than on generic oscillator levels.

This distinction is important because many money-flow and volume-based studies are ultimately used as broad momentum proxies. That is not the purpose here. AG Pro MFI Flow Imbalance is built to track directional imbalance itself. The central read is not simply “high” or “low”; the central read is whether flow is bullish or bearish, whether that condition is weak or strong, whether it is becoming more one-sided or less one-sided, and whether the move is persistent enough to deserve more attention.

Within the AG Pro catalog, this script is intentionally solving a different problem than the other tools. It is not a break-and-retest study, not a reclaim tool, not a trendline or structure-mapping script, not a trend-quality score, not a session-based framework, not a cumulative OBV-style divergence tool, and not an RSI pressure oscillator. Those tools ask different questions. This script focuses on directional flow asymmetry: how unevenly money flow is being allocated between bullish and bearish participation over a rolling window. That difference is deliberate and central to the design.

What the script does

The script computes a directional money-flow relationship using typical price and volume, then compares positive flow and negative flow over a configurable lookback. That relationship is converted into a normalized imbalance score. A smoothed score line is then used to reduce noise and improve interpretability. The study also tracks whether the current imbalance is inside a neutral band, above a strong threshold, or in an extreme zone. It further evaluates persistence, meaning whether the imbalance has remained outside the neutral band for enough bars to be treated as more than a brief fluctuation.

The visual structure is built around several coordinated layers:
- a histogram that shows directional imbalance strength,
- a signal line for smoother state tracking,
- an optional raw score for users who want to inspect unsmoothed swings,
- threshold zones that separate neutral, strong, and extreme conditions,
- a subtle directional tint to keep the pane readable at a glance,
- optional event labels for selected state changes,
- and a compact panel summarizing state, bias, imbalance, strength, persistence, flow mode, MFI regime, and threshold status.

The script also includes alert conditions for directional starts, strong-threshold transitions, extreme imbalance events, fading conditions, and balance restoration. These events are not promises of future performance. They are structured notifications describing the current state of the internal flow model.

Unique edge

The unique edge of this script is not that it “improves” MFI by making stronger claims. Its edge is conceptual. Classical MFI is often read primarily as an overbought/oversold oscillator. AG Pro MFI Flow Imbalance uses MFI-related inputs as a flow framework, but the main output is a directional asymmetry engine. The question is not “is MFI high or low?” The question is “how skewed is money flow, how persistent is that skew, and is the current skew expanding or fading?”

That is why the classical MFI layer is treated as secondary context rather than as the primary engine. In this script, the MFI regime is an auxiliary read that can support or fail to support the main imbalance state. The main analytical product remains the normalized imbalance score and the way that score behaves through time.

How this differs from other AG Pro scripts

This point deserves to be explicit.

AG Pro MFI Flow Imbalance is not a structure script. It does not map swing highs, swing lows, break points, reclaim levels, retest quality, support-resistance interaction, or breakout geometry. Users looking for structural confirmation should not expect this tool to replace scripts built for structural analysis.

It is not a cumulative pressure-divergence script. It does not frame the market through OBV-style accumulation paths or through price-versus-cumulative-volume disagreement. Its emphasis is current directional flow imbalance over a rolling window, not cumulative divergence logic.

It is not an RSI pressure tool. It does not try to express internal price pressure through RSI-derived compression or momentum-pressure logic. The model here is flow allocation, not RSI pressure mapping.

It is not a trend-quality or regime-classification tool. While strong one-sided flow can sometimes align with directional trends, this script is not built to classify broad market regimes on its own. It is a flow diagnostic, not a complete regime engine.

It is not a dashboard or screener. It is a single-study analytical tool focused on one chart at a time, designed to help interpret the quality and persistence of directional money flow in context.

Because of those boundaries, this publication should not be read as a renamed variant of earlier AG Pro concepts. Its design problem, internal framing, visual hierarchy, and interpretation model are distinct.

Methodology

At a conceptual level, the script begins with typical price and volume to form raw money flow. It then separates that flow into positive and negative components based on directional change. Those components are aggregated over a lookback period and compared through a normalized formulation so the result can be interpreted as a directional imbalance score rather than as a raw cumulative total.

That normalized score is then smoothed for readability. Persistence logic is applied to distinguish short-lived pushes from conditions that remain outside the neutral band for multiple bars. The script then classifies the output using three broad layers of interpretation:
1. direction: bullish, bearish, or neutral,
2. strength: neutral, moderate, strong, or extreme,
3. behavior: expanding, fading, stabilizing, or balanced.

A secondary classical MFI context layer is also displayed in the panel. This is intentionally subordinate to the main engine. Its purpose is to tell the user whether the classical MFI backdrop is broadly supportive of the current imbalance read, not to replace the imbalance model.

How to read it

A positive histogram indicates bullish directional flow imbalance. A negative histogram indicates bearish directional flow imbalance. The further the score moves away from the neutral band, the more one-sided the flow condition becomes according to the script’s current settings.

The signal line is there to help users judge whether the imbalance is strengthening, flattening, or reversing. The raw score can also be displayed for users who want to compare unsmoothed behavior with the smoothed model.

The neutral band is important because it separates relatively balanced participation from meaningful directional skew. Movement beyond the strong threshold suggests a more assertive one-sided condition. Movement into the extreme zone signals a more stretched imbalance state. None of these states should be interpreted in isolation. A strong bullish imbalance is not automatically a bullish trade signal, and a strong bearish imbalance is not automatically a bearish trade signal. They are context states.

Persistence is also important. A one-bar excursion outside the neutral band does not carry the same informational weight as an imbalance that has remained active across several bars. That is why the panel includes a persistence read and why the optional event labels are intentionally restricted to selected events rather than every minor fluctuation.

Signals and alerts

The script includes structured event logic for the following types of conditions:
- bullish directional imbalance started,
- bearish directional imbalance started,
- bullish imbalance strengthening above the strong threshold,
- bearish imbalance strengthening above the strong threshold,
- bullish extreme imbalance,
- bearish extreme imbalance,
- imbalance fading,
- and balance restored.

These alerts describe what the internal model is detecting. They do not guarantee that price will continue in the same direction, reverse, or reach any target. Their function is organizational: they help users identify when the script’s flow state changes materially.

Key inputs

The main controls are MFI Length, Imbalance Lookback, Smoothing Length, Signal Length, Persistence Bars, Neutral Threshold, Strong Threshold, and Extreme Threshold. These settings alter how sensitive the model is to short-term changes and how quickly it escalates a condition from neutral to strong or extreme.

Visual controls allow users to show or hide the histogram, signal line, raw score, threshold zones, bias tint, MFI guides, summary panel, and event labels. Label behavior can also be filtered through event mode, size, spacing, and transparency settings so the pane can remain readable without becoming over-annotated.

Practical use

This script is generally most useful when the user wants to inspect whether directional participation is broadening or weakening under the surface. For example, a user may observe price moving higher while checking whether the flow imbalance remains supportive, is fading, or never became strong in the first place. Likewise, when price weakens, the script can help distinguish between shallow bearish flow and more persistent bearish dominance.

It can also be used as a filter alongside other tools. A trader using structural tools, trend tools, or volatility tools may find it useful to ask whether those reads are accompanied by balanced flow, strengthening directional skew, fading imbalance, or a return toward neutrality. In that role, AG Pro MFI Flow Imbalance functions as a context layer rather than as a one-click decision engine.

Limitations and transparency

This script does not know market intent, external news, hidden liquidity, or order-book behavior. It works only with the price and volume data available on the chart and the transformations applied to that data inside the model. Different symbols, exchanges, sessions, liquidity profiles, and volatility regimes can all change how the output behaves.

The study also does not eliminate the tradeoff between sensitivity and stability. Shorter settings may react faster but can become noisier. Longer settings may produce smoother states but react later. Threshold placement matters as well. If thresholds are too loose, the script may classify too many minor swings as meaningful. If thresholds are too strict, it may ignore useful early changes.

Users should also remember that strong imbalance is not inherently bullish or bearish in a simple predictive sense. A strong condition can persist, fade, stall, or reverse depending on context. The script is descriptive and analytical. It is not a guarantee engine.

Why it may be useful to traders

The usefulness of this publication comes from clarity, not from exaggerated claims. Many traders already work with price structure, trend tools, moving averages, or oscillators. What is often less explicit is whether money flow is becoming more balanced or more one-sided while those other reads are developing. This script offers a structured way to inspect that question and to keep the answer visually organized.

By focusing on directional money-flow asymmetry, persistence, threshold behavior, and event transitions, the study provides a clear framework for discussing flow conditions without collapsing everything into a generic overbought/oversold interpretation.

Risk disclosure

This script is an analytical indicator. It is not financial advice, not a promise of future results, and not a substitute for risk management, market context, or independent judgment. It does not guarantee profitable trades, trend continuation, reversals, or improved performance. Use it as one input among others.
Sürüm Notları
AG Pro MFI Flow Imbalance [AGPro Series]
Update Notes — V1.1

This update focuses on visual structure, readability, and cleaner publication presentation while keeping the core flow-imbalance framework intact.

What changed:
- Refined the panel layout with a cleaner compact structure.
- Rebuilt the first panel row into a single merged header line.
- Applied the standard AG Pro blue header styling for better visual consistency.
- Set the default panel text size to Small.
- Kept event label sizing at Normal for better chart readability.
- Improved histogram presentation and general visual hierarchy in the indicator pane.
- Reduced unnecessary default visual noise for a cleaner publish view.
- Softened secondary context layers so the main imbalance structure stands out more clearly.
- Improved balance between the histogram, signal structure, labels, and panel.
- Added a more polished presentation profile for screenshots and day-to-day chart use.

Behavior and methodology:
- The script still evaluates directional money flow imbalance through its existing internal scoring structure.
- This update does not change the overall purpose of the tool.
- The emphasis of this release is clarity, presentation quality, and easier state interpretation.

Practical result:
- Cleaner panel structure
- Better visual separation
- More readable event labeling
- More controlled publication appearance

Notes:
- This script is an analytical visualization tool.
- It does not predict future price movement.
- It is not a trade execution system.
- Alerts and visual states should be interpreted in context with price structure and user workflow.
Sürüm Notları
Version 1.2 brings a full visual and structural refinement to MFI Flow Imbalance.

What’s new:
• Updated the script title format to MFI Flow Imbalance [AGPro Series].
• Redesigned the summary panel with a cleaner AGPro Series visual standard.
• Added optional Flow Memory Zones to highlight persistent strong-flow regimes in the oscillator pane.
• Improved label placement, spacing, and default sizing for a cleaner premium chart layout.
• Added adjustable panel and label text sizes, both defaulting to Normal.
• Added a normalized MFI Context Line option for secondary money-flow confirmation.
• Refined threshold zones, histogram coloring, impulse cloud behavior, and state ribbon visuals.
• Improved alert logic for imbalance starts, strengthening, extremes, balance restoration, and memory-zone events.
• Added safer internal threshold handling so strong and extreme levels remain logically ordered.
• Cleaned and optimized the code structure for better readability and performance.

This update focuses on clearer flow-regime interpretation, cleaner visuals, and a more polished lower-pane experience.
Sürüm Notları
UPDATE NOTES - V1.3

Version 1.3 upgrades MFI Flow Imbalance with a stronger premium presentation layer while preserving the script's original lower-pane MFI-style flow-asymmetry framework.

What changed:
- Added a new Flow Quality layer that scores imbalance quality using magnitude, persistence, expansion behavior, and classical MFI alignment.
- Added an optional Flow Quality Track for a compact at-a-glance view of developing, valid, and prime-quality flow conditions.
- Added Prime Bullish Flow and Prime Bearish Flow events with optional pulses, labels in All Events mode, and dedicated alert conditions.
- Improved Flow Memory Zones with longer default projection and active-zone awareness in the summary panel.
- Refined memory-zone logic so the panel only reports Inside Bull or Inside Bear while the related zone is still active.
- Expanded the summary panel with a Flow Quality row while keeping the standard single merged blue header row.
- Preserved adjustable panel and label font sizes with Normal as the default.
- Kept event labels selective by default so the pane remains active, readable, and publication-friendly.
- Updated the script title format to MFI Flow Imbalance [AGPro Series], while the panel header continues to show AG Pro MFI Flow Imbalance.

This update focuses on clearer flow-regime interpretation, stronger screenshot quality, better alert coverage, and a more polished public-release experience without changing the core purpose of the indicator.
Sürüm Notları
🔧 UPDATE NOTES - v1.4

This update focuses on decision clarity and readability.

The core purpose of the script remains unchanged.
This release improves how the existing flow engine is presented, organized, and interpreted in the pane.

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
------------------------

• New "Next Action" panel readout
The panel now translates the current flow condition into a plain-language focus line: "Watch Bull / Bear Persistence" while a fresh imbalance is building, "Hold Bias - Flow Expanding" or "Hold Bias - Flow Steady" during persistent regimes, "Tighten Focus - Flow Fading" when directional flow weakens, "Caution - Extreme Imbalance" in stretched conditions, and "Wait - Balanced Flow" otherwise. The dashboard can be read at a glance without decoding raw values.

• New "Strong Follow" historical statistic
The panel can now display the share of persistent flow starts on the current chart that reached the strong threshold before flow returned to balance or flipped direction. The statistic is built directly on the existing persistence engine, is measured from confirmed bars, is purely descriptive, and can be hidden from the Panel Settings. Past behavior does not guarantee future outcomes.

• Standardized short title
The chart short title now follows the AGPro Series naming convention.

• Internal code restructuring
All multi-line conditional expressions were rewritten as explicit, single-purpose blocks for easier maintenance and consistent behavior across Pine Script updates. No analytical logic was altered.


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

• Refined panel visual hierarchy: the Next Action row is highlighted so the current focus stands out at first glance

• Improved panel information flow from state, to focus, to flow components, to context

• No changes to the histogram, impulse cloud, signal line, threshold zones, memory zones, pulse markers, or event labels - the established pane presentation is preserved exactly

• Default visual settings remain balanced; existing user settings are preserved


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

• Optimized panel layout (State -> Next Action -> Bias -> Score -> Strength -> Quality -> Persistence -> Flow Mode -> Memory Zone -> MFI Regime -> Strong Follow)

• Added a dedicated setting to show or hide the Strong Follow statistic

• Enhanced overall user experience without changing core logic


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

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

Flow calculations, persistence rules, quality scoring, memory zones, event labels, and alert conditions are identical to v1.3.

Users should interpret outputs the same way as before, but with improved reading order and added historical context.


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

The script remains a rule-based analytical tool.

Market conditions such as volatility, liquidity, and timeframe differences may affect how flow states and the Strong Follow statistic 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.5

This update focuses on visual comfort and first-glance readability.

The core purpose of the script remains unchanged.
This release softens the visual weight of the pane so the flow structure is easier to read during longer chart sessions.

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
------------------------

• Softer histogram presentation
The Premium histogram now uses a lighter transparency hierarchy. Extended one-sided flow periods no longer create heavy solid color walls, while the neutral / strong / extreme contrast steps remain clearly readable.

• New "Marker Mode" setting
Pulse markers now default to a Minimal mode that keeps only extreme and prime-quality markers. The Full mode restores the complete marker set, including persistent-start and strong-threshold pulses, for users who prefer the denser view.

• Calmer flow memory zones
Memory zones use a lighter fill and border, and the default zone count, extension, and spacing were rebalanced so overlapping historical zones no longer stack into heavy horizontal bands.

• Lighter background layers
The impulse cloud, threshold zone fills, and the state ribbon were each softened by one step so they support the main structure instead of competing with it.


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

• Reduced overall visual weight for a calmer, less tiring pane

• Improved visual hierarchy: histogram and signal line stay dominant, background layers stay supportive

• Reduced marker density by default while keeping the most meaningful events visible

• Cleaner long-history view with fewer and lighter memory zones


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

• Added the Marker Mode setting under Visual Settings

• Rebalanced default values for memory zone extension, spacing, and maximum count

• All previous visual layers remain available through their existing settings

• Enhanced overall user experience without changing core logic


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

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

Flow calculations, persistence rules, quality scoring, the Next Action readout, the Strong Follow statistic, event labels, and alert conditions are identical to v1.4.

Users should interpret outputs the same way as before, but with a lighter visual presentation.


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

The script remains a rule-based analytical tool.

Market conditions such as volatility, liquidity, and timeframe differences may affect how flow 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.

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.