Rearview Download

Opening-range breakout

An opening-range breakout on intraday bars, flat at close: after the first half hour, buy a close above yesterday's high that's also above the session's average price, and hold nothing overnight. A stop limits a failed break, and flat at close sells whatever is left at the session's last close, half days included.

Intraday bars · intraday/opening_range_breakout.rvw

language 1
strategy "Opening-range breakout" {
  universe   stocks
  filter     daily(close[1]) > $5
  enter long when time >= 10:00 and time < 15:00 and close > daily(high[1]) and close > vwap
  rank by    roc(close, 6)
  size       10% of equity, max 5 positions
  stop       1%
  flat at close
}

Functions it uses

daily, roc

Try it

These need stocks’ intraday bars, such as 5-minute files converted with rvw convert ohlcv. See Intraday bars.

File ▸ New Script from Example adds it to a project. The examples read the sample’s index label, SYN500, and market ETF, SYNSPY; when your data has neither, a sheet asks what to read instead, one of your index labels (or every stock and ETF) and a ticker, so the example runs on your data as it is.

Before you trust what it does on your data, see whether it’s luck: Is this result luck?