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提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。