Write a rule with no missing decisions
‘Buy when the market looks strong’ cannot be replayed consistently. Choose an observable condition, an exit and a position size. Include the asset, candle interval, test dates, warm-up, fee and slippage settings, and when a completed signal can become a fill.
For a precise starter rule, specify: ‘On SPY daily bars, target fully long when the 20-bar simple average of completed closes exceeds the 50-bar average, otherwise cash. No shorts or leverage. Make decisions only after the bar is complete and use the next eligible bar open for fills.’ Add your dates, capital and cost assumptions before testing.
Build the test in Premiss
Open Premiss, describe the rule and ask it to confirm the available market history and unresolved assumptions. Keep the setup small for the first run so you can inspect it.
- Confirm the exact security or pair, interval and test period, including enough warm-up history.
- Review the generated strategy and the assumptions listed beside it.
- Run the historical test and retain its tested version and settings.
- Read the trade record and benchmark comparison before revising the rule.
Check an example before trusting a percentage
Our recorded SPY 20/50 experiment ended at $10,613.21 from $10,000, compared with $14,323.87 for its matched price-only buy-and-hold baseline. The case study publishes the tested Python, every fill and both equity records. It also discloses its zero-cost assumptions and raw-price limitations.
You do not have to write the code yourself to ask useful questions: why did this entry happen, when was its signal known, what did the next fill cost, and what happened when the rule stayed in cash? Compare those answers with the saved record.
Keep costs, overfitting and paper trading separate
Generated code can execute successfully and still implement the wrong rule. Missing fees, a fill before its signal or a test covering only a favorable market can all change the result. Test realistic costs and reserve data that was not used to select the strategy.
If you later run a paper bot, preserve its code version and forward dates as a separate record. A historical backtest and a forward paper simulation answer different questions; neither guarantees live results.