Skip to content
All library documents

Gap Trading Strategy with Mid-Level Filters and a Williams Trailing Stop

Article ProRealCode

Summary

This strategy combines daily mid-level filters with gap-related price comparisons to generate one long or short trade during the 9:00 AM bar. It calculates the midpoint of the prior day and the midpoint of the highest high and lowest low across configurable lookback days. A long signal requires price below the multi-day midpoint and the prior-day midpoint below the multi-day midpoint; the short conditions reverse those relationships. The code also compares the current high or low with the prior bar to set a directional detector.

Positions use a fixed size of two lots, a stated 0.66% loss stop, and a Williams three-bar trailing indicator to manage exits after a 0.33% favorable performance threshold. Positions can remain open overnight, with a Friday close rule. The author reports testing on the AEX25 at a two-minute interval over a 200,000-unit backtest with 0.1 spread, and says two parameters were optimized within a range of 1 to 7. No performance statistics or robustness analysis are provided, so these settings do not establish profitability.

Key ideas

  • The entry filter compares the prior-day midpoint with midpoints derived from multi-day highs and lows.
  • The rules allow at most one entry per direction during the specified 9:00 AM bar.
  • A Williams three-bar trailing indicator helps determine exits after a favorable performance threshold is reached.
  • The strategy applies a percentage loss stop and closes positions on Friday evening.
  • The author reports a two-minute AEX25 backtest but supplies no performance metrics or robustness evidence.

Tags

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