OPEN-SOURCE SCRIPT

ORBs, EMAs, AVWAP

120
This Pine Script (version 6) is a multi-session trading indicator that combines Opening Range Breakouts (ORBs), Exponential Moving Averages (EMAs), and an Anchored VWAP (AVWAP) system — all in one overlay script for TradingView.

Here’s a clear breakdown of its structure and functionality:

🕒 1. Session Logic and ORB Calculation

Purpose: Identify and plot the high and low of the first 30 minutes (default) for the Tokyo, London, and New York trading sessions.

Session Anchors (NY time):

Tokyo → 20:00

London → 03:00

New York → 09:30
(All configurable in inputs.)

ORB Duration: Default is 30 minutes (orbDurationMin), also user-configurable.

Resets:

London and NY ORBs reset at the start of each new New York trading day (17:00 NY time).

Tokyo ORB resets independently using a stored timestamp.

Process:
For each session:

While the time is within the ORB window, the script captures the session’s high and low.

Once the window closes, those levels remain plotted until reset.

Plot Colors:

Tokyo → Yellow (#fecc02)

London → Gray (#8c9a9c)

New York → Magenta (#ff00c8)

These form visible horizontal lines marking the prior session ranges — useful for breakout or retest trading setups.

📈 2. EMA System

Purpose: Provide trend and dynamic support/resistance guidance.

It calculates and plots four EMAs:

EMA Period Color Purpose
EMA 9 Short-term Green Fast signal
EMA 20 Short-term Red Confirms direction
EMA 113 Medium Aqua Trend filter
EMA 200 Long-term Orange Macro trend baseline

Each EMA is plotted directly on the price chart for visual confluence with ORB and VWAP levels.

⚖️ 3. Anchored VWAP (AVWAP)

Purpose: Display a volume-weighted average price anchored to specific timeframes or events, optionally with dynamic deviation or percentage bands.

Features:

Anchor Options:

Time-based: Session, Week, Month, Quarter, Year, Decade, Century

Event-based: Earnings, Dividends, Splits

VWAP resets when the chosen anchor condition is met (e.g., new month, new earnings event, etc.).

Bands:

Up to three levels of symmetric upper/lower bands.

Choose between Standard Deviation or Percentage-based widths.

Display Toggles:

Each band’s visibility is optional.

VWAP can be hidden on 1D+ timeframes (hideonDWM option).

Color Scheme:

VWAP: Fuchsia (magenta-pink) line

Bands: Green / Olive / Teal with light-filled zones

⚙️ 4. Technical Highlights

Uses ta.vwap() with built-in band calculations.

Handles instruments with or without volume (errors if missing volume).

Uses time-zone aware timestamps (timestamp(NY_TZ, …)).

Uses timeframe.change() to detect new anchors for the VWAP.

Employs persistent variables (var) to maintain session state across bars.

💡 In Practice

This indicator is designed for multi-session intraday traders who:

Trade Tokyo, London, or NY open breakouts or retests.

Use EMA stacking and crossovers for trend confirmation.

Use Anchored VWAP as a fair-value or mean-reversion reference.

Need clear visual structure across different market sessions.

It provides strong session separation, trend context, and volume-weighted price reference — making it ideal for discretionary or semi-systematic trading strategies focused on liquidity zones and session momentum.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.