What You Need Before You Start
Before you run a backtest, you need a strategy with clear rules. If you haven't built one yet, start with the Strategy Builder & Backtesting article to understand entry rules, exit rules, and position sizing.
You'll also want to know which stocks or sectors you want to test against, and roughly what time period makes sense. A good rule of thumb: test across at least 3-5 years of data so your results cover different market conditions — bull runs, corrections, and sideways markets.
Step 1: Open the Backtest Page
Navigate to the Backtest page from the main sidebar. You'll see two main areas: the Strategy Builder panel on the left, and the Results panel on the right. The Strategy Builder is where you define your rules. The Results panel stays empty until you run your first test.
Step 2: Define Your Entry Rules
Click "Add Entry Rule" to start building your buy conditions. Each rule has three parts: a metric (like TrustScore, RSI, or P/E ratio), a condition (above, below, crosses above), and a value.
For example, to buy when a stock's TrustScore rises above 70 while RSI is below 30 (oversold), you'd add two entry rules:
- •TrustScore — is above — 70
- •RSI (14-day) — is below — 30
Step 3: Define Your Exit Rules
Click "Add Exit Rule" to set your sell conditions. Every strategy needs at least one exit rule. Most good strategies have two or three:
- •Profit target: Sell when the position gains a certain percentage (e.g., +15%).
- •Stop loss: Sell when the position drops a certain percentage (e.g., -5%). This is the most important rule — it limits your downside.
- •Signal exit: Sell when your entry signal reverses (e.g., TrustScore drops below 50).
Step 4: Set Position Sizing and Universe
Choose how much of your simulated capital to put into each trade. The default is equal-weight (same dollar amount per trade), but you can also size by conviction or volatility.
Next, pick your stock universe — which stocks the backtest should consider. You can choose a preset (like S&P 500 or a specific sector), use a screener filter, or enter specific ticker symbols.
Step 5: Choose Your Time Period and Run
Select the start and end dates for your backtest. Longer periods give more reliable results but take a bit longer to process. Click "Run Backtest" and wait for the results.
The system walks through every trading day in your selected period, checking your entry and exit rules against actual market data. When your entry rules are met, it simulates a buy. When your exit rules trigger, it simulates a sell.
Step 6: Read Your Results
The Results panel shows several key numbers:
- •Total Return: How much your strategy would have made (or lost) over the period.
- •Win Rate: What percentage of trades were profitable.
- •Max Drawdown: The biggest peak-to-trough drop — this tells you the worst stretch you'd have to stomach.
- •Sharpe Ratio: Return per unit of risk. Above 1.0 is decent, above 2.0 is strong. Learn more in Risk Metrics That Matter.
- •Average Holding Period: How long each trade lasted on average.
Step 7: Refine — But Don't Overfit
If results are poor, adjust your rules and re-run. But be careful: the more you tweak to improve past results, the more likely you're fitting to noise rather than real patterns. This is called overfitting.
A good practice is to split your time period in half. Build your strategy using the first half, then test it on the second half without changing anything. If it still performs well on the second half, you have a more robust strategy.