Skip to Content
NeurotraderDocs
Tutorials

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

PartChoice
AlgorithmSMA Crossover, a built-in algorithm
InstrumentBTCUSDT, Bitcoin priced in USDT
CandlesHourly (1h), over the latest twelve complete months
Starting balance10,000 USDT
Fees0.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

  1. Select Simulations in the sidebar.
  2. Select New Simulation in the toolbar. The New simulation dialog opens on its Details step.
  3. In Name, enter BTC SMA crossover.
  4. Under Type, keep Single account.
  5. Under Quote asset, open the picker, search for USDT and select it. Every result of this simulation is measured in USDT, and this choice cannot be changed later.
  6. Leave Maker fee (%) and Taker fee (%) at 0.1.
  7. Leave Margin off.
  8. Select Next.
Screenshot
The New simulation dialog on the Details step, filled in for the tutorial: Name BTC SMA crossover, Type Single account, Quote asset USDT, Maker fee and Taker fee 0.1, Margin off.

Step 2: starting balance

  1. On the Balances step, the Asset picker already shows USDT.
  2. In Amount, enter 10000.
  3. Select Add. The table shows 10,000 USDT.
  4. Select Next.

Step 3: market data

  1. On the Data step, select the add button (the plus icon) in the Data card's header. The Add data source dialog opens.
  2. Select the Last year preset under the date fields. The start and end dates change to the latest twelve complete months.
  3. Set the interval to 1h.
  4. In the search box, type BTCUSDT.
  5. Select BTCUSDT in 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.
  6. Select Add. The card now lists BTCUSDT with its range and 1h.
  7. 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

  1. On the Algorithms step, select the add button (the plus icon). The Select algorithm dialog opens.
  2. Type sma in the search box and select SMA Crossover. Its label and parameters appear on the right.
  3. Leave Label as "SMA Crossover".
  4. Leave Fast Period at 9 and Slow Period at 21.
  5. Select Select.
  6. 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

  1. 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.
  2. Under After creating, tick Open it.
  3. 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.

Screenshot
The page of the new BTC SMA crossover simulation before its first run: the header with the name, the Ready status and the Run, Pause, Stop and Reset buttons, the Data card with BTCUSDT at 1h, the Algorithm card with SMA Crossover, the Account card with 10,000 USDT, and an empty Runs card.

Step 6: first run

  1. 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.

  1. 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.
  2. Read Net worth. It shows the starting and the ending value in USDT. The first number is your 10,000.
  3. 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.
  4. Read Win rate and Orders filled. They say how many closed trades made money and how many of the algorithm's orders actually traded.
  5. Look at the chart under the figures. It draws the account's value over the whole run.
Screenshot
The summary card of the first completed run of BTC SMA crossover: the Completed outcome, the figures Return, Net worth in USDT starting at 10,000, Max drawdown, Win rate and Orders filled, and the net worth chart over twelve months, above the Runs table with one run.

Now look at why it went that way.

  1. Select Open full results. The run's page opens.
  2. Scroll to In detail. The upper chart is the account's value. The lower chart is the BTCUSDT price 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.
  3. 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.
  4. 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.
  5. Select Trades above the journal. Each row is now one round trip, a buy and the sell that closed it, with its PnL.
Screenshot
The In detail section of the first run's page: the net worth chart in percent, the BTCUSDT hourly candle chart zoomed to about two weeks with the SMA 9 and SMA 21 lines and buy and sell triangles at their crossings, the whole-run strip, and the first rows of the journal.

Step 8: label for the run

You are about to make a second run, so name the first.

  1. On the run's page, point at "Unlabelled" at the top and select the pencil button.
  2. Enter 9 / 21 and press Enter.
  3. 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.

  1. On the Algorithm card, select the configure button (the sliders icon) on the SMA Crossover row.
  2. Set Fast Period to 20 and Slow Period to 50.
  3. Select Save. The header now notes "Changed since the latest run: algorithms".
  4. Select Run. This run starts at once, because the data is already on your computer.
  5. When it completes, label the new run 20 / 50 on its summary card.

Step 10: comparison of the two runs

The Runs table now has two rows, newest first.

  1. Compare Return and Max drawdown across the two rows.
  2. Compare Orders filled. The slower averages cross less often, so the second run trades less and pays less in fees.
  3. 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.

On this page