backtest_strategy
Backtest an SMA crossover strategy: buy when short SMA crosses above long SMA, sell when below. Compare returns to buy-and-hold.
Instructions
Backtest a Simple Moving Average (SMA) crossover strategy. [PRO]
Tests: Buy when short SMA crosses above long SMA, sell when it crosses below. Compares strategy return vs buy-and-hold.
Args: symbol: Stock ticker (e.g., RELIANCE, AAPL, TCS) short_window: Short SMA period in days (default: 20) long_window: Long SMA period in days (default: 50) period: Backtest period: 1y, 2y, 5y (default: 2y) initial_capital: Starting capital (default: 100000)
Examples: backtest_strategy("RELIANCE") → Default 20/50 SMA backtest backtest_strategy("AAPL", 10, 30, "5y") → Custom 10/30 SMA, 5 years backtest_strategy("TCS", 50, 200, "5y", 500000) → Golden cross, 5L capital
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"symbol": "<symbol>"
},
"name": "backtest_strategy"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | 2y | |
| symbol | Yes | ||
| long_window | No | ||
| short_window | No | ||
| initial_capital | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |