Skip to content
All library documents

First-Hour Breakout and Retest Rules with Layered Exits

Article Strategy library · Author: gvman99

Summary

This script outlines an intraday rules engine for trading the underlying during a defined first-hour window. Longs require price above VWAP and shorts below it, with optional alignment between fast and slow exponential moving averages. Setups use retests or first touches of prior-day and premarket highs or lows, as well as taps of the fast average; entries must close on the trend side of that average. The rules also restrict entries by location relative to prior-day levels.

Position management trims one unit at a new high or low of day, then manages the remaining position with close-based fast-average and entry-level conditions. A touch of the slow average acts as a hard stop, and positions are flattened before the close. The document warns that partial fills in the strategy tester are approximate and that the sample share quantity makes dollar results uninformative. The supplied excerpt ends partway through the code and includes no performance report, so it does not establish profitability or execution quality.

Key ideas

  • Entries are restricted to a first-hour window and filtered by VWAP, price location, and optional moving-average alignment.
  • Setups combine level retests or first touches with fast-average taps.
  • The exit plan trims at a new daily extreme, trails the remainder, and uses the slow average as a hard stop.
  • The rules flatten positions before the market close and avoid overnight exposure.
  • Backtest fills are described as approximate, and the excerpt provides no performance results.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.