First backtest
A complete first backtest in the app: SMA Crossover on BTCUSDT with hourly candles and 10,000 USDT, from creating the simulation to reading the results and trying a second set of parameters.
In this tutorial you run your first backtest from start to finish. You test one well-known strategy, a moving-average crossover, on one year of Bitcoin prices, read what it did, then change a parameter and run it again to see whether the change helped.
It takes about fifteen minutes. You need the app installed and signed in: see Installation and Sign-in and plans.
The example
| Part | Choice |
|---|---|
| Algorithm | SMA Crossover, a built-in algorithm |
| Instrument | BTCUSDT, Bitcoin priced in USDT |
| Candles | Hourly (1h), over the latest twelve complete months |
| Starting balance | 10,000 USDT |
| Fees | 0.1% maker and 0.1% taker |
SMA Crossover keeps two simple moving averages of the price, a fast one and a slow one. It buys when the fast average crosses above the slow one and sells when it crosses back below. Its two parameters are the lengths of the averages in candles: Fast Period, 9 by default, and Slow Period, 21 by default.
No money is involved. The account is simulated, and the result is a record of what these rules would have done in the past, not advice and not a forecast.
Step 1: simulation details
- Select Simulations in the sidebar.
- Select New Simulation in the toolbar. The New simulation dialog opens on its Details step.
- In Name, enter
BTC SMA crossover. - Under Type, keep Single account.
- Under Quote asset, open the picker, search for
USDTand select it. Every result of this simulation is measured in USDT, and this choice cannot be changed later. - Leave Maker fee (%) and Taker fee (%) at 0.1.
- Leave Margin off.
- Select Next.
Step 2: starting balance
- On the Balances step, the Asset picker already shows USDT.
- In Amount, enter
10000. - Select Add. The table shows 10,000 USDT.
- Select Next.
Step 3: market data
- On the Data step, select the add button (the plus icon) in the Data card's header. The Add data source dialog opens.
- Select the Last year preset under the date fields. The start and end dates change to the latest twelve complete months.
- Set the interval to
1h. - In the search box, type
BTCUSDT. - Select
BTCUSDTin the results. The line under the dates states the days selected and about how many candles that is: roughly 8,760 hourly candles for a year. - Select Add. The card now lists
BTCUSDTwith its range and1h. - Select Next.
You do not need to have this data. Neurotrader downloads it when the run starts and keeps it for next time.
Step 4: algorithm
- On the Algorithms step, select the add button (the plus icon). The Select algorithm dialog opens.
- Type
smain the search box and select SMA Crossover. Its label and parameters appear on the right. - Leave Label as "SMA Crossover".
- Leave Fast Period at 9 and Slow Period at 21.
- Select Select.
- Select Next.
The algorithm's row reads "Reads BTCUSDT". On a single account the algorithm is linked to the data for you.
Step 5: review and creation
- On the Review step, check the summary: Single account, USDT, 0.1% fees, 1 data source, 1 algorithm, and 10,000 USDT under Initial balances.
- Under After creating, tick Open it.
- Select Create simulation.
The simulation's page opens. On the left are its three setup cards, Data, Algorithm and Account. On the right is the Runs card, which says there are no runs yet.
Step 6: first run
- Select Run in the header.
The status changes to Running and a Run in progress card appears. On this first run the status line reports the market data being downloaded, then the progress bar fills as the backtest steps through the year.
When it finishes, the status returns to Ready and the run appears in the Runs table with the outcome Completed.
If the run does not start, a message says why. See Run control.
Step 7: results
The summary card above the Runs table shows the run you just made.
- Read Return. It is the change in the account's value over the year, in percent: green for a gain, red for a loss. A loss is a perfectly normal result for a first try.
- Read Net worth. It shows the starting and the ending value in USDT. The first number is your 10,000.
- Read Max drawdown. It is the largest fall from a peak along the way. A strategy with a good return and a deep drawdown would have been hard to live with.
- Read Win rate and Orders filled. They say how many closed trades made money and how many of the algorithm's orders actually traded.
- Look at the chart under the figures. It draws the account's value over the whole run.
Now look at why it went that way.
- Select Open full results. The run's page opens.
- Scroll to In detail. The upper chart is the account's value. The lower
chart is the
BTCUSDTprice as candles, with a triangle on each candle where the algorithm placed an order: pointing up for a buy, down for a sell. The two lines over the candles, "SMA 9" and "SMA 21", are the averages the algorithm read. Each buy sits where the fast line crosses above the slow one. - The charts open on the start of the year. Select a point on the strip under the candle chart to move to another part of the run, and drag or zoom to look closer. See Charts.
- Scroll to the journal under the charts. Each row is one order, with its time, side, price, status and cause. Select a row and the charts move to that order.
- Select Trades above the journal. Each row is now one round trip, a buy and the sell that closed it, with its PnL.
Step 8: label for the run
You are about to make a second run, so name the first.
- On the run's page, point at "Unlabelled" at the top and select the pencil button.
- Enter
9 / 21and pressEnter. - Select Simulations in the sidebar and open BTC SMA crossover again to return to its page.
Step 9: parameter change and second run
Slower averages react later but are fooled less often by small moves. Try them.
- On the Algorithm card, select the configure button (the sliders icon) on the SMA Crossover row.
- Set Fast Period to 20 and Slow Period to 50.
- Select Save. The header now notes "Changed since the latest run: algorithms".
- Select Run. This run starts at once, because the data is already on your computer.
- When it completes, label the new run
20 / 50on its summary card.
Step 10: comparison of the two runs
The Runs table now has two rows, newest first.
- Compare Return and Max drawdown across the two rows.
- Compare Orders filled. The slower averages cross less often, so the second run trades less and pays less in fees.
- Select each row in turn to see its summary and its chart.
Each run kept a copy of the setup it used. If the first set of parameters did
better, select the 9 / 21 run and select the restore button on its summary
card to put those parameters back. See
Run results.
Limits of two runs
Whichever setting won, it won on one year of one instrument. Change the parameters until the result looks perfect and you will have described that year, not found a strategy. Before you trust a setting, test it on a period you did not tune it on, on other instruments, and against simply buying and holding.
Summary
- Created a single-account simulation with a quote asset, a balance, one data source and one algorithm.
- Ran it, and let Neurotrader download the data it needed.
- Read the summary figures, the charts with the order marks and indicators, and the journal.
- Changed a parameter, ran again, and compared two runs in the history.
Next steps
- Algorithm comparison: run the strategy against Buy and Hold and another strategy in one simulation, then across several instruments.
- Results: what each figure means and how it is calculated.
- Fees: how maker and taker fees change a result.
- Built-in algorithms: the other algorithms you can try.