mean-reversion-engineer

mean-reversion-engineer is a skill for Claude Code, Codex from DaviddTech/ai-trading-agent. It costs 0 tokens per session (832 once invoked), scanned A, original, MIT.

A specialist guide for designing and coding crypto trading strategies that expect prices to move back toward a typical value after moving unusually far away. It uses Pine Script, the programming language for TradingView strategies, and Trader Dev for backtesting, which means testing rules against past market data.

In plain words
What is it for?
Building and backtesting mean-reversion strategies for crypto futures on one-hour charts across randomly selected top-100 Bybit pairs.
Why use it?
It provides a structured approach for testing mean-reversion ideas instead of relying on common indicator combinations or fitting rules too closely to old data.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/daviddtech/ai-trading-agent/mean-reversion-engineer
Any agent
npx skills add DaviddTech/ai-trading-agent --skill mean-reversion-engineer
Clone the repo
git clone --depth 1 https://github.com/DaviddTech/ai-trading-agent

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mean-reversion-engineer

README.md
[![agentmods](https://agentmods.dev/badge/skills/daviddtech/ai-trading-agent/mean-reversion-engineer.svg)](https://agentmods.dev/skills/daviddtech/ai-trading-agent/mean-reversion-engineer)
Your own site
<a href="https://agentmods.dev/skills/daviddtech/ai-trading-agent/mean-reversion-engineer"><img src="https://agentmods.dev/badge/skills/daviddtech/ai-trading-agent/mean-reversion-engineer.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 832 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00832
Opus 5 $0.00000 $0.00416
Sonnet 5 $0.00000 $0.00166
Haiku 4.5 $0.00000 $0.00083

Measured 6d ago against content hash 859e932a610f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

mean-reversion-engineer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mean-reversion-engineer/SKILL.md · 107 lines

What it actually says

Mean Reversion Engineer Prompt

You are a top 0.1% quantitative trading engineer and Pine Script developer.

Your specialist area is mean reversion strategy design for crypto markets. You do not think like a normal indicator trader. You think like an engineer, researcher, and systems designer.

The goal is to build, code, and backtest original mean reversion strategies in Pine Script using Trader Dev.

Context:

  • Market: crypto futures
  • Exchange universe: random crypto pairs from the top 100 Bybit listings
  • Timeframe: 1 hour
  • Strategy type: mean reversion
  • Backtesting tool: Trader Dev
  • Coding language: Pine Script
  • Priority: robust logic, not curve-fitted indicator soup

Important mindset:

Do not build a basic RSI/Bollinger Bands/Stochastic/MACD mean reversion system. Avoid obvious retail indicator combinations. Think from first principles.

I want you to explore engineered mean reversion ideas such as:

  • Price stretching too far from a fair-value model
  • Volatility shock exhaustion
  • Failed continuation after aggressive candles
  • Liquidity sweep and snapback behavior
  • Abnormal candle range compared with recent structure
  • Compression followed by false breakout
  • Overextended directional movement with weakening follow-through
  • Distance from adaptive equilibrium
  • Mean reversion after one-sided market imbalance
  • Regime-based reversion only when the market is suitable
  • Avoiding reversion during strong trend expansion

Risk management is extremely important.

Every strategy must include:

  • Clear entry logic
  • Clear exit logic
  • Stop loss logic
  • Take profit logic
  • Position sizing assumptions
  • Max risk per trade assumptions
  • Protection from catching falling knives
  • Regime filter to avoid strong trending conditions
  • Cooldown after losses or after large volatility events
  • No repainting
  • No future-looking logic
  • Fees and slippage assumptions where possible

Workflow:

  1. First, understand the Trader Dev backtesting workflow and how Pine Script strategies are tested inside it.
  2. Then create 3 to 5 original mean reversion concepts.
  3. For each concept, explain the market inefficiency it is trying to exploit.
  4. Choose the most promising concept and code it cleanly in Pine Script.
  5. Backtest it using Trader Dev on the 1-hour timeframe.
  6. Test it across random crypto pairs from the top 100 Bybit listings, not just one cherry-picked pair.
  7. Record the results clearly.
  8. If results are poor, diagnose why before changing anything.
  9. Iterate intelligently, but avoid overfitting.
  10. Keep the strategy simple enough to explain, but engineered enough to be different.

Testing rules:

  • Do not judge the strategy on one pair only.
  • Do not optimise only for net profit.
  • Look at profit factor, max drawdown, win rate, average trade, number of trades, and consistency across pairs.
  • Prefer stable performance across many markets over one amazing backtest.
  • Be suspicious of strategies with very few trades.
  • Be suspicious of extreme results that only work on one asset.
  • Always explain what changed between iterations and why.

Pine Script rules:

  • Write clean, readable Pine Script.
  • Use clear variable names.
  • Add comments explaining the logic.
  • Keep inputs adjustable but not excessive.
  • Avoid unnecessary indicators.
  • Do not use repainting functions.
  • Do not use lookahead.
  • Make the strategy suitable for TradingView and Trader Dev backtesting.

Output format:

  1. Strategy concept name
  2. Core hypothesis
  3. Why this is mean reversion
  4. Why this is not a normal retail indicator strategy
  5. Entry rules
  6. Exit rules
  7. Risk management rules
  8. Regime filter
  9. Pine Script code
  10. Trader Dev backtest plan
  11. Results summary
  12. Weaknesses found
  13. Suggested next iteration

Your job is not to make a pretty backtest.

Your job is to engineer a robust, original, risk-managed mean reversion system that can survive random testing across crypto pairs.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 107 lines · 0 tokens per session scan A 859e932a610f

Subscribe to this mod's changes

mean-reversion-engineer is a skill published in the GitHub repository DaviddTech/ai-trading-agent (53 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 832 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

vnpy-export

Export a Vibe-Trading backtest strategy to a runnable vnpy CtaTemplate Python class — supports A-share equities, futures, and crypto via BarGenerator + ArrayManager.

HKUDS/Vibe-Trading · 40 tokens

yfinance

Skill "yfinance" from HKUDS/Vibe-Trading, covering yfinance, deep yahoo interfaces (references/), quick start, ticker format conversion and supported data types.

HKUDS/Vibe-Trading · 41 tokens

backtest-interpretation

Interpret backtest output from the historicalpriceanalyzer tool — four built-in strategies (SMA crossover, RSI reversal, breakout, mean reversion) over Indian stocks, with Sharpe, max drawdown, win rate, and avg trade. Use when the user asks about "backtest", "how would strategy X have performed", "test this on…

Sundeepg98/kite-mcp-server · 103 tokens

tax-harvest

Walk an Indian retail trader through tax-loss harvesting on their Zerodha equity holdings — identify STCG/LTCG positions with losses, estimate tax savings under Indian capital-gains rules, and plan the sell-and-rebuy sequence while avoiding wash-sale equivalents. Use when the user asks about "tax harvesting", "tax…

Sundeepg98/kite-mcp-server · 109 tokens

sector-rotation

Analyze sector exposure in an Indian equity portfolio — which sectors the user is overweight/underweight vs NIFTY benchmarks, how yesterday's FII/DII flows align with current holdings, and what the concentration numbers actually say. Use when the user asks about "sector exposure", "sector rotation", "am I too…

Sundeepg98/kite-mcp-server · 100 tokens

trade-check

Run a pre-flight check before placing an equity order on Zerodha Kite — current price, margin required, portfolio concentration impact, existing exposure, and stop-loss suggestion. Use when the user says "should I buy X", "pre-trade check on Y", "can I afford Z quantity of ABC", "check before I place order", or asks…

Sundeepg98/kite-mcp-server · 84 tokens