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.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.