OPEN-SOURCE SCRIPT
Telah dikemas kini

Intraday vs Overnight OBV

284
🔍 Purpose
This indicator provides a volume-weighted cumulative flow model that mimics On-Balance Volume (OBV) logic but splits the volume impact into intraday vs. overnight sessions. It allows traders to track how volume contributes to price movement in each session and identify whether buying/selling pressure is stronger during or outside of regular trading hours.

This indicator attempts to alleviate some of the downfalls of the standard OBV indicator, which only looks at total volume and total direction. The price of stocks generally behaves extremely differently during market hours and outside market hours, and many of the large moves happen outside of regular market hours on low volume.

⚙️ Core Features

1) OBV-style calculation:
If price increases → volume is added to the OBV stream.
If price decreases → volume is subtracted.
If price is flat → OBV remains unchanged.

2) Session splitting:
Intraday session: movement from today's open to close.
Overnight session: movement from yesterday’s close to today’s open.
Volume is split proportionally between these two periods based on user input.


3) Four visualization modes:
"Intraday" — plots only OBV from intraday price movement.
"Overnight" — plots only OBV from overnight price movement.
"Aggregate" — plots the sum of intraday and overnight OBV for a holistic view.
"Both Intraday and Overnight" — plots intraday and overnight OBV separately on the same chart.

📐 Inputs

1) Synthetic OBV Type:
  1. "Intraday" — Show OBV from open to close only.
  2. "Overnight" — Show OBV from prior close to today's open only.
  3. "Aggregate" — Show a single line combining both.
  4. "Both Intraday and Overnight" — Show both lines on the same chart.


2) Estimated Overnight Volume %:
Percentage of total daily volume assumed to occur during extended hours.
The rest is allocated to regular session (intraday).
Default: 20% overnight, 80% intraday.

🧮 How It Works

Volume Splitting:
Total bar volume is split into overnight Volume and intraday Volume:
Intraday change is the difference between today’s close and open.
Overnight change is the difference between today’s open and yesterday’s close.

Session OBV Calculations:
OBV is incremented/decremented by the session's allocated volume, depending on whether the session’s price change was positive or negative.

Aggregate OBV:
Combines both session deltas for a holistic volume flow view.

📊 Interpretation
  • Rising OBV (any stream) suggests accumulation; falling OBV suggests distribution.
  • Divergences between price and OBV lines (especially overnight vs. intraday) can reveal where hidden buying/selling is occurring.
  • Comparing intraday vs overnight OBV can help:
  • Spot whether institutional demand is building off-hours.
  • Detect retail vs. institutional behavior (retail trades often dominate intraday; institutional may prefer after-hours).


💡 Use Cases
  • Identify whether overnight gaps are supported by overnight volume momentum.
  • Detect accumulation in low-volume overnight sessions.
  • Compare intraday and overnight strength during earnings season or news events.
  • Complement traditional OBV by seeing session-based breakdowns.
Nota Keluaran
I added a user toggle to change the color of the lines, with an adjustable fade strength between red and green.

I also added a selectable moving average line that can be changed between red or green depending on if the moving average line is below or above the OBV line.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.