OPEN-SOURCE SCRIPT
Opening Range Breakout (ORB) [martineye15]

Opening Range Breakout (ORB) — a configurable, non-repainting opening-range breakout tool. It records the high and low of an opening-range window you define, locks that range at session close, then signals breakouts above or below it and projects a stop-loss and up to three take-profit targets for each one. It is market-agnostic: session, timezone, active days, confirmation style, risk model, filters, visuals and alerts are all inputs, so the same tool adapts to indices, futures, forex, crypto or stocks on any intraday timeframe.
THE OPENING RANGE
- Define the range by session time and timezone (e.g. 0930-0945 New York for the first 15 minutes of the US cash open), with presets for the major world market zones.
- Choose which weekdays are active (Mon to Sun).
- The range builds live during the window, then locks at session close. Optionally extend the locked levels across the rest of the day.
BREAKOUT DETECTION
- Confirmation: require a bar to close beyond the level, or count any wick / touch.
- Signal mode: the first breakout of the day only, or every breakout.
- Optional retest: after the initial break, wait for price to return to the broken level and resume in the breakout direction before signalling.
RISK MODEL
- Stop-loss: opposite OR boundary, OR midpoint, ATR, fixed ticks, or percent.
- Take-profit: risk multiple (R), OR-range multiple, ATR, fixed ticks, or percent, with up to three targets.
- Levels are computed from the entry, drawn with labels, and their hits are tracked bar by bar.
FILTERS
- OR size filter: skip days whose range is too small or too large (in ticks or percent) to avoid low-quality sessions.
- One trade per day.
- Volume confirmation: require the breakout bar's volume to exceed its moving average.
VISUALS & INFO
- Opening-range box and high/low lines, breakout labels, and SL/TP lines, all with configurable colours, width and style.
- Optional session background, and an on-chart info table showing the OR high/low, range size, current state (forming / waiting / filtered / active / closed) and the latest result.
ALERTS
- Opening range formed, bullish breakout, bearish breakout, take-profit hit, and stop-loss hit, with messages that include the symbol, timeframe and levels.
HOW TO USE
Apply it to an intraday chart and set the OR session and timezone to match your instrument — the US cash open, a forex session open, or any window you trade. Tune the stop and target model to your risk approach, add the size, volume or one-trade-per-day filters if you want stricter conditions, and set alerts on the events you care about. Every module toggles independently, so you can keep the chart minimal or fully detailed.
WHAT MAKES IT DIFFERENT
Rather than a fixed opening-range window with a single stop and target rule, everything is parameterised: five stop methods, five target methods with up to three targets, an optional retest condition, size and volume filters, and full timezone / session / weekday control — so one tool fits very different instruments and playbooks while staying non-repainting.
REPAINTING & LIMITATIONS
Breakout signals and stop/target hits are evaluated only on confirmed (closed) bars, so historical and realtime behaviour match — the tool does not repaint. The opening-range box and lines update live while the range is still forming, which is expected. It runs on intraday timeframes only; on daily or higher it displays a notice instead of drawing.
This is a visual, decision-support tool. It is not a strategy, it places no orders and reports no performance statistics, and it is not financial advice.
THE OPENING RANGE
- Define the range by session time and timezone (e.g. 0930-0945 New York for the first 15 minutes of the US cash open), with presets for the major world market zones.
- Choose which weekdays are active (Mon to Sun).
- The range builds live during the window, then locks at session close. Optionally extend the locked levels across the rest of the day.
BREAKOUT DETECTION
- Confirmation: require a bar to close beyond the level, or count any wick / touch.
- Signal mode: the first breakout of the day only, or every breakout.
- Optional retest: after the initial break, wait for price to return to the broken level and resume in the breakout direction before signalling.
RISK MODEL
- Stop-loss: opposite OR boundary, OR midpoint, ATR, fixed ticks, or percent.
- Take-profit: risk multiple (R), OR-range multiple, ATR, fixed ticks, or percent, with up to three targets.
- Levels are computed from the entry, drawn with labels, and their hits are tracked bar by bar.
FILTERS
- OR size filter: skip days whose range is too small or too large (in ticks or percent) to avoid low-quality sessions.
- One trade per day.
- Volume confirmation: require the breakout bar's volume to exceed its moving average.
VISUALS & INFO
- Opening-range box and high/low lines, breakout labels, and SL/TP lines, all with configurable colours, width and style.
- Optional session background, and an on-chart info table showing the OR high/low, range size, current state (forming / waiting / filtered / active / closed) and the latest result.
ALERTS
- Opening range formed, bullish breakout, bearish breakout, take-profit hit, and stop-loss hit, with messages that include the symbol, timeframe and levels.
HOW TO USE
Apply it to an intraday chart and set the OR session and timezone to match your instrument — the US cash open, a forex session open, or any window you trade. Tune the stop and target model to your risk approach, add the size, volume or one-trade-per-day filters if you want stricter conditions, and set alerts on the events you care about. Every module toggles independently, so you can keep the chart minimal or fully detailed.
WHAT MAKES IT DIFFERENT
Rather than a fixed opening-range window with a single stop and target rule, everything is parameterised: five stop methods, five target methods with up to three targets, an optional retest condition, size and volume filters, and full timezone / session / weekday control — so one tool fits very different instruments and playbooks while staying non-repainting.
REPAINTING & LIMITATIONS
Breakout signals and stop/target hits are evaluated only on confirmed (closed) bars, so historical and realtime behaviour match — the tool does not repaint. The opening-range box and lines update live while the range is still forming, which is expected. It runs on intraday timeframes only; on daily or higher it displays a notice instead of drawing.
This is a visual, decision-support tool. It is not a strategy, it places no orders and reports no performance statistics, and it is not financial advice.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Custom TradingView indicators & strategies in Pine Script — Smart Money Concepts / ICT specialist. Available for freelance work: martineye15@gmail.com
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Custom TradingView indicators & strategies in Pine Script — Smart Money Concepts / ICT specialist. Available for freelance work: martineye15@gmail.com
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.