[LAB] Backtest a setup (historical P(TP1 before SL) + EV)
backtestLAB / RESEARCH tool — replay an arbitrary {symbol, entry, tp, sl} setup over MidasFlow's 1m candle history and get its historical P(TP1-before-SL) + EV, in the canonical first-touch TP1 frame (same frame as get_accuracy). Historical market DATA, NOT a prediction or advice. Low-sample setups return a directional band (normal, not an error). NOTE: live results are gated behind ff:backtest_live — until that flips, EVERY tier gets a coming-soon envelope (no live numbers). Routes: POST /v1/backtest.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sl | Yes | Stop-loss price. Direction (long/short) is inferred from tp/sl vs entry. | |
| tp | Yes | Take-profit price, or an ordered list of prices (nearest = TP1 banked first). | |
| entry | Yes | Entry price; defines the TP/SL offsets replayed over historical anchors. | |
| symbol | Yes | Perp symbol, e.g. 'BTCUSDT' (case/space-insensitive). | |
| max_hold_min | No | Forward first-touch window per anchor in minutes (clamped 15-1440). Default 240. Timeout anchors are excluded from p, not losses. | |
| lookback_days | No | Historical window to sample anchors from, in days (clamped 7-90). Default 30. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||