Support Resistance Bounce (Mean reversion)

Buys when price dips below the 20-bar support and bounces back above it, and sells when it reaches the 20-bar resistance.

How It Works

  1. Track support (the lowest close of the previous 20 bars) and resistance (the highest).
  2. Buy when price closes below support and then snaps back above it on the next bar — a failed breakdown: sellers pushed under the floor and were rejected.
  3. Sell when the close reaches the 20-bar resistance.

Worked example. Support from the previous 20 bars sits at 98. Price closes at 97.4 — below the floor — but the next bar snaps back to 98.6, above it. That failed breakdown triggers the buy; the trade sells when price reaches the 20-bar resistance at 103.

The Math Behind The Indicators

Everything runs on closing prices of the traded timeframe: P is a close, Pt today's close, and N counts bars — one bar is one candle of that timeframe, so 20 bars on a 1h chart is 20 hours.

Price Channel (Rolling High / Low)
The highest and lowest close over the previous N bars — the edges of the recent trading range. Closing above the channel top means price just beat every close in that window (a breakout); the channel bottom marks recent support.
2026-07-23T00:16:19.341029 image/svg+xml Matplotlib v3.11.1, https://matplotlib.org/
Example: If the previous 5 closes were 100, 103, 101, 102, 104, the channel spans 100 to 104. A close at 105 breaks above the top; a close at 99 breaks below the bottom.

Example Chart

Real Data — Score 23 / 100

Metrics Per Trade

Final Metrics

Scores

Resampled Data — Score 25 / 100

Metrics Per Trade

Final Metrics

Scores