Backtest
Test a trading rule on years of daily prices before you risk money. Choose a strategy or write your own entry and exit rules, add commission and slippage, allow shorts, and save what works.
Backtest replays a rule on past daily bars for one stock and tells you what it would have done: total return, drawdown, win rate and every trade. It is a way to check an idea, not a promise. Backtest needs a Pro plan.


How to run a backtest
- Click Backtest in the sidebar.
- Enter a ticker in Symbol. It starts on AAPL.
- Pick a Strategy: RSI Crossover, MA Crossover, MACD Signal, Bollinger Breakout or Custom Formula (Pine-lite).
- Set Start Date and End Date. They start at one year ago and today.
- Set Initial Capital ($). It starts at 10,000.
- Change the strategy's own inputs, such as the RSI period or the oversold and overbought levels.
- Click Run Backtest.
How to make the test more realistic
Under the strategy inputs, four settings apply to every strategy:
- Commission (bps): a cost on every buy and sell, in basis points. 10 bps is 0.10%.
- Slippage (bps): how much worse than the bar's price each fill is. Buys fill higher and sells fill lower.
- Position Size (%): the share of your cash used on each entry, from 1 to 100. It starts at 100.
- Shorts: tick ALLOW_SHORT to let the rule also sell short. With it on, an exit signal while you hold nothing opens a short, and an entry signal closes it.
Both cost fields start at 0. Try 5 to 10 bps for each to see how much of a rule's profit survives trading costs.
How to write your own rule
- Choose Custom Formula (Pine-lite) as the strategy. Two boxes appear, one for the entry rule and one for the exit rule.
- Click a preset to fill them: RSI reversion, SMA trend or 55-bar breakout.
- Or type your own, for example rsi(close, 14) < 30 to enter and rsi(close, 14) > 70 to exit. Each rule must be true or false on each bar.
- A message under a box tells you if the rule cannot be read. Fix it before you run.
How to read the results
- The stat tiles show Total Return, Buy & Hold, Max Drawdown, Sharpe Ratio, Win Rate, Total Trades, Final Equity and vs Buy & Hold. Beating buy and hold is the bar to clear.
- The Equity Curve plots your account against simply holding the stock.
- The Trade Log lists each trade as a buy, sell, short or cover, with date, price, shares and profit.
How to save a strategy
- Type a name in Strategy name in the saved strategies box.
- Click save. The whole setup is stored, including the dates, costs and formulas.
- To use it again, pick it from the saved list and click load. It fills the form. Delete removes it.
You can keep up to 100 saved strategies.
Good to know
- Backtests use daily bars, so they cannot test intraday rules.
- Past results do not predict future ones. Long tests on one stock overfit easily, so try several tickers and periods.
If something doesn't work
- An upgrade card shows: Backtest needs Pro. See Pricing.
- Zero trades: the rule never triggered in that window. Widen the dates or loosen the rule.
- The formula will not run: read the message under the box. Check brackets and that each rule ends in a true or false test.
- No data for a ticker: check the spelling and that it traded in the dates you chose.