Scripts / Session Range (Opening Range)

Session Range (Opening Range)

Free (planned) Indicator

Marks a user-defined session on the chart. The default is the first 30 minutes of the US cash equity session (09:30–10:00 America/New_York). While that session is open, the script tracks the session high and low. After the session ends, those levels are frozen. Later closes can be marked, and can fire alerts, when they break above or below the range. A midpoint and range-width extensions are optional.

Free access is planned. On this preview the source is here so you can paste it into TradingView and confirm it compiles. Nothing has been published to TradingView or to the live domain.

Screenshot placeholder
Screenshot coming later. After the script is pasted into TradingView and compiles, capture the chart, the settings panel, and the alert list. Do not use Strategy Tester profit or win-rate figures on this page.

What it does

Marks a user-defined session on the chart. The default is the first 30 minutes of the US cash equity session (09:30–10:00 America/New_York). While that session is open, the script tracks the session high and low. After the session ends, those levels are frozen. Later closes can be marked, and can fire alerts, when they break above or below the range. A midpoint and range-width extensions are optional.

Use a timeframe shorter than the session length. A 1-minute or 5-minute chart is a typical choice for a 30-minute range. For a crypto first-hour range, change the session (for example 0000-0100) and the timezone (for example Etc/UTC).

Settings

Opening-range sessionDefault 09:30–10:00, in HHmm-HHmm format.
TimezoneDefault America/New_York. Other common zones are listed, plus “Chart timezone.”
Wait for the bar to closeOn by default. A break is only marked after the candle confirms.
Midpoint and extensionsMidpoint on by default. Optional extensions at 0.5× and 1.0× the range width.
HistoryPrior sessions can stay on the chart, with a cap (default 20).
Labels, table, alertsFirst-break labels, a status table, and alerts for range complete / close above / close below.

How to add it in TradingView

  1. Open TradingView on a chart whose timeframe is shorter than the session you want (for the default 30-minute US range, 1-minute or 5-minute is typical).
  2. Open the Pine Editor at the bottom of the window.
  3. Copy the source file session_range.pine, paste it into the editor (replace whatever is there), then Save and Add to chart.
  4. Set the session and timezone in Settings to match the market you are watching.
  5. Leave “Wait for the bar to close before marking a break” on so a break is only marked after the candle confirms.
  6. Optional: create an alert and pick “Opening range is complete,” “Close above the opening range,” or “Close below the opening range.”

Notes, including backtests

This is an indicator, not a strategy, so it has no Strategy Tester results to report. It has had a careful manual review for Pine Script v6, but it has not been compiled in TradingView yet. After you paste it, if TradingView shows an error, copy the exact message and the script can be fixed before anything is published.

Educational tool, not financial advice. This script is not a signal service and it does not place orders. It does not promise profits, win rates, or trading results.