agentleFS
SKE-LabsSKE-Labs/agent-trading-skills/skills/technical-strategies/mean-reversion/SKILL.md

mean-reversion

Skill17 starsChanged 4 months agoApache-2.0View on GitHub

Test whether a price or spread reverts toward a modeled center. Use when evaluating stationarity, half-life, z-score bands, regime breaks, time stops, and net execution costs.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test band, RSI, and reversal features for incremental value.

    line 29
  2. Distinctive:

    Use an objective, calibrated regime/stationarity gate.

    line 37
  3. Distinctive:

    Treat the setup as a testable hypothesis, not a prediction.

    line 75
  4. Distinctive:

    Never assume a series mean reverts.

    line 83
  5. Distinctive:

    NEVER enter on BB touch alone.

    line 84
  6. Distinctive:

    Do not count BB, RSI, and z-score as independent confirmation.

    line 87
  7. Distinctive:

    Use a time stop tied to estimated half-life and exit on a stationarity/regime break.

    line 88
  8. Distinctive:

    If price is at lower BB due to fundamental repricing (earnings, news), it is not "oversold"

    line 89

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Mean Reversion

Mean reversion is a hypothesis that a specified price/spread process returns toward a modeled center fast enough to overcome costs. Verify stationarity or stable conditional behavior before trading; an individual price level may trend indefinitely.

Detection Methods

Z-Score

Z-Score = (Series - rolling mean) / rolling standard deviation. Select the series, lookback, entry/exit bands, and time stop in training data. A z-score is descriptive and is not normally distributed by assumption.

Z-ScoreSignal
Positive extremeCandidate short only if reversion model passes
Near centerNo new extreme under the chosen rule
Negative extremeCandidate long only if reversion model passes

Bollinger Band Method

  • Band touch/pierce + reversal candle → trade toward middle band
  • Test band, RSI, and reversal features for incremental value; they are correlated price transforms

RSI Extreme Method

Calibrate RSI percentiles/bands to the instrument and regime; no fixed threshold creates a buy or sell.

Regime and Stationarity Gate

Use an objective, calibrated regime/stationarity gate. ADX can be one feature but does not establish mean reversion or set size.

Workflow

  1. Check regime (must pass first):
    get_indicators(indicator_code="dmi", symbol=<symbol>, exchange=<exchange>, interval=<interval>)
    Apply the frozen regime and stationarity gates; return no trade when either fails.
  2. Get BB and RSI:
    get_indicators(indicator_code="bbands", symbol=<symbol>, exchange=<exchange>, interval=<interval>)
    get_indicators(indicator_code="rsi", symbol=<symbol>, exchange=<exchange>, interval=<interval>)
    get_indicators(indicator_code="ema", symbol=<symbol>, exchange=<exchange>, interval=<interval>)
  3. Get candles for confirmation:
    get_candles_around_date(symbol=<symbol>, exchange=<exchange>, interval=<interval>, date=<date>)
  4. Mark setup:
    draw_chart_analysis(action="create", drawing={
        "type": "demand",
        "points": [
            {"time": <extreme_time>, "price": <lower_bb>},
            {"time": <current_time>, "price": <entry_zone>}
        ],
        "options": {"text": "Mean Reversion Buy (RSI: 22, Z: -2.3)"}
    })
  5. Exits: predeclare center, partial-center, opposite-band, stop, and maximum-holding-time variants; retain only net-positive held-out logic without universal win rates.

Evidence and Validation

  • Treat the setup as a testable hypothesis, not a prediction. Define thresholds, entry, invalidation, and exit before evaluating outcomes.
  • Calibrate on the same instrument, venue, session, and timeframe. Use closed candles and a held-out or walk-forward sample; record every variant tried.
  • Include spread, fees, slippage, borrow or funding, partial fills, and latency. Reject the setup when net expectancy is not positive or depends on one narrow parameter.
  • Return observed inputs, missing data, cost assumptions, entry, invalidation, exit, and a valid, watch, or no-trade status.
  • Research basis: Mean reversion is a model assumption, not a universal property. Optimal mean-reversion research derives thresholds under an Ornstein–Uhlenbeck process; verify that the spread is stationary before applying them.

Key Rules

  • Never assume a series mean reverts; verify the process and monitor parameter/stationarity breaks.
  • NEVER enter on BB touch alone; require confirmation candle (engulfing, hammer, doji)
  • Compare center and opposite-band exits rather than assigning realism beforehand.
  • A squeeze is compression, not proof that a breakout is coming.
  • Do not count BB, RSI, and z-score as independent confirmation.
  • Use a time stop tied to estimated half-life and exit on a stationarity/regime break.
  • If price is at lower BB due to fundamental repricing (earnings, news), it is not "oversold"

Related Skills

  • bollinger-bands — BB touches are the primary visual mean reversion signal
  • market-regime-detection — supply a calibrated regime feature and uncertainty state

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.