This strategy builds the opening range high and low during the first configurable minutes of the New York regular session, then enters on a close break of that range.
//@version=6
// ES S&P500 — Opening Range Breakout (ORB) Strategy
// Author: Ugur Pala · github.com/trugurpala/pinescriptv6
// TradingView: https://tr.tradingview.com/u/trugurpala/
//
// TR: İlk 30 dakikanın yüksek/düşüğünü belirleyip kırılma yönünde giriş yapar.
// RTH (09:30-16:00 ET) içinde çalışır. Seans sonunda tüm pozisyonlar kapatılır.
// EN: Identifies the first 30-minute high/low and enters on breakout.
// Works within RTH (09:30-16:00 ET). All positions closed at session end.
//
// Sembol / Symbol: CME_MINI:ES1! veya CME_MICRO:MES1!
// Önerilen TF / Recommended TF: 5M, 15M
strategy("ES Opening Range Breakout [trugurpala]",
overlay = true,
initial_capital = 25000,
default_qty_type = strategy.fixed,
default_qty_value = 1,
commission_type = strategy.commission.cash_per_contract,
commission_value = 4.0,
slippage = 1)
// ── Inputs ───────────────────────────────────────────────────────────────────
int orbMins = input.int(30, "ORB Minutes", minval=5, maxval=60,
tooltip="İlk N dakikanın high/low'u / First N-minute high/low")
float atrMult = input.float(1.5, "SL ATR Mult", step=0.1)
float rr = input.float(2.0, "R:R Ratio", step=0.1)
bool longOnly = input.bool(false, "Long Only")
// ── Seans ve ORB Zamanı / Session and ORB Time ───────────────────────────────
bool rthOpen = not na(time(timeframe.period, "0930-0930", "America/New_York"))
bool inRTH = not na(time(timeframe.period, "0930-1600", "America/New_York"))
bool inORB = not na(time(timeframe.period, "0930-" + str.tostring(930 + orbMins), "America/New_York"))
// ORB yüksek/düşük hesapla
var float orbHigh = na
var float orbLow = na
var bool orbDone = false
if rthOpen
orbHigh := high
orbLow := low
orbDone := false
if inORB and not orbDone
orbHigh := math.max(orbHigh, high)
orbLow := math.min(orbLow, low)
if not inORB and not orbDone
orbDone := true
// ── Calculations ─────────────────────────────────────────────────────────────
float atrVal = ta.atr(14)
bool longBreak = orbDone and inRTH and ta.crossover(close, orbHigh) and strategy.position_size == 0
bool shortBreak = orbDone and inRTH and ta.crossunder(close, orbLow) and strategy.position_size == 0
// RTH sonu kapat / Close at RTH end
bool rthEnd = inRTH[1] and not inRTH
if rthEnd
strategy.close_all(comment="RTH Close")
// ── Entries ──────────────────────────────────────────────────────────────────
if longBreak
float sl = close - atrMult * atrVal
float tp = close + rr * (close - sl)
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", "Long", stop=sl, limit=tp)
if shortBreak and not longOnly
float sl = close + atrMult * atrVal
float tp = close - rr * (sl - close)
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", "Short", stop=sl, limit=tp)
// ── Visuals ──────────────────────────────────────────────────────────────────
plot(orbDone ? orbHigh : na, "ORB High", color.new(color.green, 30), linewidth=2, style=plot.style_linebr)
plot(orbDone ? orbLow : na, "ORB Low", color.new(color.red, 30), linewidth=2, style=plot.style_linebr)
bgcolor(inORB ? color.new(color.orange, 93) : na, title="ORB Window")
bgcolor(not inRTH ? color.new(color.gray, 96) : na, title="Outside RTH")
plotshape(longBreak, "Long", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(shortBreak, "Short", shape.triangledown, location.abovebar, color.red, size=size.small)
// ── Alerts (alert() — strategy içinde çalışır) ───────────────────────────────
if longBreak
alert("ES ORB Breakout Long — " + str.tostring(close, "#.##"), alert.freq_once_per_bar)
if shortBreak
alert("ES ORB Breakout Short — " + str.tostring(close, "#.##"), alert.freq_once_per_bar)
Overview
A long triggers when price crosses above the range high while flat; a short triggers on a cross below the range low unless long-only mode is on. The stop is an ATR multiple from the entry close, and the take profit uses the chosen reward-to-risk ratio. It draws the logic on the price chart and closes every position when the regular session ends.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
ORB Minutes
int
30
orbMins
SL ATR Mult
float
1.5
atrMult
R:R Ratio
float
2.0
rr
Long Only
bool
false
longOnly
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.
This strategy places buy-stop and sell-stop orders around the opening-session high and low, offset by a user-defined pip gap, and only allows those orders during a separate trading session. It exits with a fixed or ATR-based stop loss and a matching take-profi
This strategy enters long when price closes above the prior Donchian high and short when it closes below the prior Donchian low, only while flat and inside a Taipei-hour window. It exits on a MACD histogram reversal or through an ATR stop and a percentage take
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
This overlay strategy builds independent timed session ranges and marks range, trendline, mean, VWAP, and high-low levels when those displays are enabled. It enters on range breakouts and exits with strategy exits, choosing among range, ATR, fixed-point, and r
ORB Hunter is an Opening Range Breakout strategy that identifies price breakouts beyond a defined opening session window (such as 09:30 to 09:45 EST). It places long or short trades when price crosses the opening range bounds with buffer, confirmed by optional
This strategy captures momentum moves on gold by combining Bollinger Band breakouts with EMA trend confirmation. It restricts trade entry to active European and US trading sessions based on specified hours. Exits are managed dynamically through an ATR-based in