Examples / Advanced
Short QQQ below its 200-day average
Level 4 · AdvancedPOST/v1/backtest
What it answers
Tests a trend-following short: sell QQQ short when it closes below the 200-day average and cover when it closes back above, with a 10% stop.
Request
Input
POST /v1/backtest{ "symbol": "QQQ", "side": "short", "entry": "cross_below(close, sma(200))", "exit": "cross_above(close, sma(200))", "start_date": "2000-01-01", "stop_loss": 0.1, "fee_bps": 1, "slippage_bps": 2 }
Live output billed to your account
Response
Output 200 OK
{ "ok": true, "data": { "symbol": "QQQ", "start": "2000-01-03", "end": "2026-11-12", "rules": { "entry": "cross_below(close, sma(200))", "exit": "cross_above(close, sma(200))", "side": "short", "initial_capital": 10000, "position_size": 1.0, "stop_loss": 0.1, "take_profit": null, "trailing_stop": null, "max_bars": null, "cooldown_bars": 0, "fill": "next_open", "fee_bps": 1.0, "slippage_bps": 2.0 }, "stats": { "initial_capital": 10000.0, "final_equity": 4109.03, "net_profit": -5890.97, "total_return": -0.589097, "cagr": -0.032457, "max_drawdown": -0.738248, "sharpe": -0.16603, "sortino": -0.229884, "trades": 96, "win_rate": 0.135417, "avg_trade_return": -0.006935, "median_trade_return": -0.015358, "avg_trade_pnl": -61.36, "best_trade_return": 0.512204, "worst_trade_return": -0.11318, "avg_win": 834.25, "avg_loss": -201.64, "profit_factor": 0.64801, "avg_bars_held": 18.1, "exposure": 0.257659, "total_fees": 172.82, "total_slippage": 345.65, "buy_hold_return": 7.595473, "buy_hold_max_drawdown": -0.829832 }, "trades": [ { "entry_date": "2000-05-11", "exit_date": "2000-05-12", "side": "short", "entry_price": 69.828, "exit_price": 72.0768, "shares": 143.209012, "pnl": -324.08, "return": -0.032408, "fees": 2.03, "bars": 1, "exit_reason": "exit_rule" }, { "entry_date": "2000-05-22", "exit_date": "2000-05-31", "side": "short", "entry_price": 68.8839, "exit_price": 71.3049, "shares": 140.467048, "pnl": -342.04, "return": -0.035349, "fees": 1.97, "bars": 6, "exit_reason": "exit_rule" }, { "entry_date": "2000-06-01", "exit_date": "2000-06-02", "side": "short", "entry_price": 71.886, "exit_price": 78.2023, "shares": 129.842935, "pnl": -822.08, "return": -0.088075, "fees": 1.95, "bars": 1, "exit_reason": "exit_rule" }, { "entry_date": "2000-07-31", "exit_date": "2000-08-04", "side": "short", "entry_price": 73.9469, "exit_price": 77.6635, "shares": 115.107037, "pnl": -429.56, "return": -0.050466, "fees": 1.75, "bars": 4, "exit_reason": "exit_rule" }, { "entry_date": "2000-08-07", "exit_date": "2000-08-08", "side": "short", "entry_price": 76.6914, "exit_price": 77.7162, "shares": 105.386602, "pnl": -109.62, "return": -0.013563, "fees": 1.63, "bars": 1, "exit_reason": "exit_rule" }, "… 88 more items …", { "entry_date": "2025-03-27", "exit_date": "2025-05-13", "side": "short", "entry_price": 479.4694, "exit_price": 506.2591, "shares": 9.654703, "pnl": -259.6, "return": -0.056079, "fees": 0.95, "bars": 32, "exit_reason": "exit_rule" }, { "entry_date": "2026-03-23", "exit_date": "2026-04-09", "side": "short", "entry_price": 589.7593, "exit_price": 605.3857, "shares": 7.409017, "pnl": -116.66, "return": -0.026699, "fees": 0.89, "bars": 12, "exit_reason": "exit_rule" }, { "entry_date": "2026-11-06", "exit_date": "2026-11-12", "side": "short", "entry_price": 658.2183, "exit_price": 680.348, "shares": 6.461191, "pnl": -143.85, "return": -0.033824, "fees": 0.86, "bars": 4, "exit_reason": "exit_rule" } ], "trades_truncated": false, "open_trade": null, "equity_curve": [ { "date": "2000-01-03", "equity": 10000.0, "drawdown": 0.0 }, { "date": "2000-01-26", "equity": 10000.0, "drawdown": 0.0 }, { "date": "2000-02-17", "equity": 10000.0, "drawdown": 0.0 }, { "date": "2000-03-13", "equity": 10000.0, "drawdown": 0.0 }, { "date": "2000-04-04", "equity": 10000.0, "drawdown": 0.0 }, "… 416 more items …", { "date": "2026-10-15", "equity": 4252.87, "drawdown": -0.724772 }, { "date": "2026-11-06", "equity": 4266.14, "drawdown": -0.723914 }, { "date": "2026-11-12", "equity": 4109.03, "drawdown": -0.734082 } ], "monthly_returns": [ { "year": 2026, "months": [ 0.0, 0.0, 0.022298, -0.047928, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.033824, null ], "total": -0.05962 }, { "year": 2025, "months": [ 0.0, 0.0, 0.014669, -0.013212, -0.069205, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "total": -0.06803 }, { "year": 2024, "months": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "total": 0.0 }, { "year": 2023, "months": [ -0.072847, 0.000439, -0.027063, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "total": -0.097542 }, { "year": 2022, "months": [ -0.010287, -0.003815, -0.05059, 0.102739, 0.012489, 0.068175, -0.081909, 0.041061, 0.076811, -0.024226, -0.035779, 0.063693 ], "total": 0.149879 }, "… 19 more items …", { "year": 2002, "months": [ -0.026331, 0.116884, -0.050621, 0.101115, 0.035879, 0.080414, 0.042595, 0.006451, 0.049993, -0.065722, -0.058367, 0.085859 ], "total": 0.339111 }, { "year": 2001, "months": [ -0.050705, 0.151907, 0.06501, -0.051463, 0.011016, -0.007446, 0.030372, 0.038444, 0.055233, -0.033625, -0.040748, -0.076813 ], "total": 0.071107 }, { "year": 2000, "months": [ 0.0, 0.0, 0.0, 0.0, -0.066611, -0.088075, -0.021644, -0.08076, -0.015707, 0.0808, 0.200203, 0.041068 ], "total": 0.01754 } ], "notes": [ "Rules are evaluated on each bar's close; with fill=next_open orders fill at the next bar's open (no look-ahead). Daily prices are split- and dividend-adjusted.", "Trade prices include slippage; pnl is net of fees on both legs." ], "interval": "1day" }, "meta": { "op": "backtest", "units": 8, "cost_usd": 0.0, "billing": "internal", "free_call": false, "free_calls_left": 0, "balance_usd": 5.0, "ms": 29, "interval": "1day", "data_as_of": "2026-11-12", "partial_last_bar": false } }
How to read it
For a short, a positive trade return means price fell. Compare the strategy's drawdown with buy-and-hold: shorts lose in whipsaws, which shows up as many small losing trades with exit_reason signal.
Parameters and limits: Backtest reference. Analytics, not advice.