Strategies
Run strategy scripts on the chart and review the backtest overlay.
A strategy script plots on the active chart and shows its trades and performance on that same chart. This page is about reading a strategy that is already there. To have Quant write one, see Making strategies.
Run
When the editor holds a strategy(...) script, click Run (signed in). The strategy executes over the chart's history: the chart marks every entry and exit, and a Backtest Summary strip appears below with the headline numbers:
| Metric | What it tells you |
|---|---|
| Net profit | Total profit and loss across all closed trades |
| Trades | Number of closed trades. Treat any metric with few trades behind it as noise |
| Win rate | Percentage of trades that closed profitable. Meaningless in isolation: a 30% win rate with large winners can outperform a 70% win rate with large losers |
| Max drawdown | The largest peak-to-trough drop in equity along the way: the pain you would have had to sit through |
| Profit factor | Gross profit divided by gross loss. Above 1 means the strategy made more than it lost; the further above, the better |
The strip can also toggle a historical net profit chart. Use the maximize button on the strip to open the full viewer.
Backtest viewer
The maximized viewer has three tabs:
- Performance: the net profit curve, summary metrics, net daily P&L, weekday performance, and a performance table broken out by all trades, longs only, and shorts only. The long/short split is worth checking: many strategies make all their money on one side.
- Trades Analysis: distribution views (P&L distribution, win rate, trade duration vs. P&L, and an analysis table). This is where you spot whether performance comes from many small edges or a few outliers.
- Trades Log: every trade, searchable, with entry, exit, net P&L, and cumulative P&L. Switch to the calendar view for daily results.
You can change the symbol and timeframe from inside the viewer to re-run the same strategy on different data without leaving the chart, the quickest way to check whether an edge survives outside the market it was built on.
Script settings
Open the settings gear in the toolbar:
- Inputs: the script's
input.*parameters (lengths, thresholds, toggles, whatever the script exposes). Changes re-run the backtest immediately, so you can sweep a parameter and watch the summary strip react. - Properties (strategies only): the simulation settings, independent of the script's logic:
- Initial capital: starting equity for the simulation
- Order size: how much each entry commits
- Pyramiding: how many entries may stack in the same direction
- Commission and slippage: per-trade costs; leaving these at zero flatters every strategy, so set them realistically before trusting the numbers
- Margin: leverage constraints
Saving
Star a run from the summary strip or the viewer. A saved strategy keeps everything needed to reproduce it: the script, symbol, timeframe, inputs, and backtest properties.
Results can differ across data feeds and fill models. Re-run on the symbol and timeframe you care about rather than trusting numbers produced elsewhere.