OPEN-SOURCE SCRIPT
Bull-Bear Efficiency

Bull-Bear Efficiency
This indicator measures the directional efficiency of price movement across many historical entry points to estimate overall market bias. It is designed as a trend gauge rather than a timing signal.
Concept
For each historical bar (tau) and a chosen lookahead horizon (h), the script evaluates how efficiently price has traveled from that starting point to the endpoint. Efficiency is defined as the net price change divided by the total absolute movement that occurred along the path.
Formula:
E(tau,h) = ( Price[tau + h] - Price[tau] ) / ( Sum from i = tau+1 to tau+h of | Price - Price[i-1] | )
This measures how "straight" the path was from the entry to the current bar:
If price moved steadily upward, the numerator and denominator are nearly equal, and E approaches +1 (efficient bullish trend).
If price moved steadily downward, E approaches -1 (efficient bearish trend).
If price chopped back and forth, the denominator grows faster than the numerator, and E approaches 0 (inefficient movement).
The algorithm computes this efficiency for many past starting points and multiple horizons, optionally normalizing by ATR to account for volatility. The efficiencies are then weighted by recency to emphasize more recent behavior.
From this, the script derives:
Bull = weighted average of positive efficiencies
Bear = weighted average of negative efficiencies (absolute value)
Net = Bull - Bear (net directional efficiency)
Interpretation
Bull, Bear, and Net quantify how coherently the market has been trending.
Bull near 1.0, Bear near 0.0, Net > 0 -> clean upward trends; long positions have been more efficient.
Bear near 1.0, Bull near 0.0, Net < 0 -> clean downward trends; short positions have been more efficient.
Bull and Bear both small or similar -> low-efficiency, range-bound environment.
Net therefore acts as a "trend coherence index" that measures whether price action is directionally organized or noisy.
Practical Use
Trend filter:
Apply trend-following systems only when Net is strongly positive or negative.
Avoid them when Net is near zero.
Regime change detection:
Crossings through zero often correspond to transitions between trending and ranging regimes.
Momentum loss detection:
If price makes new highs but Net or Bull weakens, it suggests trend exhaustion.
Settings Overview
Lookback: Number of historical bars considered as entry points (tau values).
Horizons: List of forward projection lengths (in bars) for measuring efficiency.
Recency Decay (lambda): Exponential weighting that emphasizes recent data.
Normalize by ATR: Adjusts "effort" to account for volatility changes.
Display Options: Toggle Bull, Bear, Net, or Signed Average (S). Customize line colors.
Notes
This indicator does not produce entry or exit signals.
It is a statistical tool that measures how efficiently price has trended over time.
High Net values indicate smooth, coherent trends.
Low or neutral Net values indicate noisy, directionless conditions.
This indicator measures the directional efficiency of price movement across many historical entry points to estimate overall market bias. It is designed as a trend gauge rather than a timing signal.
Concept
For each historical bar (tau) and a chosen lookahead horizon (h), the script evaluates how efficiently price has traveled from that starting point to the endpoint. Efficiency is defined as the net price change divided by the total absolute movement that occurred along the path.
Formula:
E(tau,h) = ( Price[tau + h] - Price[tau] ) / ( Sum from i = tau+1 to tau+h of | Price - Price[i-1] | )
This measures how "straight" the path was from the entry to the current bar:
If price moved steadily upward, the numerator and denominator are nearly equal, and E approaches +1 (efficient bullish trend).
If price moved steadily downward, E approaches -1 (efficient bearish trend).
If price chopped back and forth, the denominator grows faster than the numerator, and E approaches 0 (inefficient movement).
The algorithm computes this efficiency for many past starting points and multiple horizons, optionally normalizing by ATR to account for volatility. The efficiencies are then weighted by recency to emphasize more recent behavior.
From this, the script derives:
Bull = weighted average of positive efficiencies
Bear = weighted average of negative efficiencies (absolute value)
Net = Bull - Bear (net directional efficiency)
Interpretation
Bull, Bear, and Net quantify how coherently the market has been trending.
Bull near 1.0, Bear near 0.0, Net > 0 -> clean upward trends; long positions have been more efficient.
Bear near 1.0, Bull near 0.0, Net < 0 -> clean downward trends; short positions have been more efficient.
Bull and Bear both small or similar -> low-efficiency, range-bound environment.
Net therefore acts as a "trend coherence index" that measures whether price action is directionally organized or noisy.
Practical Use
Trend filter:
Apply trend-following systems only when Net is strongly positive or negative.
Avoid them when Net is near zero.
Regime change detection:
Crossings through zero often correspond to transitions between trending and ranging regimes.
Momentum loss detection:
If price makes new highs but Net or Bull weakens, it suggests trend exhaustion.
Settings Overview
Lookback: Number of historical bars considered as entry points (tau values).
Horizons: List of forward projection lengths (in bars) for measuring efficiency.
Recency Decay (lambda): Exponential weighting that emphasizes recent data.
Normalize by ATR: Adjusts "effort" to account for volatility changes.
Display Options: Toggle Bull, Bear, Net, or Signed Average (S). Customize line colors.
Notes
This indicator does not produce entry or exit signals.
It is a statistical tool that measures how efficiently price has trended over time.
High Net values indicate smooth, coherent trends.
Low or neutral Net values indicate noisy, directionless conditions.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。