§27 STRATEGY_BACKTESTER¶
Run a strategy against historical price data and read the performance ledger before committing capital.
OVERVIEW¶
Backtest is a server-side strategy backtester. Select a symbol, strategy, parameter set, date range, and starting balance. The engine pulls daily historical closes, walks bar-by-bar evaluating the strategy signal at each close, and simulates an all-cash long-only book.

- Buy signal: deploys all available cash into shares at that day's close
- Sell signal: liquidates the full position at that day's close
- Round-trip P&L is recorded at the sell; equity is marked-to-close every day
- Sharpe ratio is annualized off daily returns using the standard √252 scaling
Scope limitations
Long-only, single-symbol, daily-bar only. No shorting, no multi-asset portfolios, no intraday timing, no transaction costs, no commission or slippage modeling. Custom strategy upload is not currently available — the four strategies in the dropdown are the full set.
FEATURES¶
Strategies¶
| Strategy | Signal logic | Defaults |
|---|---|---|
rsi_crossover |
Buy when RSI(period) crosses below oversold; sell when RSI crosses above overbought |
period 14 / oversold 30 / overbought 70 |
ma_crossover |
Buy when close crosses above the moving average; sell when close crosses below. maType=0 SMA, maType=1 EMA |
period 20 |
macd_signal |
Buy on bullish MACD cross (MACD line crosses above signal line); sell on bearish cross | fast 12 / slow 26 / signal 9 |
bollinger_breakout |
Buy when price breaks below the lower band; sell when price breaks above the upper band (mean-reversion logic) | period 20 / stdDev 2.0 |
Result Metrics¶
| Metric | Definition |
|---|---|
| Total Return | (finalEquity − initialCapital) / initialCapital × 100 |
| Buy & Hold | Same window, all cash deployed at the first close, marked at the last close |
| Max Drawdown | Peak-to-trough decline of the strategy equity curve |
| Sharpe Ratio | Annualized Sharpe off daily returns, √252 scaling |
| Win Rate | Percentage of closed trades with positive P&L |
| Total Trades | Count of completed round-trip trades |
| Final Equity | Closing portfolio value at end of window |
| vs Buy & Hold | Total Return minus the Buy & Hold return for the same window |
Output Panels¶
Summary cards — eight metrics displayed with green/red coloring matched to the sign of the result.
Equity curve — strategy line (solid) plotted against buy-and-hold (dashed) over the full date range. The shape of the curve — particularly drawdown behavior — is more informative than the endpoint alone.
Trade log — bar-by-bar entry and exit table showing date, price, share count, dollar P&L, and percent P&L for every completed trade. Use this to identify whipsaw runs and individual blow-up trades.
ACCESS¶
| Item | Detail |
|---|---|
| Path | /backtest |
| Keyboard shortcut | None |
| Sidebar location | §TOOLS group |
| Required tier | Pro and above |
Tier gate
Free accounts see the upgrade gate. Access is enforced server-side as well as in the app — the backtest cannot be run from a Free account regardless of how the request is made.
HOW TO USE¶
- Open
/backtest. The form loads pre-filled withAAPL,RSI Crossover, default parameters,2024-01-01to2026-01-01, and$10,000initial capital. - Enter a Symbol. Input is uppercased automatically.
- Select a Strategy from the dropdown. Changing the strategy resets all parameters to that strategy's defaults.
- Set Start Date and End Date. The window must contain at least 50 trading days of available history — shorter windows return an error.
- Set Initial Capital. Must be greater than 0.
- Adjust strategy parameters in the second row. Each strategy exposes its own parameter set — see the Strategies table above for the full field list per strategy.
- Click [ RUN_BACKTEST ]. The button changes to [ RUNNING... ] while data is pulled and the engine runs — typically two to ten seconds.
- Review the eight summary cards, the equity curve, and the trade log.
Reading the results
Do not use the absolute return numbers to validate a real trading system. The absence of commission, slippage, intraday timing, and short capability means headline returns are optimistic. Focus on the delta between strategy and buy-and-hold, and the shape of the equity curve — particularly whether the strategy moves to cash ahead of significant drawdowns.
WHEN TO USE¶
- First-pass edge check — does RSI(14) with 30/70 thresholds beat buy-and-hold on a given name over the last two years?
- Strategy family comparison — same window, same capital, swap RSI → MACD → Bollinger and compare Sharpe deltas.
- Parameter sweep — change RSI period from 14 to 21 and observe win rate movement.
- Drawdown stress test — bracket a known bear cycle with the date range and check whether the strategy moves to cash or rides it down.