Elder Ray indicator: Bull Bear Power formulas and limits
The Elder Ray indicator compares each bar's high and low with an exponential moving average. Bull Power is the high minus that EMA; Bear Power is the low minus it. TradingView's combined BBP adds the two readings. These are price distances, not percentages or measured buying and selling volume.
The worked examples and Pine Script below let you inspect both components, switch to the combined histogram, and check a confirmed-bar trend filter. A positive sum alone is not a complete trading rule.
Two components, one optional sum
Alexander Elder developed the Bull Power and Bear Power oscillators. MetaTrader's documentation describes them separately, with a moving average supplying trend context. TradingView's built-in BBP combines them and uses a 13-bar EMA of closing prices by default. TradingView documents the combined calculation.
EMA = EMA(close, length)
Bull Power = high − EMA
Bear Power = low − EMA
Combined BBP = high + low − 2 × EMA
All three outputs retain the chart's price unit. They have no fixed upper or lower bound. For a valid OHLC bar, Bull Power is always at least Bear Power, since their difference equals high minus low. They can both be positive or both negative.
The combined zero line has a precise meaning: BBP = 2 × (hl2 − EMA). Cancellation occurs when the candle midpoint equals the EMA, even with a wide candle range. A Bull Power zero instead means high equals EMA; a Bear Power zero means low equals EMA.
Worked example: identical reference, different readings
These are three independent hypothetical snapshots, not consecutive bars or market observations. Each starts with an already initialized previous EMA of 100. With length 13, the smoothing factor is 2 / 14 = 1 / 7. The current EMA is previous EMA + (close − previous EMA) / 7.
| Case | Previous EMA | Close | High | Low | EMA | Bull | Bear | Sum |
|---|---|---|---|---|---|---|---|---|
| A: cancellation | 100 | 100 | 104 | 96 | 100 | +4 | −4 | 0 |
| B: rising EMA | 100 | 107 | 109 | 99 | 101 | +8 | −2 | +6 |
| C: falling EMA | 100 | 93 | 101 | 91 | 99 | +2 | −8 | −6 |
Case A cancels: +4 + (−4) = 0, but its range is 8. In B, EMA rises to 101 and Bear Power is −2. If the prior Bear Power was −4, the low remains below the reference while its distance has narrowed. The illustrative long filter accepts this closed bar. If prior Bear Power was −1, it rejects it despite the same +6 combined reading.
Case C reverses the logic. EMA falls to 99. Given prior Bull Power of +4, the current +2 is positive and falling, so the short filter accepts the closed bar. A flat EMA, as in A, satisfies neither directional filter.
Pine Script v6: inspect components and combined BBP
Paste the complete indicator into TradingView's Pine Editor and add it to a chart. The default display has two lines. The toggle switches to the combined histogram used by the original version of this page. Both modes calculate the same components; changing the view does not change the setup rules.
// This source code is subject to the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify
//@version=6
indicator("Elder Ray: components and combined BBP", overlay=false)
length = input.int(13, "EMA length", minval=1)
showCombined = input.bool(false, "Show combined BBP instead of components")
basis = ta.ema(close, length)
bullPower = high - basis
bearPower = low - basis
bbp = bullPower + bearPower
// Illustrative one-bar trend filter; these are states, not trade orders.
longSetup = barstate.isconfirmed and basis > basis[1] and bearPower < 0 and bearPower > bearPower[1]
shortSetup = barstate.isconfirmed and basis < basis[1] and bullPower > 0 and bullPower < bullPower[1]
plot(showCombined ? na : bullPower, "Bull Power", color=color.teal, linewidth=2)
plot(showCombined ? na : bearPower, "Bear Power", color=color.red, linewidth=2)
plot(showCombined ? bbp : na, "Combined BBP", color=bbp >= 0 ? color.teal : color.red, style=plot.style_columns)
plot(basis, "EMA of close", display=display.data_window)
hline(0, "Zero", color=color.gray)
plotshape(longSetup, "Long setup state", shape.triangleup, location.bottom, color.teal, size=size.tiny)
plotshape(shortSetup, "Short setup state", shape.triangledown, location.top, color.red, size=size.tiny)
alertcondition(longSetup, "Elder Ray long setup", "Closed bar: EMA rising, Bear Power negative and rising.")
alertcondition(shortSetup, "Elder Ray short setup", "Closed bar: EMA falling, Bull Power positive and falling.")- Teal line: Bull Power. Red line: Bear Power. Their colors identify the series, regardless of sign.
- Combined histogram: teal at or above zero, red below zero. Its color describes sign, not whether BBP rose from the previous bar.
- Triangles: every confirmed bar satisfying the illustrated long or short setup. They can repeat on consecutive bars.
- Data Window: the current EMA of close. Add an EMA with the same length and close source to the price chart for visual comparison.
Create an alert using one of the named conditions and select Once Per Bar Close. Plots still update during an open candle; the setup conditions wait for barstate.isconfirmed. The code places no orders and defines no exits.
Inputs and the trend-filter contract
| Setting | Value | Effect |
|---|---|---|
| EMA length | 13, minimum 1 | Changes the reference used by both components and the trend filter. |
| Combined view | Off | Replaces the two component lines with their sum. |
| EMA source | close, fixed in code | Changing to hl2 or another source changes the calculation. |
| Trend comparison | Current vs previous EMA | One-bar slope on the chart timeframe; not a higher-timeframe trend. |
MetaTrader documents a rising trend with negative but rising Bear Power as a long condition, and the opposite pattern in Bull Power for shorts. Here, trend means a strict one-bar change in the same EMA. That is an explicit teaching choice, not a claim to reproduce every rule in Elder's trading system.
For a long setup, require EMA > prior EMA, Bear Power < 0, and Bear Power > prior Bear Power. For a short setup, require EMA < prior EMA, Bull Power > 0, and Bull Power < prior Bull Power. Evaluate all conditions on the same closed bar. Neither rule requires the combined BBP to cross zero.
With length 1, the EMA equals close: Bull Power becomes high − close and Bear Power becomes low − close. That edge case is useful for checking arithmetic, but changes the reference substantially. No best timeframe or length is established here.
Limits to check before defining a strategy
- Keep the components when your rule depends on one extreme. A sum loses information: +8 and −2, or +10 and −4, both produce +6.
- Use matching symbol, session, timeframe, chart type and available history. Synthetic candles change the OHLC inputs; different EMA initialization histories can affect early values.
- Specify the signal time. The current high, low and close can change while a candle forms. A confirmed-bar condition does not provide an intrabar entry price.
- Do not copy absolute thresholds between markets. A value of +2 has a different scale on a low-priced stock and a high-priced instrument.
- Separate a setup from an executed trade. A backtest still needs entry timing, exits, sizing, commission and slippage. Consecutive setup bars need an explicit repeat-entry policy.
Elder Ray versus Balance of Power
Balance of Power uses (close − open) / (high − low). It is a candle-body-to-range ratio. Elder Ray uses EMA-relative price distances and does not require open or volume. A shared power label does not make these indicators interchangeable. RSI is also on a different scale: a BBP value of 70 is not an RSI overbought level.
Educational calculation examples, not investment advice. No performance, accuracy or return claim is made for the setup filters.
Turn the specification into a checkable Pineify script
Give the Pine Script AI Coding Agent the EMA source and length, component or combined display, exact filter comparisons, and confirmation time. Ask it to expose the EMA and both components before adding strategy orders.
- Start with close and length 13 to match this baseline.
- Choose separate lines or the combined sum explicitly.
- Specify whether a setup should repeat or trigger only on its first qualifying bar.
- Compare values bar by bar in TradingView's Data Window.
- Define exits, costs and execution assumptions separately before evaluating a strategy.
Elder Ray and BBP questions
Sources and further checks
Official references checked October 17, 2026. The numeric table is an original illustration.