Order Flow Momentum Divergence [theUltimator5]This indicator is the Order Flow Momentum Divergence (OFMD)
Most momentum indicators tell you what price has already done (lagging indicators). This indicator is an attempt at a leading indicator by monitoring order flow momentum through volume footprint, comparing it to price momentum, and tracking divergences.
Price momentum indicators -> RSI, MACD, stochastics, all of them lag. They are derivatives of the close. When RSI is overbought, it means price has been going up. That's it. It tells you nothing about whether the actual buying pressure behind that move is still present, exhausted, or already reversing.
Footprint delta alone has the opposite problem. It's noisy, spiky, and hard to read directionally across timeframes. A single bar with massive positive delta doesn't tell you much in isolation.
What OFMD is actually solving is the confirmation gap. Specifically: is the order flow that drove a price move still supporting it, or has it quietly shifted while price continues on inertia?
When Flow Momentum and Price Momentum agree, the move has both structural and transactional backing. When they diverge, particularly when Flow Momentum turns while Price Momentum hasn't yet, you're seeing a potential early warning that the fuel behind the move is changing before price reflects it.
In plain terms: most traders get stopped out or give back gains because they're reading price alone. They're not reading what's happening inside the price. OFMD attempts to surface that internal picture and put it on the same scale as a familiar momentum oscillator so the two can be directly compared bar by bar.
IMPORTANT - Before reading further, this indicator uses the volume footprint, which requires (at the time of creating the indicator) a premium TradingView subscription. If you do not have a access to the volume footprint function, this indicator will not function as intended.
HOW IT WORKS
OFMD runs two signals in parallel.
1) The first is Flow Momentum: a net bias score built by running footprint delta through 100 Hull Moving Averages simultaneously (lengths 2 through 101), normalizing each, and averaging the result. The output is a single -100 to +100 value that represents the aggregate directional lean of order flow across all measured timeframes at once.
2) The second is Price Momentum: a standard 7-period RSI rescaled to the same -100 to +100 range for direct comparison.
When these two signals diverge, Flow Momentum rising while Price Momentum falls, or vice versa, the indicator flags it. That divergence is the signal. The fill between the two lines intensifies as the gap widens. The chart overlay bands extend from price proportionally to signal strength, giving you a visual anchor directly on the candles without needing to cross-reference the sub-pane.
Sub-Pane Series
Show Flow Momentum Line - The purple line. Displays the aggregate order flow bias score derived from footprint delta. Opacity scales with signal strength; it fades when bias is weak and near zero, and becomes fully opaque as conviction builds.
Show Price Momentum Line - The yellow line. A 7-period RSI stretched to -100/+100 so it sits on the same scale as Flow Momentum. Crossing zero means RSI has crossed 50. It is simply a shifted visual of RSI to match the order flow momentum in order to visually watch bullish/bearish crossings.
Show Divergence Fill - Fills the area between the two lines. Color is green for bullish divergence (Flow Momentum leading up) and red for bearish (Flow Momentum leading down). Opacity increases as the gap between the signals widens. Both lines need to be enabled for the fill to render.
Show Difference Histogram (Disabled by default) - Plots the raw arithmetic difference between Flow Momentum and Price Momentum as a histogram. Green bars mean flow is ahead of price; red bars mean price is ahead of flow. Useful for gauging divergence magnitude at a glance without reading the lines themselves.
Chart Overlay
Band Mode — Controls which overlay band or combination of bands is drawn on the price chart.
Bias Band : a single band anchored to a short EMA of price, offset proportionally to Flow Momentum strength. Color shifts from purple at maximum bearish bias through neutral at zero to green at maximum bullish bias. This band tells you where order flow bias is pointing relative to current price. This line acts as a price continuation indicator.
Divergence Band : This plots the offset proportionally to the gap between Flow Momentum and Price Momentum rather than to either signal individually. Color shifts from deep orange when price momentum is leading to electric blue when flow momentum is leading. This band is suppressed when both signals are on the same side but not in strong agreement, to avoid noise. When both signals agree strongly, the Divergence Band inherits the Bias Band's color and position.
Combined (default) : renders both bands simultaneously. The Bias Band fill and the Divergence Band fill are independent in this mode. Only one line is ever drawn on the chart - the Divergence Band line, which adopts the Bias Band's color when signals are strongly aligned.
Other toggles
Enable Chart Overlay - Master switch for everything drawn on the price chart. Turning this off leaves the sub-pane intact and removes all overlay rendering.
Show Bias Band Line - Toggles the outer line of the Bias Band. Only applies when Band Mode is set to Bias Band; in Combined mode the Divergence Band line covers this role.
Show Bias Band Fill - Toggles the fill between the Bias Band line and its anchor. Fill opacity is zero when bias is within ±20 and ramps to full as bias approaches ±100, so weak signals don't clutter the chart.
Show Divergence Band Line - Toggles the outer line of the Divergence Band. This is the only line that renders in Combined mode.
Show Divergence Band Fill - Toggles the fill between the Divergence Band line and its anchor. Like the Bias Band fill, opacity is gated - it stays invisible until the divergence gap exceeds 20, then ramps proportionally. Suppressed entirely when both signals share the same sign but lack strong conviction.
Show Background Highlight - Tints the chart background green during bullish divergence and red during bearish divergence. Only activates when the gap between the two signals exceeds 50, so it fires on meaningful separations rather than routine noise. Opacity scales with gap size up to a ceiling.
Overlay Smoothing
Smooth Overlay Bands (EMA) (Enabled by default) - Applies an EMA to the four overlay band position values before they are plotted. This reduces bar-to-bar jitter on the chart overlay without touching any of the sub-pane calculations. Flow Momentum, Price Momentum, and the histogram are unaffected.
When the overlay bands aren't smoothed, the response time for divergences is quicker, but the overlay chart is noisy and can produce more false signals.
Smoothing Length - The EMA period applied to the overlay bands when smoothing is enabled. Default is 5. Lower values track price more closely with more noise; higher values produce cleaner bands with more lag. The useful range is roughly 3 to 15 for most instruments and timeframes.
Pine Script®指標






















