OPEN-SOURCE SCRIPT
Mis à jour

Session Analytics [EXCAVO]

5 089
Multi-Session Volume Profile with Smooth Wave Visualization

The Session Analytics indicator overlays Tokyo, London, and New York trading
sessions directly on the price chart. Each session displays a dynamic range box
with a volume profile wave inside — showing the distribution of traded volume
across the session's price range. Session names appear as colored labels above
each box for instant identification on any background.

This is not a simple session highlighter. The core engine accumulates volume data
at a configurable lower timeframe, builds a real-time profile for each active
session, and renders it as a smooth Catmull-Rom curve. The wave shape shows where
the most volume concentrated within each session.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW TO USE

Step 1 → Add the indicator to an intraday chart (up to 1H). Colored boxes
appear marking each active session's price range. A colored label
above each box shows the session name (ASIA, LONDON, NEW YORK).
Step 2 → Look at the volume wave inside each session box. The wave peaks
show where the most volume traded — the session's value concentration.
Flat areas indicate low-volume price zones.
Step 3 → Use wave peaks for context. Price returning to a peak area is
re-entering high-volume territory — potential support or resistance.
Price in flat wave areas is in low-volume space — expect faster moves.
Step 4 → Check the dashboard for real-time session status (OPEN or CLOSED)
for each tracked session.
Step 5 → Set up alerts for session open/close events. All alerts fire on
confirmed bars only — no repainting.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ WHAT MAKES IT DIFFERENT

◆ LTF Volume Profile Per Session
Standard session indicators show only high, low, and open. This engine requests
lower-timeframe volume data and builds a full profile for each session using
configurable bin resolution. The result is a proper volume-at-price distribution,
not a simple range overlay.

◆ Smooth Wave Rendering
Volume data is double-smoothed and rendered as a Catmull-Rom spline curve.
The wave is drawn using time-based coordinates for consistent smoothness across
all intraday timeframes — from 1-minute to 1-hour charts. No stepping or
staircase artifacts on higher timeframes.

◆ Three Sessions, One Engine
Tokyo, London, and New York sessions share the same volume accumulation engine.
Each session builds its own independent profile using LTF data. When a session
closes, its final wave shape is preserved. Active sessions update in real time
as new volume arrives.

◆ How Components Interact
The volume accumulation engine feeds into the wave renderer in real time. As LTF
volume data arrives, it is binned into the active session's profile. The renderer
smooths the bin data and generates a polyline wave clamped to the session box.
When the chart timeframe equals the LTF setting, the engine falls back to
chart-level volume to ensure waves appear on all timeframes.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ DASHBOARD

Real-time panel (configurable position) with session status:
  • Asia - OPEN (blue) or CLOSED (gray)
  • London - OPEN (yellow) or CLOSED (gray)
  • New York - OPEN (red) or CLOSED (gray)


Legend table (bottom left) explains every visual element. Toggle in Dashboard settings.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ SETTINGS

Sessions
  • Track Asia (Tokyo) - ON (01:00-09:00 UTC)
  • Track London - ON (07:00-16:00 UTC)
  • Track New York - ON (13:00-22:00 UTC)


Volume Profile
  • LTF Resolution - 1 (minute timeframe for volume data)
  • Profile Resolution - 30 (number of price bins)


Visualization
  • Asia / London / New York Color - customizable session colors
  • Box Transparency - 85 (0 = opaque, 100 = invisible)
  • Show Volume Profile - ON (wave display inside session box)


Dashboard
  • Show Dashboard - ON
  • Dashboard Position - Top Right (configurable corner)
  • Show Legend - ON


Alert Settings
  • Allow Repainting - OFF (signals on bar close only, recommended)
  • JSON Alerts (for bots) - OFF (enable for bot-ready JSON payloads)


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ ALERTS

6 alert conditions for session open/close events. By default, all alerts fire on
confirmed bars only (non-repainting). Enable "Allow Repainting" for real-time signals.
  • Asia Session Open - Asia session starts (01:00 UTC)
  • Asia Session Close - Asia session ends (09:00 UTC)
  • London Session Open - London session starts (07:00 UTC)
  • London Session Close - London session ends (16:00 UTC)
  • NY Session Open - New York session starts (13:00 UTC)
  • NY Session Close - New York session ends (22:00 UTC)


JSON mode sends bot-ready payloads with ticker, session name, action, price,
and timeframe fields. Compatible with 3Commas, Wunderbit, and custom webhooks.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Works on all intraday timeframes up to 1 hour and all instruments.
Sessions are active on weekdays only (Monday-Friday).
Original script by EXCAVO, written from scratch.


Disclaimer
Trading involves significant risk. This indicator is a technical analysis tool
and does not constitute financial advice, investment recommendations, or a
guarantee of future results. Past indicator behavior does not guarantee future
performance. Always use proper risk management and your own judgment.

Notes de version
v1.1 — Methodology and formatting update

◆ Added HOW IT CALCULATES section: Session Detection, Volume Distribution, Two-Pass Smoothing, Catmull-Rom Spline Interpolation, Polyline Rendering
◆ Updated chart panel name to full indicator title
◆ Dashboard header standardized
◆ Alert messages now use full indicator name
◆ JSON alert payloads updated with full indicator identifier
◆ Corrected volume profile color description to match actual session-based rendering

HOW IT CALCULATES

◆ Session Detection
Sessions are defined by UTC hour ranges: Asia 01:00-09:00,
London 07:00-16:00, New York 13:00-22:00. A session opens when
the current bar enters the time window and the previous bar was
outside it. Weekends (Saturday/Sunday) are excluded.

◆ Volume Distribution
The session price range (high - low) is divided into N bins
(default 30). Lower-timeframe candle data is fetched via
request.security_lower_tf. Each LTF candle's volume is assigned
to the bin matching its close price:

bin_index = floor((close - session_low) / bin_size)

Volume accumulates in each bin throughout the session.

◆ Two-Pass Smoothing
Raw bin volumes are smoothed twice using a weighted average filter:

smoothed[k] = (prev + 2 × current + next) / 4

The first pass removes noise from the raw histogram. The second
pass applied to the result produces a clean volume distribution
ready for curve fitting.

◆ Catmull-Rom Spline Interpolation
The smoothed bins become control points for a Catmull-Rom cubic
spline. For each segment between adjacent control points, the
curve is subdivided (4 sub-steps per segment) using the standard
Catmull-Rom basis:

P(t) = 0.5 × [(2P1) + (-P0+P2)t + (2P0-5P1+4P2-P3)t²
+ (-P0+3P1-3P2+P3)t³]

This produces a smooth wave shape without the staircase artifacts
of a raw histogram. The X-coordinate of each point is the
normalized volume width; the Y-coordinate is the price level.

◆ Polyline Rendering
The interpolated points are mapped to chart coordinates using
xloc.bar_time. Volume widths are normalized against the peak bin:

width = (bin_volume / max_bin_volume) × session_width × 0.5

The result is rendered as a closed polygon via polyline with
semi-transparent fill in the session color.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.