Backtest a rule-based strategy on TraderWAI historical 1-minute data and get every trade plus a summary (win rate, total R, drawdown). It uses the SAME rules and engine as create_conditional_order, so a rule that looks good can be turned into a live conditional order. Pure calculation on the server, no AI: use it whenever the user asks to backtest or "how would this have worked" — do not compute backtests yourself from get_ohlc candles. Levels can be daily references so the rule works every day: {"ref":"session_high","session":"asia"} (asia 00:00-07:00, london 07:00-16:00, new_york 13:00-21:00 UTC), {"ref":"range_high","start":"00:00","end":"06:00"}, {"ref":"prev_day_low"}; the rule is armed each day once its levels are known. Example — "buy EUR/USD when it breaks the Asian high": symbol EUR_USD, conditions [{"type":"close_above","timeframe":"M15","level":{"ref":"session_high","session":"asia"}},{"type":"time_window","start":"07:00","end":"12:00"}], trade {"side":"buy","stop":{"type":"level","ref":{"ref":"session_low","session":"asia"}},"target":{"type":"rr","value":2},"closeAt":"20:00"}. Example — "sell gold when it sweeps the Asian high": conditions [{"type":"sweep_above","timeframe":"M15","level":{"ref":"session_high","session":"asia"},"maxCandles":2}], trade {"side":"sell","stop":{"type":"wick","bufferPips":20},"target":{"type":"rr","value":2}}. Indicators and trend filters: any level can be {"ref":"indicator","indicator":"sma|ema|rsi|atr|highest|lowest","timeframe":"D1","period":50}, {"ref":"price"}, {"ref":"day_open"} or {"ref":"day_high","daysAgo":2}; combine them with compare (e.g. {"type":"compare","left":{"ref":"price"},"op":"above","right":{"ref":"indicator","indicator":"ema","timeframe":"D1","period":50}}) and candle_direction (e.g. yesterday bullish). Indicators use closed candles only. Example — "buy gold on the first retest of a bullish M15 FVG in London": conditions [{"type":"fvg_retest","timeframe":"M15","direction":"bullish","maxCandles":20},{"type":"time_window","start":"07:00","end":"12:00"}], trade {"side":"buy","stop":{"type":"wick","bufferPips":10},"target":{"type":"rr","value":2}} (the wick stop goes beyond the gap's far edge). Limit entries and time exits: trade.entry {"type":"limit","at":{"type":"fvg","point":"midpoint"},"expiryMinutes":60} waits for price to come back to the limit (unfilled signals are reported), trade.maxMinutes closes after N minutes, and the target can be "none" with a time exit. Example — "when a bearish M15 FVG forms on gold, sell limit at its midpoint, stop above the gap, 2R or close after 2 hours": conditions [{"type":"fvg_formed","timeframe":"M15","direction":"bearish"}], trade {"side":"sell","entry":{"type":"limit","at":{"type":"fvg","point":"midpoint"},"expiryMinutes":60},"stop":{"type":"wick","bufferPips":20},"target":{"type":"rr","value":2},"maxMinutes":120}. Example — "buy the break and retest of today's 08:00-10:00 UTC range high": conditions [{"type":"retest","timeframe":"M15","direction":"up","level":{"ref":"range_high","start":"08:00","end":"10:00"},"maxCandles":10}], trade {"side":"buy","stop":{"type":"wick","bufferPips":5},"target":{"type":"rr","value":2}} (the wick stop goes below the retest candle; same rule and result as a live conditional). A limit entry at a level can be shifted with trade.entry.at.pips (positive above, negative below the level). COSTS: costs {"spreadPips","slippagePips","commissionPerLot" (USD, gold/silver/USD forex) or "commissionPips"} are charged on buys AND sells and the result shows R gross and net (spreadPips alone works the same). Always add realistic costs for strategies with small stops (M1/M5). RESULT DETAIL: every trade has its stop size in pips, MFE and MAE in R (how far it went for / against before closing), and the summary breaks the result down by month, by halves of the period, by weekday and entry hour, with profit factor and how many trades reached +1R…+4R: use it to choose the target and stop instead of running one backtest per variant; allTrades:true lists every trade (up to 300). STOP AT THE GAP: trade.stop {"type":"fvg","edge":"far","bufferPips":30} puts the stop beyond the far edge of the fvg_retest/fvg_formed gap, and "edge":"pattern" beyond the high/low of the three candles that form it; with a limit entry at the far edge use "pattern" (a far-edge stop would sit right next to the entry). trade.minStopPips/maxStopPips skip signals with a stop outside that size (counted). MANAGEMENT: trade.management {"breakevenAtR":1,"partials":[{"atR":1,"closePct":50}]} moves the stop to entry at +1R and closes half at +1R. LOCAL MARKET TIME: time_window, range_high/range_low and trade.closeAt accept "timezone" (e.g. Europe/London, America/New_York), so a London 08:00-11:00 window is measured at the same market hour in summer and winter. MARKET STRUCTURE: swings, BOS/CHoCH, order blocks, flip zones (broken base), Fibonacci of the last impulse, FVGs and equal highs/lows are detected candle by candle without look-ahead (see the condition types). Example — "sell gold on the first retest of a bearish order block + Fibonacci 0.5-0.618 + broken base overlap on M15, rejection candle on M5, bearish day, stop above the zone, target the last swing low, exit if no new low in 6 M5 candles": conditions [{"type":"bos","timeframe":"M15","direction":"bearish"},{"type":"confluence","direction":"bearish","zones":[{"zone":"order_block","timeframe":"M15"},{"zone":"flip_zone","timeframe":"M15"},{"zone":"fib_zone","timeframe":"M15","from":0.5,"to":0.618}],"min":2,"trigger":"rejection","confirmTimeframe":"M5","maxTouches":3},{"type":"compare","left":{"ref":"price"},"op":"below","right":{"ref":"day_open"}}], trade {"side":"sell","stop":{"type":"zone","edge":"far","bufferPips":20},"target":{"type":"level","ref":{"ref":"swing_low","timeframe":"M15"}},"management":{"exitIfNoProgress":{"candles":6,"timeframe":"M5"}}}. Results are broken down by zone / combination. Selective setups give few trades: use long periods, and sensitivity:true reruns the rule with neighbouring parameters (swing strength ±1, target ±0.5R) to see if the result holds. TRAILING: trade.trailing true moves the stop behind price at the initial stop distance (same rule as trailing: true on live orders). Not supported: other chart patterns (head and shoulders, triangles…), news, ATR or candle trailing stops. History available: forex, gold and crypto since late May 2026; indices and oil about 1 year. Plan limits: Free = last 7 days and 5 backtests per day; Plus = 45 days and 20 per day; Trader = 90 days and 50 per day; Max = all history, unlimited. Works with the market closed (weekends) and without a broker account.