ai-trading-agent
Build your own AI hedge fund with Claude, Codex, Cursor & OpenClaw. The agent-native skills directory for Trader Dev MCP โ write Pine Script, backtest crypto strategies, optimize parameters.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/daviddtech--ai-trading-agent)HTML
<a href="/listings/daviddtech--ai-trading-agent"><img src="/api/listings/daviddtech--ai-trading-agent/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
> ๐ค **Prefer to hand it all to your AI?** Open [WORKBOOK.md](WORKBOOK.md) and paste it into any MCP-capable agent. It's a step-by-step, self-contained install and usage guide written for AI agents to follow top to bottom.
<div align="center">
https://github.com/user-attachments/assets/95757099-9a4c-4fea-a618-9b015eec942e
*โถ Full install walkthrough โ under a minute.*
</div>
**1. Install Trader Dev MCP in your agent (pick one):**
# Claude Code claude mcp add --transport sse --scope user trader-dev https://mcp.trader.dev/sse
# Codex codex mcp add trader-dev -- npx -y mcp-remote https://mcp.trader.dev/sse
# Cursor / OpenClaw / Cline / Continue / Windsurf / Gemini CLI Register https://mcp.trader.dev/sse as a remote SSE MCP server.
**2. Paste this one-liner to your agent:**
Read https://raw.githubusercontent.com/DaviddTech/ai-trading-agent/main/SKILL.md and help me build an AI hedge fund research desk using Trader Dev MCP.
**3. Ship your first backtest:**
Backtest a Bollinger Band squeeze breakout on the top 10 Bybit pairs at 1h. Report profit factor, max drawdown, and stability across symbols. Reject overfit results.
That's it. Your agent is now a quant.
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md ยท Manifest ยท 183 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- # AI Trader MCP Skill
- You are an AI trading research assistant connected to Trader Dev MCP.
- Your job is to help the user build an AI-powered quant research workflow using Pine Script, backtesting, optimisation, and disciplined reporting.
- ## Core principle
- Do not behave like a hype trading bot.
- Behave like a careful research assistant working inside an AI hedge fund lab.
- You must:
- 1. Understand the user's strategy goal.
- 2. Check that Trader Dev MCP tools are available.
- 3. Use the available MCP tool schemas instead of guessing arguments.
- 4. Write or inspect Pine Script carefully.
- 5. Backtest before making claims.
- 6. Compare results across symbols and timeframes.
- 7. Report weaknesses honestly.
- 8. Avoid overfitting.
- 9. Prioritise risk-adjusted performance over pretty equity curves.
- ## MCP setup
- Trader Dev MCP endpoint:
- ```text
- https://mcp.trader.dev/sse
- ```
- Claude Code:
- ```bash
- claude mcp add --transport sse --scope user trader-dev https://mcp.trader.dev/sse
- ```
- Codex:
- ```bash
- codex mcp add trader-dev -- npx -y mcp-remote https://mcp.trader.dev/sse
- ```
- OpenClaw:
- ```text
- Add https://mcp.trader.dev/sse as a remote SSE MCP server, then read this SKILL.md file.
- ```
- ## Market support
- Current support: crypto pairs.
- If the project gets enough demand, future support may include forex, stocks, futures, and additional data sources.
- ## Main workflows
- ### Workflow 1: Backtest a Pine Script strategy
- When the user provides Pine Script:
- 1. Read the full code.
- 2. Identify whether it is an indicator or a strategy.
- 3. If it is an indicator, explain what must be converted to create a strategy.
- 4. Check for repainting, lookahead, and future-looking logic.
- 5. Prepare the strategy for Trader Dev backtesting.
- 6. Backtest it across crypto pairs and timeframes.
- 7. Report the results.
- Metrics to report:
- - Net profit
- - Profit factor
- - Max drawdown
- - Win rate
- - Average trade
- - Number of trades
- - Average win
- - Average loss
- - Long performance
- - Short performance
- - Stability across symbols
- - Stability across timeframes
- ### Workflow 2: Build a new strategy
- When the user wants new strategy research:
- 1. Start from a mathematical hypothesis.
- 2. Do not use existing website strategies.
- 3. Do not optimise old strategies.
- 4. Do not copy retail indicator recipes.
- 5. Convert the hypothesis into Pine Script rules.
- 6. Backtest the strategy using Trader Dev.
- 7. Diagnose results.
- 8. Iterate scientifically.
- ### Workflow 3: Optimise an existing strategy
- When the user wants an optimizer:
- 1. Use `mcp__trader-dev__search_strategies` when available.
- 2. Select a strategy that already shows potential.
- 3. Fork the strategy.
- 4. Preserve a clean baseline.
- 5. Change one major idea at a time.
- 6. Backtest each version.
- 7. Keep only variants with meaningful risk-adjusted improvement.
- ### Workflow 4: Position optimisation
- When the user wants position optimisation:
- 1. Do not change entries or exits.
- 2. Optimise only position size, leverage, risk, Kelly fraction, drawdown throttle, volatility sizing, anti-martingale, or bounded recovery logic.
- 3. Compare against the baseline.
- 4. Report whether improvement came from genuine efficiency or simply more leverage.
- 5. Never hide liquidation risk, risk of ruin, or drawdown expansion.
- ## Research standards
- Always favour:
- 1. Robustness across symbols
- 2. Drawdown control
- 3. Profit factor
- 4. Average trade quality
- 5. Meaningful trade count
- 6. Stability across nearby timeframes
- 7. Simplicity
- 8. Net profit
- Never favour:
- - One amazing cherry-picked backtest
- - Low trade count results
- - Hidden overfitting
- - Unlimited martingale
- - Future-looking logic
- - Repainting
- - Ignoring fees or slippage
- - Ignoring liquidation risk
- ## Reporting format
- Use this format whenever possible:
- ```markdown
- # Trader Dev Research Report
- ## 1. Goal
- ## 2. Strategy or Hypothesis
- ## 3. Pine Script Changes
- ## 4. Backtest Matrix
- Symbols:
- Timeframes:
- Assumptions:
- ## 5. Results
- Net profit:
- Profit factor:
- Max drawdown:
- Win rate:
- Average trade:
- Trades:
- ## 6. Robustness Analysis
- ## 7. Weaknesses
- ## 8. Next Iteration
- ## 9. Verdict
- Reject / Watchlist / Incubate / Candidate / Production candidate
- ```
- ## Risk notice
- This skill is for research and education only. It is not financial advice. Do not encourage reckless live trading. Backtests are not guarantees of future performance.
README.md ยท README ยท 323 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- <div align="center">
- # AI Trader MCP
- ### Build your own AI hedge fund with Claude, Codex, Cursor, and OpenClaw.
- The agent-native skills directory for **Trader Dev MCP** โ write Pine Script, backtest crypto strategies, optimize parameters, and run a full quant research desk from one conversation.
- [](https://github.com/DaviddTech/ai-trading-agent/stargazers)
- [](https://github.com/DaviddTech/ai-trading-agent/network/members)
- [](LICENSE)
- [](https://github.com/DaviddTech/ai-trading-agent/commits/main)
- [](https://trader.dev/)
- [](#-30-second-quickstart)
- [](#-30-second-quickstart)
- [](#-30-second-quickstart)
- [](#-what-you-can-build)
- **[Quickstart](#-30-second-quickstart)** ยท **[Workbook](WORKBOOK.md)** ยท **[Skills](#-the-skills-directory)** ยท **[Examples](#-example-session)** ยท **[Roadmap](#-roadmap)** ยท **[Discord](#-community)** ยท **[YouTube](#-community)**
- </div>
- ---
- > โ ๏ธ **Research and education only.** AI Trader MCP does not place real trades, send real orders, or guarantee profits. Backtests are not future performance. Crypto trading is risky and leverage can cause catastrophic losses. Read [docs/DISCLAIMER.md](docs/DISCLAIMER.md) before doing anything.
- ---
- <div align="center">
- https://github.com/user-attachments/assets/fabc1c81-dab0-4ce5-863d-2d5fa633a579
- *โถ Watch the AI hedge fund desk in action โ 60 seconds.*
- </div>
- > *"Just like human traders have TradingView, AI agents need their own quant research desk."*
- Most AI tools help traders write code. **AI Trader MCP helps AI agents run the entire research workflow** โ generate hypotheses, write Pine Script, backtest, optimize, compare, and report. Built by [DaviddTech](https://davidd.tech), backtesting live on YouTube for 5+ years.
- ## โก 30-second quickstart
- > ๐ค **Prefer to hand it all to your AI?** Open [WORKBOOK.md](WORKBOOK.md) and paste it into any MCP-capable agent. It's a step-by-step, self-contained install and usage guide written for AI agents to follow top to bottom.
- <div align="center">
- https://github.com/user-attachments/assets/95757099-9a4c-4fea-a618-9b015eec942e
- *โถ Full install walkthrough โ under a minute.*
- </div>
- **1. Install Trader Dev MCP in your agent (pick one):**
- ```bash
- # Claude Code
- claude mcp add --transport sse --scope user trader-dev https://mcp.trader.dev/sse
- ```
- ```bash
- # Codex
- codex mcp add trader-dev -- npx -y mcp-remote https://mcp.trader.dev/sse
- ```
- ```text
- # Cursor / OpenClaw / Cline / Continue / Windsurf / Gemini CLI
- Register https://mcp.trader.dev/sse as a remote SSE MCP server.
- ```
- **2. Paste this one-liner to your agent:**
- ```text
- Read https://raw.githubusercontent.com/DaviddTech/ai-trading-agent/main/SKILL.md
- and help me build an AI hedge fund research desk using Trader Dev MCP.
- ```
- **3. Ship your first backtest:**
- ```text
- Backtest a Bollinger Band squeeze breakout on the top 10 Bybit pairs at 1h.
- Report profit factor, max drawdown, and stability across symbols.
- Reject overfit results.
- ```
- That's it. Your agent is now a quant.
- ## ๐ฅ Why AI Trader MCP
- | Without AI Trader MCP | With AI Trader MCP |
- |---|---|
- | Open TradingView, hand-code Pine Script, click backtest, copy results into a spreadsheet. | "Backtest this strategy on the top 10 Bybit pairs at 1h." Done in one message. |
- | Click-optimize parameters one input at a time. | Parameter sweeps across stop loss, take profit, ATR multiples, regime filters โ natural language. |
- | Forget which version of a strategy worked last week. | Strategies live in Trader Dev. Fork, version, compare, promote, demote โ all from chat. |
- | Pay for a quant team. | Spin up a Mathematician, Mean-Reversion Engineer, Strategy Optimizer, and Position Optimizer โ for free. |
- | Wonder if your backtest is curve-fit. | Built-in robustness discipline: multi-pair, multi-timeframe, drawdown control, honest verdict labels. |
- | Use AI to *write* code. | Use AI to *run the whole research desk.* |
- ## ๐ญ Don't want to build your own strategies?
- Not every trader wants to be a quant researcher. If you'd rather skip the research and run trading bots that already work, **[StrategyFactory.ai](https://strategyfactory.ai)** is where they live.
- - **400+ trading bots** โ every one **backtested *and* forward-tested with real-money live results**
- - **No Pine Script knowledge required** โ pick a bot, plug in, go
- - **Real performance data** โ not curve-fit screenshots, not "based on backtest" โ actual live results
- - **Plays nicely with this repo** โ the AI Trader MCP skills can analyze, fork, and improve any Strategy Factory bot
- | Path | What you do | Where to start |
- |---|---|---|
- | ๐ **Build it yourself** | Use the skills, prompts, and loop roles in this repo. Pine Script + backtests + optimization, all from chat. | Stay here |
- | ๐ **Use what already works** | Browse the marketplace, pick a bot, plug into your trading stack. | [strategyfactory.ai](https://strategyfactory.ai) |
- > **[โ Browse 400+ live-tested trading bots at StrategyFactory.ai โ](https://strategyfactory.ai)**
- ## ๐ง The skills directory
- Each skill is a focused, agent-readable `SKILL.md` that turns your AI client into a specialist on the desk.
- | Skill | What it does |
- |---|---|
- | **[Main SKILL.md](SKILL.md)** | The entrypoint. Routes your agent into the right workflow. Start here. |
- | **[AI Hedge Fund Manager](skills/ai-hedge-fund/SKILL.md)** | Coordinates the research desk. Picks specialists. Enforces discipline. |
- | **[Quant Mathematician](skills/quant-mathematician/SKILL.md)** | Renaissance-style first-principles strategy creation. No retail indicator soup. |
- | **[Mean Reversion Engineer](skills/mean-reversion-engineer/SKILL.md)** | Engineered mean-reversion systems for crypto. Volatility-aware, regime-filtered. |
- | **[Strategy Optimizer](skills/strategy-optimizer/SKILL.md)** | Searches Trader Dev for existing strategies. Forks. Improves. Compares against baseline. |
- | **[Position Optimizer](skills/position-optimizer/SKILL.md)** | Tests leverage, fractional Kelly, vol-targeting, drawdown throttling, bounded recovery. Keeps entries frozen. |
- Plus copy-paste workflow prompts in [`prompts/`](prompts/) and [`examples/`](examples/).
- ## ๐ The 24/7 desk โ loop roles
- One conversation. Fifteen specialists. Forever. **Every role is TradingView-native** โ pure Pine Script and OHLCV, no off-chain data feeds.
- Drop any of these into your AI client's `/loop` command and walk away. Each role fires every 15 minutes, runs one focused research cycle through Trader Dev MCP, and writes a structured report.
- ```bash
- # Greenfield strategy creation, every 15 minutes
- /loop 15m read loop/01-quant-mathematician.md and execute it
- # Risk audits the existing book, every 15 minutes
- /loop 15m read loop/08-risk-manager.md and execute it
- ```
- | Category | Roles |
- |---|---|
- | ๐ฏ Coordination | [Hedge Fund Manager](loop/00-ai-hedge-fund-manager.md) |
- | ๐งฎ Strategy creation | [Quant Mathematician](loop/01-quant-mathematician.md) ยท [Mean Reversion Engineer](loop/02-mean-reversion-engineer.md) ยท [Trend Following Engineer](loop/03-trend-following-engineer.md) ยท [Volatility Strategist](loop/04-volatility-strategist.md) ยท [Breakout Engineer](loop/05-breakout-engineer.md) |
- | ๐ง Optimization | [Strategy Optimizer](loop/06-strategy-optimizer.md) ยท [Position Optimizer](loop/07-position-optimizer.md) |
- | ๐ก Risk & robustness | [Risk Manager](loop/08-risk-manager.md) ยท [Drawdown Auditor](loop/09-drawdown-auditor.md) ยท [Overfitting Detector](loop/10-overfitting-detector.md) |
- | ๐ Structural & pattern | [Multi-Timeframe Strategist](loop/11-multi-timeframe-strategist.md) ยท [Liquidity Sweep Hunter](loop/12-liquidity-sweep-hunter.md) ยท [Pattern Recognition Strategist](loop/14-pattern-recognition-strategist.md) |
- | ๐งช Experimental | [Calendar & Lunar Cycle Strategist](loop/13-moon-phase-strategist.md) |
- Full guide: [loop/README.md](loop/README.md).
- ## ๐ What you can build
- - **An AI hedge fund research desk** โ generate hypotheses โ Pine Script โ backtest โ compare โ report.
- - **A Pine Script generator** โ paste a strategy idea, get clean, no-repaint, no-lookahead Pine.
- - **A TradingView backtest worker** โ paste any Pine script, get a multi-pair, multi-timeframe robustness report.
- - **A parameter optimizer** โ sweep stops, TPs, ATR multiples, filters; reject overfits.
- - **A position-sizing lab** โ improve P&L by tuning leverage/Kelly/vol-targeting *without* changing entries.
- - **A live signal monitor** โ pipe Trader Dev signals to Telegram alerts.
- - **A strategy fork-and-improve loop** โ search the strategy library, fork winners, iterate one variable at a time.
- ## ๐ค Works with
- <div align="center">
- |  |  |  |  |  |  |  |  |
- |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
- </div>
- If your agent speaks MCP, AI Trader MCP works.
- ## ๐ฌ Example session
- ```text
- You: I want to test a volatility breakout idea on crypto.
- Use the Quant Mathematician skill.
- Agent: Hypothesis: when realized volatility compresses below the
- 20-period historical median for 8+ bars, a breakout in
- either direction has positive expectancy on 1h crypto.
- [writes Pine Script โ no repaint, no lookahead]
- [calls mcp__trader-dev__run_backtest across 10 pairs ร 4 timeframes]
- Results:
- Net profit: +38.4%
- Profit factor: 1.62
- Max drawdown: -14.1%
- Trades: 412
- Stable on 7/10 pairs across 1h, 2h, 4h.
- Fails on BTC and ETH โ needs trend filter.
- Verdict: Incubate.
- Next iteration: add ADX < 25 regime filter.
- ```
- *(Illustrative format. Numbers depend on your strategy, market, and assumptions.)*
- ## ๐ Powered by Trader Dev MCP
- [Trader Dev](https://trader.dev/) is the live MCP server doing the heavy lifting. Agents connected to it can:
- - ๐ `search_strategies` โ discover proven strategy ideas
- - โ๏ธ `create_strategy` / `update_strategy` / `fork_strategy` โ version your research
- - ๐ `run_backtest` / `quick_backtest` โ backtest Pine Script across crypto pairs
- - ๐ฏ `optimize_strategy` โ automated parameter sweeps
- - ๐ฌ `compare_backtests` โ diff versions side by side
- - ๐ `get_equity_curve` / `get_trades` / `get_backtest_result` โ pull granular metrics
- - ๐ก `get_recent_signals` / `list_active_alerts` / `test_telegram_sink` โ live signal monitoring
- - ๐ผ `promote_strategy` / `demote_strategy` โ lifecycle management
- Full tool reference: [docs/AGENT_GUIDE.md](docs/AGENT_GUIDE.md). Agents should always call `tools/list` first โ never guess arguments.
- ## ๐ช Current market support
- Trader Dev currently works on **crypto pairs**.
- If we get enough interest, we'll add **US stocks, Forex, and Futures** next.
- ## ๐บ Roadmap
- **Live now**
- - Trader Dev MCP server (SSE)
- - Pine Script backtesting from any MCP-compatible agent
- - Crypto pair coverage
- - Parameter and position optimization workflows
- - 5 specialist agent skills + prompt library
- - Telegram alert workflows
- **In progress**
- - Native AI Trader alert system (less reliance on TradingView alerts)
- - Backtest screenshots and shareable report cards pulled from the web app
- - Downloadable Pine Scripts from the web app
- - Risk Manager, PineScript Developer, Backtest Analyst, and Report Writer skills
- - Walk-forward and Monte Carlo robustness checks
- **Community-requested**
- - Forex, stocks, futures
- - More exchange data sources
- - Strategy tournament leaderboards
- - AI quant team presets by trading style
- ## ๐งช Research standards
- This is not a hype trading bot. The skills are written to enforce:
- - โ Robustness across symbols and nearby timeframes
- - โ Drawdown control and profit factor over raw net profit
- - โ Honest verdict labels โ *Reject / Watchlist / Incubate / Candidate / Production candidate*
- - โ No repainting, no lookahead, no future data
- - โ No martingale without strict caps
- - โ No one-coin cherry-picked backtests
- - โ No hidden liquidation risk
- ## โญ Star history
- [](https://star-history.com/#DaviddTech/ai-trading-agent&Date)
- If this repo saves you a single evening of manual backtesting, **[give it a star](https://github.com/DaviddTech/ai-trading-agent)**.
- ## ๐ค Contributing
- Great contributions:
- - New prompts and agent skills
- - Pine Script strategy templates
- - Backtest report formats
- - Risk-management workflows
- - Translations
- - Demo videos and screenshots
- See [CONTRIBUTING.md](CONTRIBUTING.md). Open an issue with [`Skill request`](.github/ISSUE_TEMPLATE/skill_request.md) or share a result with [`Backtest result`](.github/ISSUE_TEMPLATE/backtest_result.md).
- ## ๐ Community
- - ๐ฆ **Twitter / X** โ follow [@DaviddTech](https://twitter.com/DaviddTech) for new strategies and AI quant updates
- - ๐ฅ **YouTube** โ 5 years of live strategy backtesting on [DaviddTech](https://www.youtube.com/@DaviddTech)
- - ๐ **Website** โ [davidd.tech](https://davidd.tech)
- - ๐ฌ **Discord** โ *coming soon โ watch the repo to be notified*
- ## โ FAQ
- **Is this a trading bot?**
- No. It is a skills directory that lets AI agents talk to the Trader Dev MCP server. Trader Dev runs the backtests; the skills tell your agent how to behave like a quant researcher.
- **Does it place real trades?**
- No. AI Trader MCP is for research, backtesting, and education. Live signals can be piped to Telegram, but execution is your responsibility.
- **Which AI agents are supported?**
- Anything that speaks MCP โ Claude Code, Codex, Cursor, OpenClaw, Cline, Continue, Windsurf, Gemini CLI, and any custom agent using the [Model Context Protocol](https://modelcontextprotocol.io).
- **Why Pine Script?**
- Because TradingView is where most traders already live, and Pine Script is the fastest path from idea to backtest. Python/Polars support is on the roadmap.
- **How is this different from `virattt/ai-hedge-fund`?**
- That repo is a Python simulation of named-investor personas. AI Trader MCP is the **infrastructure layer** โ an MCP server plus skills that any AI agent can use to actually generate, backtest, and optimize Pine Script strategies. They are complementary.
- **Do I need a Trader Dev account?**
- Some MCP tools require authentication. See [docs/QUICKSTART.md](docs/QUICKSTART.md).
- **Will this make me money?**
- No promises, no guarantees, no financial advice. See the disclaimer.
- ## ๐ก Risk notice
- Trading is risky. Crypto is risky. Leverage is risky. Backtests are not guarantees. This project is for **research, backtesting, and education only**. Always paper trade and forward test before considering any live deployment. The authors and contributors accept no responsibility for losses. Full text: [docs/DISCLAIMER.md](docs/DISCLAIMER.md).
- ## ๐ License
- MIT โ see [LICENSE](LICENSE).
- ---
- <div align="center">
- **Built by [DaviddTech](https://davidd.tech) ยท Powered by [Trader Dev](https://trader.dev/)**
- If AI agents should become real trading research assistants, **[star the repo โญ](https://github.com/DaviddTech/ai-trading-agent)**.
- </div>
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If itโs helped, pass it on.