Backtesting Arena

Backtesting Arena

OBV-MACD master

OBV-MACD Strategy

Apply MACD logic to On-Balance Volume — combining volume confirmation with trend signals. Volume tells you the truth that price hides.

Quick Facts

Type:
Volume · Trend Following
Plan:
Pro
Asset Classes:
Crypto · Stocks · ETF · Commodities(not Forex)
Indicators:
OBV · MACD

Platform Backtest

CAGR
-4.9%
Win Rate
36%
Max DD
-51%

Default parameters · BTCUSDT · 1d · 4 years · B&H +18.1%

How It Works

On-Balance Volume (OBV) is a cumulative running tally of trading volume: when price closes higher than the previous candle, the day's volume is added; when it closes lower, it's subtracted. The result is a single curve that reflects whether buying or selling pressure dominates over time.

This strategy then applies a MACD-style transformation to the OBV: two EMAs of the OBV are computed (a fast one and a slow one). When the fast EMA crosses above the slow EMA and the slope of the signal line is positive, a buy signal fires. When the cross reverses or slope flips negative, a sell signal fires.

The combined logic gives you two independent confirmations: trend (the EMA cross) and momentum (the slope). Compared to plain MACD on price, this version is grounded in actual volume — meaning fake breakouts on low volume tend to get filtered out before they trigger entries.

Note: This strategy needs more historical data than others (500-candle warmup vs. the standard 200) because the cumulative OBV needs time to stabilise before the EMAs become meaningful.

This is the v2 version, which precisely matches the Pine-script reference implementation and supersedes the original v1 (which had small calculation differences).

Entry & Exit Rules

Entry

  • OBV fast EMA crosses above OBV slow EMA
  • Slope of the signal line is positive
  • Position is currently flat

Exit

  • Fast EMA crosses below slow EMA, OR slope flips negative
  • Position is currently long

Parameters

NameDefaultRangeDescription
OBV EMA Length1150Smoothing applied directly to the OBV before MACD computation. Default 1 = no smoothing.
Fast MA Length9250Fast EMA period applied to OBV. Lower = more reactive.
Slow MA Length265200Slow EMA period — the structural trend reference.
Slope Lookback2120Number of candles for slope calculation on the signal line.

Live Backtest

Strategy CAGR
-4.9%
Buy & Hold CAGR
+18.1%
Trades
125
Win Rate
36%
Y-axis: Equity (USD, $10,000 starting capital)2022-04-28 → 2026-04-27

BTCUSDT · 1d · 4 years · default parameters · refreshed daily

Run with my own parameters →

Pseudo-Code

expand
// Compute OBV
obv = cumulative_sum(
  if close > prev_close: volume
  if close < prev_close: -volume
  else: 0
)

// Apply MACD to OBV
fast_ema = EMA(obv, ma_length)
slow_ema = EMA(obv, slow_length)
signal   = fast_ema - slow_ema
slope    = signal[now] - signal[now - slope_length]

// Entry
if fast_ema crosses_above slow_ema AND slope > 0:
  if position.is_flat:
    BUY

// Exit
if fast_ema crosses_below slow_ema OR slope < 0:
  if position.is_long:
    SELL

Strengths & Weaknesses

Strengths

  • Volume-confirmed signals — filters fake price breakouts
  • Two independent triggers (cross + slope) reduce noise
  • Works particularly well on high-volume liquid assets
  • Pine-precise v2 implementation aligns with TradingView baselines

Weaknesses

  • Doesn't work on Forex (no centralised volume)
  • 500-candle warmup means less usable history vs. 200-candle strategies
  • Volume manipulation/wash-trading on smaller exchanges can distort signals
  • More parameters to tune means easier to overfit

Frequently Asked Questions

What happened to OBV-MACD v1?

v1 had small calculation differences from the Pine reference implementation. We kept v1 in the engine for backward-compatibility with existing run history but disabled it for new backtests in April 2026. v2 is the canonical version going forward — same indicator, more precise math.

Why doesn't this work on Forex?

OBV needs trustworthy volume data, but Forex has no centralised exchange — each broker reports its own volume, and aggregate data is not reliable. Stick to crypto, stocks, ETFs, and commodity ETFs where exchange volume is meaningful.

What's the deal with the 500-candle warmup?

OBV is cumulative — it has no fixed scale. The first values are arbitrary baselines. EMAs need enough history for the cumulative OBV to be meaningful. We use 500 candles before the trading start date to ensure stable values; this means the strategy needs ~1.5 years of pre-history on daily charts.

Related Strategies

Don't want to backtest yourself?

Check out our Strategy Insights Reports — pre-baked deep-dives with historical results, comparisons, and market context.

📊 View Reports →

Ready to backtest?

Open the Arena →