Running a Backtest
This guide walks you through every step of setting up and launching a backtest in Stratifyre. By the end, you will have a completed backtest with a full set of results ready to analyze.
Before You Begin
Section titled “Before You Begin”You need a strategy to backtest. If you have not built one yet, head to the Strategy Builder guide to create your first strategy. Even a simple two-rule strategy (for example, buy when a moving average crosses up and sell when it crosses down) is enough to follow along with this guide.
Step 1: Open the Backtest Panel
Section titled “Step 1: Open the Backtest Panel”From your strategy page, click the Backtest button in the top toolbar. This opens the backtest configuration panel where you will set up all the parameters for your test.
You can also reach this panel from the main navigation by selecting Backtesting and then choosing the strategy you want to test.
Step 2: Select Your Symbol(s)
Section titled “Step 2: Select Your Symbol(s)”Your strategy already has a default instrument universe from its selected symbols and baskets. When you open the backtest panel from that strategy, Stratifyre starts with that universe.
Use the symbol search bar to keep those defaults or override them for this backtest run. Start typing a ticker symbol or company name and select from the dropdown.
If you change the symbols or baskets here, the backtest uses this override instead of the strategy’s saved universe. The override applies only to that backtest job and does not change the strategy itself.
Stratifyre supports 10 asset classes:
| Asset Class | Examples |
|---|---|
| US Equities | AAPL, MSFT, TSLA (NYSE, NASDAQ, AMEX) |
| ETFs | SPY, QQQ, IWM (3,000+ available) |
| Futures | ES, NQ, CL, GC (CME, CBOT, NYMEX, COMEX, ICE) |
| Options | Equity and index options |
| Cryptocurrencies | BTC, ETH, SOL (24/7 markets) |
| Forex | EUR/USD, GBP/USD, USD/JPY |
| Commodities | Gold, Silver, Crude Oil |
| Indices | S&P 500, NASDAQ Composite, Dow Jones |
| ETNs | Exchange-traded notes |
| Mutual Funds | Select mutual fund symbols |
Step 3: Choose Your Date Range
Section titled “Step 3: Choose Your Date Range”Set the Start Date and End Date for your backtest. The available range depends on the symbol — most major US equities and ETFs have 20+ years of history.
How to pick a good date range:
- Include multiple market regimes. A backtest that only covers a bull market will give you an overly optimistic picture. Try to include at least one significant downturn.
- Use enough data for statistical significance. A strategy that made 5 trades over 3 months does not tell you much. Aim for at least 30-50 trades in your results.
- Consider your strategy’s timeframe. A day-trading strategy on 5-minute bars might only need a year or two. A swing-trading strategy on daily bars might benefit from 10+ years.
Step 4: Select the Time Resolution
Section titled “Step 4: Select the Time Resolution”Choose the bar size for your backtest. This determines how frequently the engine evaluates your strategy rules.
| Resolution | Best For |
|---|---|
| Tick (TBBO) | Ultra-high-frequency analysis, precise entry/exit timing |
| 1-second | Scalping strategies |
| 1-minute | Intraday strategies, day trading |
| 5-minute | Active intraday trading |
| 10 / 15 / 30-minute | Intraday swing trading |
| 60-minute | Intraday to multi-day strategies |
| Daily | Swing trading, position trading |
| Weekly | Position trading, longer-term strategies |
| Monthly / Yearly | Long-term allocation strategies |
Your strategy’s indicators should match the resolution you choose. If your strategy uses a 20-period moving average on daily bars, running it on 1-minute bars will calculate a 20-minute moving average instead — a very different signal.
Step 5: Configure Execution Mode
Section titled “Step 5: Configure Execution Mode”Stratifyre offers two execution modes that control when your strategy’s rules are evaluated and when orders are filled.
On-Close Mode
Section titled “On-Close Mode”The engine evaluates your rules while the current bar is still forming. It sees partial bar data (the open, high, low, and current price so far) and can place orders. Those orders are then filled on the next incoming tick.
This mode is useful for strategies that react to intrabar price action — for example, placing a stop order while the bar is still open.
On-Open Mode
Section titled “On-Open Mode”The engine waits for each bar to complete before evaluating your rules. It only ever sees fully formed bars (complete OHLCV data). When it places an order, the fill occurs at the open of the next bar.
This is the more conservative mode and is a good default for most strategies. Since it only uses completed bar data, there is no risk of look-ahead bias within a bar.
Step 6: Choose a Fill Simulation Mode
Section titled “Step 6: Choose a Fill Simulation Mode”Fill simulation controls the price at which your market orders are filled within a bar. Since a single bar contains a range of prices (open, high, low, close), the engine needs a rule for determining your fill price.
| Fill Mode | Fill Price | Use Case |
|---|---|---|
| Pessimistic | Worst price in the bar for your order direction (high for buys, low for sells) | Stress-testing — shows what happens if you always get the worst possible fill |
| Optimistic | Best price in the bar for your order direction (low for buys, high for sells) | Understanding the best-case scenario |
| Close | The bar’s closing price | Simple and commonly used in other platforms |
| Average | The average of open, high, low, and close | A balanced middle-ground estimate |
Step 7: Set Slippage
Section titled “Step 7: Set Slippage”Slippage models the difference between the price you expect and the price you actually get when an order is executed. In real markets, slippage happens because prices move between the moment you submit an order and the moment it is filled.
You can configure slippage in two ways:
- Per-share amount — A fixed dollar amount per share (for example, $0.01 per share). Good for equities.
- Percentage — A percentage of the order price (for example, 0.05%). Better for futures, forex, and crypto where notional values vary widely.
Setting slippage to zero gives you the most optimistic results. For realistic testing, even a small amount of slippage (like $0.01 per share for liquid equities) can make a meaningful difference, especially for high-frequency strategies.
Step 8: Set Starting Capital and Other Parameters
Section titled “Step 8: Set Starting Capital and Other Parameters”- Starting Capital — The amount of cash in your simulated account at the start of the backtest. This affects position sizing and margin calculations.
- Commission Model — Configure commissions per trade if applicable.
- Volume Constraints — By default, the engine will not fill your order for more than 10% of a bar’s total volume. This prevents unrealistic fills in illiquid conditions. You can adjust this threshold.
Step 9: Launch the Backtest
Section titled “Step 9: Launch the Backtest”Once everything is configured, click the Run Backtest button. The engine will begin processing your strategy against the historical data.
What happens behind the scenes:
- The engine loads the historical data for your selected symbol and date range.
- It initializes your simulated account with the starting capital.
- Bar by bar (or tick by tick), it feeds price data to your strategy rules.
- When rules trigger, the engine generates orders and simulates fills according to your execution and fill settings.
- Corporate actions (splits, dividends, etc.) are applied automatically as they occur in the historical timeline.
- The engine records a snapshot of every order, position, and account state at each step — this is what powers Time Traveling.
- After processing all bars, the engine calculates 70+ performance metrics and builds the results dashboard.
You will see a progress indicator as the backtest runs. Most backtests complete in a few seconds. Tick-level backtests over long periods may take longer.
Step 10: Review Your Results
Section titled “Step 10: Review Your Results”When the backtest finishes, you are taken to the results page. Head to Understanding Results for a detailed guide on reading everything there.
At a glance, you will see:
- An equity curve showing how your account balance changed over time.
- Summary statistics with key metrics like total return, maximum drawdown, Sharpe ratio, and win rate.
- A trade log listing every trade with entry/exit prices, profit/loss, and duration.
Tips for Better Backtests
Section titled “Tips for Better Backtests”- Test one variable at a time. If you change three things between backtests, you will not know which change mattered.
- Use realistic settings. Zero slippage and optimistic fills will flatter your results. The gap between simulation and reality is where money is lost.
- Do not over-optimize. If you run 500 backtests tweaking parameters each time, you will eventually find settings that happen to work on the historical data but will not generalize. See Monte Carlo Simulation for tools that help detect this.
- Save your configurations. When you find settings you like, save them so you can reproduce results later.
- Compare against a benchmark. A strategy that returns 8% per year sounds good until you realize the S&P 500 returned 12% over the same period. Always ask: “Is my strategy doing better than simply buying and holding?”
