tool_optimize_strategy
Run parameter sweeps to optimize trading strategies, testing combinations across ranges and ranking results by metrics like Sharpe ratio to find top-performing setups.
Instructions
Run a strategy optimization / parameter sweep.
Tests multiple parameter combinations and ranks results by a metric.
param_ranges: List of parameter ranges to sweep. Each has:
rule_path: Path to the parameter, e.g. "entry_rules[0].params.period"
start: Start value (inclusive)
end: End value (inclusive)
step: Step size
constraints: Optional list of cross-parameter constraints, e.g. [{"left": "entry_rules[0].params.period", "op": "<", "right": "exit_rules[0].params.period"}]
rank_by: Metric to rank results by (default "sharpe_ratio"). Options: total_return, sharpe_ratio, max_drawdown, win_rate, profit_factor, total_trades
Returns an optimization_id. Use get_optimization_status to poll, then get_optimization_results for ranked results.
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>",
"timeframe": "<timeframe>",
"start_date": "<start_date>",
"strategy": "<strategy>",
"param_ranges": "<param_ranges>"
},
"name": "tool_optimize_strategy"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| rank_by | No | sharpe_ratio | |
| end_date | No | ||
| strategy | Yes | ||
| timeframe | Yes | ||
| commission | No | ||
| start_date | Yes | ||
| constraints | No | ||
| initial_cash | No | ||
| param_ranges | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||