Backtesting Trading Strategies
Simulates past trades to evaluate strategy performance and risk, helping users refine their plans for future profitability.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add gracefullight-backtesting-trading-strategies npx -- -y @trustedskills/gracefullight-backtesting-trading-strategies
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"gracefullight-backtesting-trading-strategies": {
"command": "npx",
"args": [
"-y",
"@trustedskills/gracefullight-backtesting-trading-strategies"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill allows AI agents to backtest trading strategies against historical data, simulating past trades to evaluate performance and risk before deploying them with real capital. It provides a complete framework including eight pre-built strategies, comprehensive performance metrics, and parameter optimization capabilities. The tool helps users refine their trading plans by analyzing trade history and identifying optimal strategy settings.
When to use it
- Strategy Validation: Before risking real money, test the viability of a new or modified trading strategy.
- Parameter Optimization: Fine-tune existing strategies by finding the best parameter combinations for maximum profitability and acceptable risk.
- Performance Analysis: Understand how a strategy performed in the past, including key metrics like Sharpe Ratio, Sortino Ratio, and Maximum Drawdown.
- Risk Assessment: Evaluate potential risks associated with a trading strategy through metrics such as Value at Risk (VaR) and Conditional Value at Risk (CVaR).
Key capabilities
- 8 Pre-built Trading Strategies: SMA, EMA, RSI, MACD, Bollinger Bands, Breakout, Mean Reversion, Momentum.
- Performance Metrics: Sharpe Ratio, Sortino Ratio, Calmar Ratio, VaR, CVaR, Max Drawdown, Total Return, CAGR, Volatility.
- Trade-by-trade Analysis: Detailed log of individual trades with profit/loss information.
- Equity Curve Visualization: Graphical representation of portfolio value over time.
- Parameter Grid Search Optimization: Automated search for optimal strategy parameters.
Example prompts
- "Run a backtest on the SMA crossover strategy for BTC-USD using the last year of data."
- "Optimize the RSI reversal strategy for ETH-USD, varying the period and overbought/oversold levels."
- "Show me the performance metrics (Sharpe Ratio, Max Drawdown) for the Bollinger Bands strategy applied to BTC-USD over a two-year period."
Tips & gotchas
- Dependencies: Requires
pandas,numpy,yfinance, andmatplotlib.ta-lib,scipy, andscikit-learnare optional for advanced features. Install these usingpip install .... - Data Fetching: The skill automatically caches historical data to avoid repeated downloads. Ensure the correct symbol and period are specified when fetching data.
- Parameter Formatting: When specifying custom parameters, use a valid JSON string format (e.g.,
'{"period": 14, "overbought": 70}').
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.