tv_backtest_compare
Compare a Pine strategy across multiple parameter sets using TradingView's Strategy Tester. Run backtests with different parameter combinations to analyze performance.
Instructions
Compare a Pine strategy across multiple parameter sets using the Strategy Tester. Pro+ only. DESTRUCTIVE: changes the chart, saves/loads the strategy, and opens the Strategy Tester.
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": {
"source": "<source>",
"symbol": "<symbol>",
"timeframe": "<timeframe>",
"paramSets": "<paramSets>"
},
"name": "tv_backtest_compare"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Full Pine strategy v6 source including //@version=6 | |
| symbol | Yes | Symbol to test, e.g. NASDAQ:AAPL | |
| maxWaitMs | No | Max milliseconds to wait for Strategy Tester results per run (default 20000) | |
| paramSets | Yes | List of parameter maps to apply to the source (e.g. [{fastLength: 10, slowLength: 30}]) | |
| timeframe | Yes | Timeframe for the test, e.g. D, 240, 60 |