Indicator · Pine Script v5 · On the chart

ORB Indicator

by rosijay17-cmd

An overlay indicator that records the high and low of a chosen opening session, by default five minutes starting at 09:15, and plots them as circles after the session ends.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code83
Settings4inputs
LicenceGPL-3.0
Last update7 days ago22 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

83 lines of Pine Script v5 from ORB_Indicator.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

ORB_Indicator.pine
//@version=5
indicator("ORB Indicator", overlay = true)

inputMax = timeframe.multiplier
sess = input.session("0915-0920", title="ORB Session Time", group = "Indicator")
t = time(timeframe.period, sess + ":1234567")
conf = input.string("CLOSE", "Signal Configure", ["CLOSE", "TOUCH"], group = "Indicator")
longTrailPerc = input.float(title = "ATR (%)", defval = 0.38, step = 0.1, inline = '1', group = "Indicator") * 0.01
enable3 = input.bool(true, "", inline = '1', group = "Indicator")
// rsi_len = input.int(14, title = "RSI Length", group = "Indicator")
// y_coordinate = input.string(defval="Top", title="Table Position", options=["Top", "Middle", "Bottom"], inline = 'pos', group = "Indicator")
// x_coordinate = input.string(defval="Right", title="", options=["Left", "Center", "Right"], inline = 'pos', group = "Indicator")
// size_option = input.string(defval="Tiny", title="Select Size", options=["Auto", "Huge", "Large", "Normal", "Small", "Tiny"], group = "Indicator")
// size = size_option == "Auto" ? size.auto : size_option == "Huge" ? size.huge : size_option == "Large" ? size.large : size_option == " Normal" ? size.normal : size_option == "Small" ? size.small : size_option == "Tiny" ? size.tiny : size.auto

hide = timeframe.isintraday and timeframe.multiplier <= inputMax
is_newbar(res) => ta.change(time(res)) != 0
in_session = not na(t)
is_first = in_session and not in_session[1]

orb_high = float(na)
orb_low = float(na)

if is_first
    orb_high := high
    orb_low := low
else
    orb_high := orb_high[1]
    orb_low := orb_low[1]
if high > orb_high and in_session
    orb_high := high
if low < orb_low and in_session
    orb_low := low

plot(hide and not in_session ? orb_high : na , style=plot.style_circles, color=orb_high[1] != orb_high ? na : color.green, title="ORB High", linewidth=1)
plot(hide and not in_session ? orb_low : na , style=plot.style_circles, color=orb_low[1] != orb_low ? na : color.red, title="ORB Low", linewidth=1)

crossOver = ta.crossover(conf == "CLOSE" ? close : high, orb_high)
crossUnder = ta.crossunder(conf == "CLOSE" ? close : low, orb_low)
var bflag = false
var sflag = false
var new_flag = false
var long1_bo = false
var short1_bo = false
if dayofmonth[1] != dayofmonth
    bflag := true
    sflag := true
    new_flag := false
    long1_bo := false
    short1_bo := false
if is_first
    new_flag := true
plotshape(crossOver and bflag and new_flag, "B", shape.labelup, location.belowbar, color.green, size = size.tiny, text = "B", textcolor = color.white)
if crossOver and bflag and new_flag
    // label.new(bar_index, low - (close * 0.001), "", color = color.green, textcolor = color.white, size = size.large, style = label.style_arrowup)
    bflag := false
    long1_bo := true
    short1_bo := false
plotshape(crossUnder and sflag and new_flag, "S", shape.labeldown, location.abovebar, color.red, size = size.tiny, text = 'S', textcolor = color.white)
if crossUnder and sflag and new_flag
    // label.new(bar_index, high + (close * 0.001), "", color = color.red, textcolor = color.white, size = size.large, style = label.style_arrowdown)
    sflag := false
    long1_bo := false
    short1_bo := true


shortTrailPerc = longTrailPerc
longStopPrice = 0.0, shortStopPrice = 0.0

longStopPrice := if (long1_bo)
    stopValue = close[1] * (1 - longTrailPerc)
    math.max(stopValue, longStopPrice[1])
else
    0

shortStopPrice := if (short1_bo)
    stopValue = close[1] * (1 + shortTrailPerc)
    math.min(stopValue, shortStopPrice[1])
else
    999999

plot(long1_bo and enable3 ? longStopPrice : na, color = color.green, style = plot.style_linebr)
plot(short1_bo and enable3 ? shortStopPrice : na, color = color.red, style = plot.style_linebr)

Overview

ORB Indicator prints a B label when price crosses above the range high and an S label when it crosses below the low, once per day, using either the close or the touch of the high or low as confirmation. A percentage trailing stop value is calculated from the ATR percent input. It is intended for intraday charts.

Details

Published by

rosijay17-cmd on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
ORB Session Timesession0915-0920sess
Signal ConfigurestringCLOSEconf
ATR (%)float0.38longTrailPerc
enable3booltrueenable3
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

IB / ORB Live Stats

by TamaraKGreen
46 stars

This overlay indicator marks the New York initial balance and a configurable opening range on the price chart and reports live range statistics in two tables. It builds an IB box for a default 09:30–10:30 ET window, an ORB box from 09:30 for a set number of mi

Indicator v6 Sessions & timeBreakout
Updated 7 weeks ago · None stated GitHub repository of IB / ORB Live Stats

Zen-DAX GX

by Zen-Tim
29 stars

This indicator calculates and plots session ranges and key breakout levels for DAX futures directly on the price chart. It defines the overnight Globex session, the Frankfurt pre-market range, and the regular trading hours open using European timezone settings

Indicator v5 Sessions & timeBreakout
Updated 2 weeks ago · MIT GitHub repository of Zen-DAX GX
23 stars

Point-Clip Unified Indicator plots breakout and directional labels on the price chart. It scores volume spikes against a volume average, range or opening-range breaks, optional VWAP or session-anchored VWAP, fast and slow EMA trend, and a higher-timeframe EMA

Indicator v6 BreakoutVolume Repaints
Updated 3 weeks ago · Custom licence GitHub repository of Point-Clip Unified Indicator

ORB Multi-Model Indicator

by Mrshahidali420
16 stars

This indicator plots several New York opening-range breakout models on the price chart and can also show a combined confidence-scored signal. Enabled models include classic Crabel, a five-minute scalper, a standard fifteen-minute breakout, and a gold variant,

Indicator v6 BreakoutSessions & time Repaints
Updated 3 months ago · None stated GitHub repository of ORB Multi-Model Indicator

Nexural ORB

by JasonTeixeira
9 stars

This indicator plots opening range breakout levels across multiple timeframes, including five, fifteen, thirty, and sixty minutes, directly on the price chart. It also displays the session open and overnight high and low levels. The script calculates an openin

Indicator v6 BreakoutSessions & time
Updated 13 days ago · Custom licence GitHub repository of Nexural ORB

FX Market Sessions

by itmakesyousick
7 stars

FX Market Sessions highlights distinct trading sessions, such as London, New York, and Tokyo, directly on the main price chart. It draws background boxes for each active session and optionally plots opening ranges, Fibonacci retracement levels, and session ext

Indicator v5 Sessions & timeSupport & resistance
Updated 3 years ago · None stated GitHub repository of FX Market Sessions

More Breakout scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers