Opening Candle Breakout [OCB] Strategy by elpips

By elpips

Performance Metrics

Description

Opening Candle Breakout [OCB] StrategyWHAT IT DOESThis is the strategy version of the Opening Candle Breakout indicator: same logic, with simulated orders so you can run the Strategy Tester and deep backtesting on any instrument and period.The setup is rule-based and happens once per session: when the first candle of the trading session closes, the strategy enters in its direction at the open of the next candle, places a stop at the opposite side of that first candle, and holds until a distant target or the end of the session, whichever comes first. Nothing is repainted: the decision is only made on a closed candle.The idea comes from the opening range breakout family and more precisely from Zarattini and Aziz (2023), “Can Day Trading Really Be Profitable?”, which studied the first 5-minute candle on US index ETFs. This script is an independent implementation, not affiliated with the authors.MNQ, m5, 2020-2026HOW IT WORKS- At the close of the first session candle (default 09:30-09:35 New York time), the strategy checks its direction: close above open is long, close below open is short.- If the candle body is smaller than the minimum (default 0.5 x ATR), no trade is taken that day. - This filter removes opening candles without a clear direction.- The stop is placed at the opposite extreme of the first candle (low for a long, high for a short), bounded between a minimum and a maximum distance in ATR.- The target is expressed in multiples of the initial risk (default 10R). In practice it is rarely reached: the normal exit is the forced close before the end of the session (default 15:55-16:00). You can disable the target to always hold until the close.- One trade per session, longs and shorts can be enabled separately.- Position size is derived from a fixed risk per trade in USD or in percent of equity, divided by the stop distance and the contract point value, capped by a maximum number of contracts. If even one contract would exceed the risk budget, the trade is skipped (optional override).DEFAULT BACKTEST SETTINGSInitial capital 25,000 USD, risk 250 USD per trade, commission 0.50 USD per contract per side, slippage 2 ticks, no margin simulation (intraday futures margins are small relative to the risk taken). These are placeholders: enter your own broker’s costs before drawing any conclusion. Commissions and slippage matter a lot for this kind of setup because the per-trade edge is small.WHAT TO EXPECTThis is a low win rate, high payoff setup. On 5-minute US index futures it typically shows around 20 to 25 percent winning trades, with average winners several times larger than average losers. Series of 10 or more consecutive losses are normal and expected. Results vary strongly across instruments and years, and the underlying effect is public and has been documented to weaken over time. Past performance in the Strategy Tester is not a prediction of anything.SETTINGS- First session candle: must match exactly one candle of your chart timeframe.- Flat before close: window in which any open position is closed.- Timezone: exchange timezone of the instrument (America/New_York for US indices).- Longs / Shorts: enable each side independently.- Minimum candle body (x ATR): 0 disables the filter.- Minimum / maximum stop (x ATR): bounds for the stop distance.- Target (R) and Use target: exit rules.- Risk mode, risk per trade, max contracts, allow 1 contract: position sizing.WHAT IT IS NOTNot a signal service and not a trading recommendation.Not optimized: default values come from the original research and from a robustness check (body filter tested at 0.2, 0.3 and 0.5 with consistent results), not from curve fitting.Not suitable for accounts with tight trailing drawdown rules without reducing the risk per trade accordingly.BEST USED ON5-minute charts of US index futures (MNQ, NQ, MES, ES) during the regular session. Works on any instrument with a defined session, but was designed and tested on US equity index opens.COMPANION SCRIPTIndicator version with levels, labels, alerts and a live statistics table: Open source under the Mozilla Public License 2.0. Feedback and improvements are welcome.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView