OPEN-SOURCE SCRIPT
Order Flow OBV MACD

Overview
Order Flow OBV MACD is an open-source oscillator that extends the classic OBV-style MACD idea with Pine Script v6 order-flow tools. It can run from a traditional OBV-style cumulative volume source or from CVD built with TradingView footprint delta. The script then transforms that cumulative flow into a MACD-style oscillator, applies a T-channel style direction line, and adds an adaptive confidence score that weighs recent signal components by how well they have aligned with price direction.
This is not a strategy and it does not place trades. It is intended as a market structure and confirmation tool for studying momentum, volume flow, and order-flow agreement.
What Makes It Different
The indicator combines four layers:
The goal is not to predict the future or claim a fixed win rate. The goal is to show when several volume and order-flow components are aligned, conflicting, or neutral.
How It Works
1. Cumulative Volume Source
The script starts by building a cumulative flow series.
OBV mode is broadly compatible. CVD mode uses TradingView's `request.footprint()` data, so footprint availability and account plan support matter.
2. Footprint-Adjusted CVD
When CVD Mode is set to Footprint-adjusted, the raw delta can be boosted or softened by row-level footprint context:
If delta and footprint context agree, delta can be strengthened. If they conflict, delta can be reduced. The Footprint Row Influence setting controls how strong this adjustment is.
3. MACD Layer
The selected cumulative flow source is normalized through the original OBV-MACD style transformation and smoothed. The script then compares the transformed fast order-flow line against a slow EMA-based MACD leg.
The slow MACD leg can optionally adapt based on the previous bar's adaptive confidence. Strong confidence makes it more responsive. Weak confidence makes it smoother. This uses the prior bar's score to avoid circular logic.
4. T-Channel Direction Line
The main plotted blue/red line is a channel-style directional line based on the slope of the MACD output. Blue indicates positive channel direction and red indicates negative channel direction. Optional cross markers can show direction changes.
5. Adaptive Confidence
The Adaptive Confidence plot is a centered score:
The score weighs four components:
Each component receives an adaptive reliability weight based on how well its previous signal aligned with the current bar's price direction over the selected lookback.
Key Inputs
Cumulative Volume Source
Choose OBV for classic compatibility or CVD for footprint delta-based flow.
CVD Mode
Raw delta uses footprint delta directly. Footprint-adjusted adds row-level POC, Value Area, and imbalance context.
Footprint Ticks Per Row
Controls the price height of each footprint row. Lower values create finer detail. Higher values smooth noisy row behavior.
Footprint Value Area %
Controls the amount of volume used to define the footprint Value Area. 70 is a common default.
Footprint Imbalance %
Controls how strong a row imbalance must be before it is considered meaningful. Higher values are stricter.
Footprint Row Influence %
Controls how much row-level footprint context can adjust bar delta in Footprint-adjusted mode.
Adaptive Weight Lookback
Controls how quickly component weights adapt. Shorter values react faster but can be noisy. Longer values are smoother.
Adapt MACD With Confidence
When enabled, the slow MACD leg adjusts using the previous bar's adaptive confidence. Disable it to keep the MACD closer to classic fixed-length behavior.
Suggested Use
Limitations
Credits
This script builds on an OBV MACD concept and includes a T-channel style directional component inspired by Alex Grover's T-Channels work. The v6 version extends the idea with footprint delta, CVD, row-level footprint context, adaptive confidence scoring, and optional confidence-adjusted MACD smoothing.
Disclaimer
This script is for educational and analytical use only. It is not financial advice, investment advice, or a recommendation to buy or sell any asset. Always test settings on your own symbol and timeframe, and use independent risk management.
Order Flow OBV MACD is an open-source oscillator that extends the classic OBV-style MACD idea with Pine Script v6 order-flow tools. It can run from a traditional OBV-style cumulative volume source or from CVD built with TradingView footprint delta. The script then transforms that cumulative flow into a MACD-style oscillator, applies a T-channel style direction line, and adds an adaptive confidence score that weighs recent signal components by how well they have aligned with price direction.
This is not a strategy and it does not place trades. It is intended as a market structure and confirmation tool for studying momentum, volume flow, and order-flow agreement.
What Makes It Different
The indicator combines four layers:
- A selectable cumulative volume engine: OBV-style signed volume or CVD from footprint delta.
- Optional footprint-adjusted CVD using Point of Control, Value Area, and POC row imbalance context.
- A MACD-style oscillator derived from the transformed cumulative flow.
- An adaptive confidence score that estimates bullish/bearish agreement from MACD direction, channel direction, delta direction, and footprint bias.
The goal is not to predict the future or claim a fixed win rate. The goal is to show when several volume and order-flow components are aligned, conflicting, or neutral.
How It Works
1. Cumulative Volume Source
The script starts by building a cumulative flow series.
- OBV mode uses close direction multiplied by volume, then cumulates it.
- CVD mode uses footprint delta, which is buy volume minus sell volume for the bar, then cumulates it.
OBV mode is broadly compatible. CVD mode uses TradingView's `request.footprint()` data, so footprint availability and account plan support matter.
2. Footprint-Adjusted CVD
When CVD Mode is set to Footprint-adjusted, the raw delta can be boosted or softened by row-level footprint context:
- Price relative to the footprint Point of Control row.
- Price relative to Value Area High and Value Area Low.
- Buy or sell imbalance on the POC row.
If delta and footprint context agree, delta can be strengthened. If they conflict, delta can be reduced. The Footprint Row Influence setting controls how strong this adjustment is.
3. MACD Layer
The selected cumulative flow source is normalized through the original OBV-MACD style transformation and smoothed. The script then compares the transformed fast order-flow line against a slow EMA-based MACD leg.
The slow MACD leg can optionally adapt based on the previous bar's adaptive confidence. Strong confidence makes it more responsive. Weak confidence makes it smoother. This uses the prior bar's score to avoid circular logic.
4. T-Channel Direction Line
The main plotted blue/red line is a channel-style directional line based on the slope of the MACD output. Blue indicates positive channel direction and red indicates negative channel direction. Optional cross markers can show direction changes.
5. Adaptive Confidence
The Adaptive Confidence plot is a centered score:
- Above 0 favors bullish agreement.
- Below 0 favors bearish agreement.
- +25 and -25 are guide levels for stronger directional confidence.
The score weighs four components:
- MACD direction.
- T-channel direction.
- Delta/CVD direction.
- Footprint bias.
Each component receives an adaptive reliability weight based on how well its previous signal aligned with the current bar's price direction over the selected lookback.
Key Inputs
Cumulative Volume Source
Choose OBV for classic compatibility or CVD for footprint delta-based flow.
CVD Mode
Raw delta uses footprint delta directly. Footprint-adjusted adds row-level POC, Value Area, and imbalance context.
Footprint Ticks Per Row
Controls the price height of each footprint row. Lower values create finer detail. Higher values smooth noisy row behavior.
Footprint Value Area %
Controls the amount of volume used to define the footprint Value Area. 70 is a common default.
Footprint Imbalance %
Controls how strong a row imbalance must be before it is considered meaningful. Higher values are stricter.
Footprint Row Influence %
Controls how much row-level footprint context can adjust bar delta in Footprint-adjusted mode.
Adaptive Weight Lookback
Controls how quickly component weights adapt. Shorter values react faster but can be noisy. Longer values are smoother.
Adapt MACD With Confidence
When enabled, the slow MACD leg adjusts using the previous bar's adaptive confidence. Disable it to keep the MACD closer to classic fixed-length behavior.
Suggested Use
- Look for stronger bullish conditions when the channel is blue, the confidence score is above zero, and CVD/footprint settings support the move.
- Look for stronger bearish conditions when the channel is red, the confidence score is below zero, and delta/footprint context agrees.
- Treat low or mixed confidence as a warning that the components are not aligned.
- Use the indicator with price structure, support/resistance, market context, and risk management. Do not use it as a standalone trading system.
Limitations
- This is an indicator, not a strategy.
- It does not guarantee accuracy, profitability, or future performance.
- CVD and footprint-adjusted features depend on TradingView footprint data availability.
- TradingView states that scripts using `request.footprint()` require Premium or Ultimate access.
- The adaptive confidence score is a heuristic based on recent alignment, not machine learning training.
- Like any oscillator, it can lag, whipsaw, or conflict with price during chop, news events, thin liquidity, or unusual volume conditions.
Credits
This script builds on an OBV MACD concept and includes a T-channel style directional component inspired by Alex Grover's T-Channels work. The v6 version extends the idea with footprint delta, CVD, row-level footprint context, adaptive confidence scoring, and optional confidence-adjusted MACD smoothing.
Disclaimer
This script is for educational and analytical use only. It is not financial advice, investment advice, or a recommendation to buy or sell any asset. Always test settings on your own symbol and timeframe, and use independent risk management.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
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.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
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.