PROTECTED SOURCE SCRIPT
Orderflow Bias Premium v2 [Pro+]

Orderflow Bias Premium v2 [Pro+] is a dynamic Pine v6 indicator designed to identify periods of consolidation (choppy) markets versus expansion (trending) markets using a blend of volatility, volume, and market structure. When markets shift into expansion, the script computes a composite directional bias (“Bullish”, “Bearish”, or “Neutral”) along with a trend strength metric. In consolidation, it tracks how long price remains choppy, displaying elapsed minutes. All information is presented in a floating table at the top-right of the chart for instant visual clarity - with each field toggleable on / off by the user.
Key Terms and Definitions
Consolidation: A market regime where price action is confined within narrow Bollinger Band widths, low ATR/price ratios, and subdued volume—signaling uncertainty or indecision.
Expansion: A market regime where volatility, ATR, or volume “break out” of low percentile thresholds, suggesting a trending move.
Bollinger Band Width (BBW): The normalized distance between the upper and lower Bollinger Bands, calculated as (upper – lower) / basis. Used here to detect when volatility is suppressed.
ATR/Price Ratio: The average true range (ATR) divided by the current close, normalized as a percentage. A lower ratio indicates tighter price action.
Volume Ratio (VR): Current volume divided by its moving average; when VR is below a historical percentile, volume is considered “low.”
Percentile Test: For each metric (BBW, ATR/price, VR), we compute the current value’s rank (e.g., 20th percentile) over a look-back window. If the current value is below that percentile (after applying any intraday multipliers), it counts as “low.”
Imbalance (3-Bar Gap): A price pattern where, two bars ago, the high is lower than the current bar’s low (bullish imbalance) or the low is higher than the current bar’s high (bearish imbalance). The script tracks whether any such gap has formed in a higher timeframe to seed directional memory.
Directional Bias: When in expansion, three methods vote on market direction: (1) DMI spread, (3) impulse-bar majority, and (4) last imbalance direction. The summed votes determine “Bullish”, “Bearish”, or “Neutral.”
Hysteresis (Bars to Flip State): The number of consecutive bars required for a new regime (consolidation ↔ expansion) to be confirmed. This prevents false flips from single-bar noise.
Key Features
Dynamic Regime Detection
Intuitive Chop Enhancements
Real-Time Table Display
How Traders Can Use the Indicator Effectively
Timing Breakouts
Filtering Noise on Lower TFs
Directional Confirmation
Combining with Other Tools
USER TOGGLEABLE INPUTS
Show State
Show Strength
Show OrderFlow Bias
Bars to Flip State
Enable BBW Percentile Test
BB Length
BB StdDev Mult
BBW Look-back
BBW Percentile
Enable ATR Percentile Test
ATR Length
ATR Look-back
ATR Percentile
Enable Volume Percentile Test
Volume MA Length
Vol Percentile
Vol Factor (fallback)
Enable Intraday Multipliers
BBW Open/Power Mult
ATR Open/Power Mult
BBW Lunch Mult
ATR Lunch Mult
Enable Higher TF Filter
Higher-TF Multiplier
Show ADX Strength
ADX Length
Table Opacity %
DI Spread Threshold
Impulse Window Size
Enable Bar Range Test
Range Test N Bars
Range Test ATR Mult
Enable ADX Test
ADX Threshold
Enable RSI Flat Test
RSI Length
RSI Range N Bars
RSI Range Threshold
Enable SMA Deviation Test
SMA Length
Dev Test ATR Length
Dev Threshold (ATR units)
Enable TF1
Timeframe 1
Lookback Timeframe
Bars 1
Terms and Conditions
Informational Purposes Only: OrderFlow Bias v2 Premium [Pro+] is provided without any guarantees. It is not financial advice, nor does it predict market movements. Users assume full responsibility for any trading decisions made.
No Liability: By using this indicator, you acknowledge that neither the script’s author nor TradingView is liable for losses arising from its use. Past performance is not indicative of future results.
Licensing: This script is published as closed-source (protected). Its Pine code is hidden from view and may not be forked, modified, or redistributed without express permission from the author. Protected scripts on TradingView require a Pro, Pro+, or Premium account to publish and remain accessible only to invited users; all usage rights and access control are governed by the author’s invite settings.
Disclaimer
The information and code in OrderFlow Bias v2 Premium [Pro+] are provided “as is” for educational and analytical purposes only. They do not constitute any investment, trading, or financial advice. Users should conduct their own due diligence and seek professional counsel before making trading decisions. The author and TradingView disclaim all liability for actions based on this information.
Key Terms and Definitions
Consolidation: A market regime where price action is confined within narrow Bollinger Band widths, low ATR/price ratios, and subdued volume—signaling uncertainty or indecision.
Expansion: A market regime where volatility, ATR, or volume “break out” of low percentile thresholds, suggesting a trending move.
Bollinger Band Width (BBW): The normalized distance between the upper and lower Bollinger Bands, calculated as (upper – lower) / basis. Used here to detect when volatility is suppressed.
ATR/Price Ratio: The average true range (ATR) divided by the current close, normalized as a percentage. A lower ratio indicates tighter price action.
Volume Ratio (VR): Current volume divided by its moving average; when VR is below a historical percentile, volume is considered “low.”
Percentile Test: For each metric (BBW, ATR/price, VR), we compute the current value’s rank (e.g., 20th percentile) over a look-back window. If the current value is below that percentile (after applying any intraday multipliers), it counts as “low.”
Imbalance (3-Bar Gap): A price pattern where, two bars ago, the high is lower than the current bar’s low (bullish imbalance) or the low is higher than the current bar’s high (bearish imbalance). The script tracks whether any such gap has formed in a higher timeframe to seed directional memory.
Directional Bias: When in expansion, three methods vote on market direction: (1) DMI spread, (3) impulse-bar majority, and (4) last imbalance direction. The summed votes determine “Bullish”, “Bearish”, or “Neutral.”
Hysteresis (Bars to Flip State): The number of consecutive bars required for a new regime (consolidation ↔ expansion) to be confirmed. This prevents false flips from single-bar noise.
Key Features
Dynamic Regime Detection
- Combines BBW, ATR/price, and volume percentile tests to detect low-volatility consolidation vs. breakouts.
- Supports optional intraday multipliers to scale thresholds during open (09:30–10:15), lunch (11:45–13:30), and power hour (15:30–16:00).
- Optional higher-timeframe filter (current TF × user-defined multiplier) ensures false consolidations are avoided when the next larger TF is still trending.
Intuitive Chop Enhancements
- N-Bar Range Test: Flags chop if (highest high – lowest low) over N bars < ATR×multiplier.
- ADX Test: Considers ADX < user threshold as choppy.
- RSI Flat Test: Marks chop if RSI range over N bars < threshold.
- SMA Deviation Test: Detects chop if |price – SMA| (normalized by ATR) < threshold.
- Composite Directional Bias (Expansion Only)
- Method 1: DMI spread vote (+DI vs. –DI).
- Method 2: Impulse-bar majority over a rolling window.
- Method 3:Memory of last 3-bar imbalance on a user-specified higher TF.
- Strength Metric:ADX normalized to percentage + textual category (Low/Moderate/High/Very High) indicates trend momentum.
Real-Time Table Display
- 2-column, 3-row floating table at top-right.
How Traders Can Use the Indicator Effectively
Timing Breakouts
- While price remains in consolidation, the elapsed timer can reveal when an extended chop may soon resolve—enabling traders to anticipate breakouts.
Filtering Noise on Lower TFs
- By enabling the higher-TF filter (e.g., 5 min chart screening 15 min chop), intraday traders can avoid false expansion signals caused by micro-noise.
Directional Confirmation
- In expansion mode, seeing “Orderflow: Bullish” + “Strength: High” can be used as confluence alongside price-action entries or trendline breaks.
Combining with Other Tools
- Pair with volume profile, market structure (swing highs/lows), or momentum oscillators for multi-dimensional confirmation before taking a trade.
USER TOGGLEABLE INPUTS
Show State
- Toggles displaying the “State:” row (Consolidation vs. Expansion) in the table.
Show Strength
- Toggles displaying the ADX-based strength (or, in consolidation, elapsed time) row in the table.
Show OrderFlow Bias
- Toggles displaying the “Orderflow” (directional bias) row (or “Bias: Neutral” in consolidation).
Bars to Flip State
- Number of consecutive bars required before switching between “Consolidation” and “Expansion.”
Enable BBW Percentile Test
- Toggles whether Bollinger-Band-width percentile checks count toward identifying consolidation.
BB Length
- Look-back length (in bars) for computing the Bollinger Band’s SMA/standard deviation.
BB StdDev Mult
- Multiplier on the Bollinger Band’s standard deviation when calculating bandwidth.
BBW Look-back
- Number of bars over which to compute the rolling percentile of BB width.
BBW Percentile
- Percentile threshold for BB width to be considered “low” (choppy).
Enable ATR Percentile Test
- Toggles whether the ATR/price-ratio percentile check counts toward consolidation.
ATR Length
- Look-back length (in bars) for calculating ATR.
ATR Look-back
- Number of bars over which to compute the rolling percentile of ATR/price.
ATR Percentile
- Percentile threshold for ATR/price ratio to be considered “low.”
Enable Volume Percentile Test
- Toggles whether volume percentile checks count toward consolidation.
Volume MA Length
- Look-back length (in bars) for computing the moving average of volume.
Vol Percentile
- Percentile threshold for current volume (relative to its MA) to be considered “low.”
Vol Factor (fallback)
- Multiplier applied to the volume percentile threshold if the primary percentile test fails.
Enable Intraday Multipliers
- Toggles whether open/lunch/power-hour scaling factors apply to BBW/ATR tests.
BBW Open/Power Mult
- Multiplier on BB width threshold during market open (09:30–10:15) and power hour (15:30–16:00).
ATR Open/Power Mult
- Multiplier on ATR threshold during market open and power hour.
BBW Lunch Mult
- Multiplier on BB width threshold during the lunch lull (11:45–13:30).
ATR Lunch Mult
- Multiplier on ATR threshold during the lunch lull.
Enable Higher TF Filter
- Toggles checking the BBW/ATR/Vol tests on a higher timeframe before allowing consolidation.
Higher-TF Multiplier
- Integer factor by which to multiply the current timeframe (e.g., 5 min × 3 = 15 min) for higher-TF checks.
Show ADX Strength
- Toggles whether ADX is used to compute and display the “Strength” metric when expanding.
ADX Length
- Look-back length (in bars) for computing DMI/ADX.
Table Opacity %
- Opacity (0–100) of the floating table’s background.
DI Spread Threshold
- Minimum difference between +DI and −DI needed to cast a bullish or bearish vote in directional bias.
Impulse Window Size
- Number of bars over which to count “impulse bars” (close in top 40 % vs. bottom 40 %) for directional voting.
Enable Bar Range Test
- Toggles checking if the N-bar high–low range is unusually narrow (another chop criterion).
Range Test N Bars
- Look-back period (in bars) for computing the highest high minus lowest low for the range test.
Range Test ATR Mult
- Multiplier on the average ATR when comparing against the N-bar range.
Enable ADX Test
- Toggles marking “choppy” if ADX is below the user-defined threshold.
ADX Threshold
- ADX value below which the market is considered non-trending (choppy).
Enable RSI Flat Test
- Toggles checking whether RSI has been stuck in a tight range (another chop signal).
RSI Length
- Look-back length (in bars) for computing standard RSI.
RSI Range N Bars
- Look-back period (in bars) for computing RSI’s highest minus lowest.
RSI Range Threshold
- Maximum RSI range over the look-back period to qualify as “flat.”
Enable SMA Deviation Test
- Toggles checking if price is “near” its SMA (another chop heuristic).
SMA Length
- Look-back length (in bars) for computing the simple moving average (SMA).
Dev Test ATR Length
- Look-back length (in bars) for ATR when normalizing deviation from the SMA.
Dev Threshold (ATR units)
- Maximum (|price − SMA| / ATR) allowed to count as “near” the SMA.
Enable TF1
- Toggles the higher-timeframe imbalance logic on or off.
Timeframe 1
- Base resolution (e.g., “1” = 1 minute) used for detecting 3-bar imbalances.
Lookback Timeframe
- Higher timeframe (e.g., “15” = 15 minutes) used to compute how many base-resolution bars to look back.
Bars 1
- (Calculated internally) Number of base-timeframe bars contained within one lookback-timeframe bar.
Terms and Conditions
Informational Purposes Only: OrderFlow Bias v2 Premium [Pro+] is provided without any guarantees. It is not financial advice, nor does it predict market movements. Users assume full responsibility for any trading decisions made.
No Liability: By using this indicator, you acknowledge that neither the script’s author nor TradingView is liable for losses arising from its use. Past performance is not indicative of future results.
Licensing: This script is published as closed-source (protected). Its Pine code is hidden from view and may not be forked, modified, or redistributed without express permission from the author. Protected scripts on TradingView require a Pro, Pro+, or Premium account to publish and remain accessible only to invited users; all usage rights and access control are governed by the author’s invite settings.
Disclaimer
The information and code in OrderFlow Bias v2 Premium [Pro+] are provided “as is” for educational and analytical purposes only. They do not constitute any investment, trading, or financial advice. Users should conduct their own due diligence and seek professional counsel before making trading decisions. The author and TradingView disclaim all liability for actions based on this information.
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。