Strategy · Pine Script v6 · On the chart

OPTD ORB Strategy

by drewautomates

The OPTD ORB Strategy detects an opening range from a user-defined session window on the chart timeframe.

View on GitHub

GitHub stars3on the repository
Pine versionv6current
Lines of code199
Settings14inputs
LicenceCustom licence
Last update2 days ago28 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  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 strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

OPTD ORB Strategy waits for a specified number of consecutive closes beyond the range high or low on a separate signal timeframe to generate a long or short entry. The default stop loss anchors to the opposite rail at 1R, where R equals the opening range width, and the target is set at 2R. A maximum of one trade per session is allowed, after which the position is flattened at the end of the regular trading session. The range levels remain invariant across timeframes while the breakout counter runs independently.

Details

Published by

drewautomates on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

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.

Topics

acsilalgorithmic-tradingbacktestingclaude-codefutures-tradingpine-scriptquantitative-financesierra-charttrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
Opening Range Time (EST)session0930-1000orSess
Regular Session Time (EST)session0930-1600rthSess
TimezonestringAmerica/New_Yorktz
Signal timeframetimeframe1sigTF
Consecutive closes outside range for signalint1nCloses
DirectionstringBothdir
Stop (R = OR width)float1.0stopR
Target (R multiple)float2.0rTarget
Max one trade per sessionbooltrueoneTrade
Flatten at end of sessionbooltrueflatEOD
ORHcolorcolor.new(#2962ff, 0)colH
ORLcolorcolor.new(#e91e63, 0)colL
Show all 14 settings
SettingTypeDefaultVariable
ORMcolorcolor.new(#787b86, 0)colM
Shade rangebooltrueshowFill
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

53 stars

This strategy enters long or short on the price chart when price is on the correct side of a 200-period EMA, MACD agrees, RSI is not at the opposing extreme, ADX exceeds a threshold, volume beats a 20-bar average, and close breaks the recent high or low. A tim

Strategy v6 TrendOscillators & momentum
Updated 2 months ago · MPL-2.0 GitHub repository of BTCUSD 5M Optimized Strategy
23 stars

This strategy evaluates breakout and trend opportunities on the price chart using a weighted composite score of volume, trend, and candlestick structure. It tracks volume spikes, fast and slow EMAs, higher-timeframe EMA trend alignment, opening ranges, and ses

Strategy v6 TrendVolume Repaints
Updated 4 weeks ago · Custom licence GitHub repository of TradingAlpha Point-Clip Strategy

ORION: Hybrid Strategy

by eddiebelaval
7 stars

This strategy identifies volatility breakout opportunities by constructing dynamic ATR-based price boxes and detecting volatility squeezes. Trades are filtered using an exponential moving average trend condition and designated session hours. Entries trigger up

Strategy v5 Volatility & bandsBreakout
Updated 3 months ago · None stated GitHub repository of ORION: Hybrid Strategy

This strategy trades EUR/USD breakouts on the price chart using Ichimoku values. It marks a compressed range when the Senkou spans twist and the range height stays under a pip limit. It enters long on a close above the prior range high, or short below the prio

Strategy v4 TrendBreakout
Updated 2 years ago · MIT GitHub repository of Robot Forex BREAKOUT EUR/USD 5MIN - Ichimoku

This strategy tracks GBP/USD market structure by storing confirmed pivot highs and lows. It enters long when price crosses above the last pivot high while above a trend EMA, and short when price crosses below the last pivot low while below that EMA. Entries oc

Strategy v6 SMC / ICT / price actionTrend
Updated 2 months ago · MIT GitHub repository of GBP/USD Market Structure [trugurpala]

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