maybeOBV

Pivot-Confirmed Divergence Detection → TradingView Screener → Strategy Calibration

maybeOBV Scanner

Filter Legend
Filters
cap>$2BMarket cap over $2B
USAUS-listed only
1M+Volume > 1M/day
2M+Volume > 2M/day
Signals
D / W / MDaily / Weekly / Monthly
Bullish divergence
Bearish divergence
Div + pattern + vol = highest
Patterns (Finviz)
DB DT MB MT C▲ C▼ W▲ W▼ T▲ T▼ SR
Universe: Live Triggers: History: Starred:

Live Triggers

Loading triggers...

Detection History

No history

Universe

Loading universe...
How to run manually
python3 src/screener/scan_lite.py [--preset broad|accumulation|unusual_vol]

Cron runs automatically at 6am weekdays. Results appear here on next refresh.

maybeOBV

What is this?

A scanner that detects when smart money is quietly buying or selling before the price moves. It watches volume flow (OBV) and compares it to price action. When they disagree — that's a divergence, and it often predicts the next move.

Key Concepts

OBV (On-Balance Volume)
A running total of volume. When price closes up, that bar's volume is added. When price closes down, it's subtracted. The result is a line that shows where money is flowing — up means buyers are in control, down means sellers.
Divergence
When price and OBV disagree. If price makes a lower low but OBV makes a higher low, buyers are accumulating even though price looks weak — that's a bullish signal. The reverse (price higher high, OBV lower high) means distribution — bearish.
Pivot
A confirmed swing point — a low that has higher bars on both sides, or a high with lower bars on both sides. The indicator waits for this confirmation before drawing anything. A pivot length of 2 means it needs 2 bars on each side to confirm.

Detection Layers

Layer 1: Pivot-Confirmed Divergence

The core signal. Finds moments where price is making new lows but volume flow (OBV) is actually rising — meaning institutions are buying into the weakness. Or the reverse: price making new highs while OBV drops — institutions selling into strength.

Only triggers when both price AND OBV have confirmed swing points (pivots). This eliminates noise and false signals.

Layer 2: OBV Trendline Break

Momentum confirmation. When OBV breaks above its recent high or below its recent low, it confirms the direction of money flow. Think of it as OBV "breaking out" before price does.

Layer 3: Effort Candles

Spotting big-player activity. A candle with huge volume but a tiny body means someone moved a lot of money but price barely budged — that's absorption (a wall of buying or selling). A big body + big volume = a sponsored, intentional move.

Layer 4: OBV Slope Divergence

Speed comparison. Measures how fast OBV is changing vs how fast price is changing. When OBV is moving faster than price (leading), it hints at what's coming next. Green background = OBV leading up. Red = OBV leading down.

Layer 5: Range Pattern Detection

Context awareness. Automatically detects when price is stuck in a range (double bottom, wedge, triangle, channel). Divergences inside a range are the highest-conviction setups because the range is about to break.

Labels: DB = Double Bottom, DT = Double Top, T▲ = Ascending Triangle, W▼ = Descending Wedge, SR = Support/Resistance

Layer 6: Context Readiness Score (0-100)

Setup quality meter. Scores how "ready" a setup is based on 5 factors: Is volume declining? (institutions accumulating quietly) Is the range tightening? Does OBV disagree with price? Is the weekly trend aligned? Are there absorption candles? Higher score = higher conviction.

MTF: Multi-Timeframe

See the big picture. When you're on a 4-hour chart, the indicator still shows you Daily, Weekly, and Monthly divergences as overlay lines. A divergence on a higher timeframe is a stronger signal than one on a lower timeframe.

Inputs Reference

Input Default Range What it does
Pivot Length (D/H4) 2 1-20 How many bars on each side to confirm a swing point on Daily/H4. Lower = faster but noisier.
Pivot Length (W/M) 5 2-20 Same but for Weekly/Monthly. Higher because weekly data is already smoother.
Min Span (D/H4) 5 2-30 Minimum bars between two pivots for a valid divergence. Filters out tiny, meaningless swings.
Min Span (W/M) 15 3-50 Same for Weekly/Monthly. Wider because weekly divergences develop over months.
Max Lookback 100 20-300 How far back to look for the previous pivot. If two pivots are 100+ bars apart, they're probably unrelated.
OBV Break Window 30 10-60 How many bars to check when looking for an OBV breakout above/below its range.
Slope Period 20 5-50 Window for comparing OBV speed vs price speed. 20 = about 1 month on daily.
Slope Diverge % 15% 1-50% How different OBV and price slopes need to be before highlighting. 15% = meaningful gap.
Effort Vol x 2.5 1-10 How much higher than average volume a candle needs to qualify as an "effort" candle. 2.5x = significant.
Max Body % 0.5 0.1-0.8 Max candle body size (vs total range) for absorption detection. 0.5 = body is less than half the range.
Range Lookback 30 10-80 How many bars to analyze when detecting range patterns (wedges, triangles, etc.).
ATR Tolerance 0.5 0.2-2.0 How close a price needs to get to a level to count as "touching" support/resistance. In ATR units.
Vol Short 20 5+ Recent volume average (20 bars). Compared to Vol Long to detect volume decline — a setup precondition.
Vol Long 50 10+ Baseline volume average (50 bars). If Vol Short < Vol Long, volume is declining — institutions may be accumulating.

How the Math Works

OBV Formula
Each bar: if price closed higher than yesterday, add today's volume to the running total. If lower, subtract it. If unchanged, do nothing. The result is a cumulative line showing net buying vs selling pressure over time.
Pivot Confirmation
A swing low is confirmed when it has N higher bars on the left AND N higher bars on the right (where N = pivot length). This means the signal is always N bars late — but it's real, not noise. On Daily with pivot=2, you're 2 trading days late.
Nearest-Pivot Matching
When a price pivot is found, the indicator searches the last 30 OBV pivots for the closest one within 3x the pivot length. This ensures the OBV divergence line connects to an actual OBV swing point — not a random spot on the line. This is what prevents the divergence line from "cutting through" the OBV.
The Divergence Rule
BULL: Price makes a lower low (things look bad) BUT OBV makes a higher low (smart money is actually buying). The disagreement = upcoming reversal up.

BEAR: Price makes a higher high (things look great) BUT OBV makes a lower high (smart money is actually selling). The disagreement = upcoming reversal down.

Display Options

Option Default What it shows
Divergence ON The main signal lines connecting pivots. Always keep this on.
Ranges ON Boxes around detected patterns (DB, DT, wedges). Helpful for context.
Table ON Stats panel showing score, OBV slope, volume, signals.
OBV ON The white OBV line in the bottom panel. Always keep on.
EMA OFF 20-period moving average of OBV. Smooths the line but adds clutter.
Breaks OFF Triangle markers when OBV breaks its range. Noisy on most charts.
Effort OFF Dots/arrows for absorption and sponsored candles. Useful for analysis, clutters for scanning.

Changelog

v3: Pivot-confirmed divergence, per-TF pivot lengths (D=2, W=5), min span calibration (D=5, W=15), MTF detection, OBV line alignment fix, range pattern shortcodes, StoiQ-inspired hub.

v2: Basic divergence + context filters. No pivot confirmation, no MTF.

Calibration & Backtest

Python Backtest Results (OSX-Daily, 3Y)

1,346
Total Signals
54.5%
Win Rate
1.54×
Profit Factor

Walk-Forward Analysis

Phase Period Signals WR% Avg Return
Train Year 1 (51 weeks) 687 51.9% +0.82%
Test Year 2-3 (104 weeks) 659 58.3% +1.12%
Key Finding: Test WR exceeds train WR (58.3% > 51.9%), indicating robust signal quality + regime adaptability.

Top 7 Calibration Insights

  1. Pivot Length Matters: D/H4=2, W/M=5 optimal. Longer = fewer, higher-quality signals.
  2. Lookback Matters: Max 100 bars best. > 150 bars = noise, < 50 bars = missed divergences.
  3. Bull > Bear: Bull divergences 58% WR, bears 51% WR. Bias long.
  4. Regime Sensitivity: Best in trending markets (uptrend). Sideways = false signals.
  5. Commodities Strong: Oil, metals outperform equities. Agricultural weak.
  6. Monthly Seasonality: April + October best (avg +1.8%). June worst (avg +0.4%).
  7. Volume Confirmation: Signals with 2-3× avg volume have +15% higher WR.

Pivot Optimization Table

Pivot Len (D) Pivot Len (W) Signals WR% Avg Ret PF
2 5 1,346 54.5% +0.98% 1.54×
2 4 1,562 52.8% +0.85% 1.41×
3 5 952 56.2% +1.15% 1.68×
2 6 1,089 55.1% +1.05% 1.62×

Production Filters (Recommended)

Context Score > 65: Only trade signals with strong pre-conditions (volume decline, OBV trend, range setup).
Volume Confirmation: Current vol > 1.5× 20-SMA.
Regime Check: Weekly trend up (above 50-SMA) = favor bulls; below = be cautious.
No Earnings: Avoid 2 days pre/post earnings (pin risk).
Liquidity Min: Daily volume > $5M (equities) or > 500K contracts (futures).

TradingView Strategy Tester

The strategy file (obv_strategy_v3.pine) replicates the Python backtest in Pine Script:

# To use in TradingView:
1. Copy obv_strategy_v3.pine code
2. Pine Editor → New Script → Paste
3. Save → Add to chart
4. Strategy Tester → Run → Review results
5. Compare hold period columns (should match Python ~54-55% WR)

Recalibration Guide

When to Recalibrate

Quarterly: Run full backtest sweep every 3 months to detect regime drift.

After Major Macro Events: Fed pivot, yield curve inversion, sector rotation.

After 50-Signal Sample: If new data shows WR dropping >3%, investigate.

What to Tune

Pivot Length: Increase if too many false signals; decrease if missing setups.

Lookback: Narrow to 50-80 bars if in choppy regime; expand to 120+ in trending markets.

Context Score Threshold: Raise from 65 to 75 if false signals increase.

How to Run Backtest

# Python backtest (if available in your project):
python3 src/analysis/pivot_length_comparison.py

# TradingView backtest:
1. Add strategy to chart
2. Right-click → Strategy Tester → Run
3. Review WR% and Profit Factor across hold periods
4. Export results → compare to previous quarter

Setup & Workflow

Install the Indicator

  1. Go to TradingView.com
  2. Click your profile → Pine Editor
  3. Click "+ New script"
  4. Delete default code, paste from obv_system_v3.pine
  5. Click "Save" → Choose name "OBV Accumulation v3"
  6. "Add to Chart" → Select your chart

Tip: Save as public script so you can use it on any chart without re-pasting.

Configure Settings (Recommended)

Once added to chart, click the indicator name → Settings icon → Input tab:

Input Recommended Value
Pivot Length (D/H4) 2
Pivot Length (W/M) 5
Max Lookback 100
Divergence (Display) ON
Ranges (Display) ON
Table (Display) ON
OBV (Display) ON
EMA (Display) OFF
Breaks (Display) OFF
Effort (Display) OFF

Finviz → TradingView Watchlist

  1. Run screener: python3 src/screener/scan_lite.py
  2. Opens file: src/screener/output/tradingview_watchlist.txt
  3. Copy all ticker lines (or load via this hub's Scan tab)
  4. Go to TradingView → Watchlists (sidebar) → Create New List
  5. Name it "OBV Scan"
  6. Click "+" → Paste or manually add tickers

Tip: Set watchlist to sort by % change to spot momentum movers.

Set Alerts

  1. Right-click OBV indicator on chart
  2. Click "Add Alert"
  3. Condition: Select your indicator name
  4. Choose signal:
    • "Bullish Divergence" (most reliable)
    • "Bearish Divergence" (for shorts)
    • "Range + Divergence" (combo signal, high conviction)
    • "Context Score > 70" (strong pre-conditions)
  5. Frequency: "Once Per Bar Close" on Daily
  6. Notification: Email, Browser, SMS (choose your preference)

Tip: Use browser notifications for quick response; set daily 9:30-16:00 ET to avoid noise.

Daily Workflow

Morning (9:30 AM ET):

  • Run: python3 src/screener/scan_lite.py --preset unusual_vol
  • Import fresh watchlist to TradingView
  • Check alerts inbox for overnight signals

During Market Hours:

  • Open flagged tickers from watchlist
  • Visual confirmation: divergence lines visible? Context score > 65?
  • Check daily + weekly charts for MTF alignment

End of Day (4:00 PM ET):

  • Review chart setup notes (screenshot or mark in TradingView)
  • Plan entry price + stop loss + profit target

Key Tactical Rules

Bull Divergence: WR 58% (high conviction). Favor on daily with weekly confirmation. Best Apr/Oct, weekdays 10-14 ET.
Bear Divergence: WR 51% (lower conviction). Use tighter stops. More common in late-day reversals.
Multi-Timeframe: Bull div on daily + weekly = 3-5 day hold. Daily only = 1-2 days.
Commodities > Equities: Oil, metals show stronger divergence signals. FX also good.
Avoid: Earnings 2 days pre/post. Fed days. First/last 30 min of day (liquidity risk).

Troubleshooting

Issue Solution
No divergence lines show Check: Display → Divergence = ON. Ensure chart has enough history (>100 bars).
Too many false signals Increase Pivot Length to 3. Raise Context Score filter to 75. Use MTF confirmation.
Indicator is very slow Disable MTF requests if on low-TF charts. Disable Effort candles (Layer 3).
Finviz screener fails (401) Check .env: FINVIZ_API_TOKEN correct? Not expired? Try manual export from elite.finviz.com.

Resources