Skip to Content
NeurotraderDocs
Concepts

Simulations

What a simulation is, what it is useful for, and the three kinds: a single account, a comparison of algorithms, and an instrument sweep.

A simulation is where you try out a trading idea in Neurotrader. You tell it which market data to use, which algorithms to run and how much money the account starts with. Then you run it, and Neurotrader shows you what the algorithms would have done with that money, order by order.

Parts of a simulation

A simulation is a saved setup with three parts:

  • Market data. The instruments the algorithms trade, such as BTCUSDT or a stock, with a date range and a candle interval for each. Each instrument with its range and interval is called a data source.
  • Algorithms. The trading rules to run, each with its own parameters. You can add the same algorithm more than once with different parameters, for example a moving-average crossover with a fast setting and another with a slow one.
  • Account. The money the algorithms trade with: the starting balance, the maker and taker fees, and the currency every result is measured in, called the primary quote asset.

You create a simulation on the Simulations page. The app walks you through five steps: Details, Balances, Data, Algorithms and Review. You can skip the data and the algorithms during creation and add them later on the simulation's own page.

Simulations and runs

A simulation is the setup. A run is one time you start it. Each run is recorded with its results and with a copy of the setup it used, and it stays in the simulation's history.

That makes a simulation something you work with over time. Run it, change a parameter, run it again, and compare the two runs in the history. If an earlier version of the setup did better, restore that run's setup and carry on from there.

One part of the setup cannot change once the simulation exists: the primary quote asset. Every run's results are measured in it, and changing it would make new runs impossible to compare with old ones.

Uses of a simulation

  • Testing an idea before you risk money. A simulation shows how a set of rules would have traded real prices, including the fees it would have paid, without spending anything.
  • Measuring against a yardstick. A strategy that made 20% sounds good until you see that simply buying and holding made 35%. Run your algorithm next to Buy and Hold or Cash to see whether its rules add anything.
  • Tuning parameters. Run the same algorithm with different settings, for example a 20-day average against a 50-day one, and see which works better.
  • Testing different market conditions. Run the same setup over a rising market, a falling one and a flat one. A strategy that only works in one of them is worth knowing about.
  • Understanding what an algorithm does. Every order, fill and change in the account's value is recorded, so you can see why a run went the way it did, not only how it ended.

Limits of a good result

A simulation shows what a set of rules would have done in the past. The market will not repeat itself exactly. Be especially careful with a strategy you have tuned until its results look perfect: it may have learned the past rather than found something that lasts. Test it on a period you did not tune it on, and in Live Simulation, before you trust it.

Kinds of simulation

When you create a simulation, you choose its kind. The kind decides how the algorithms and the money are arranged, and which question the results answer.

KindQuestionAccounts
Single accountHow does this strategy do?One, shared by every algorithm in it
ComparisonWhich of these strategies does best?One per algorithm, all starting with the same balance
Instrument sweepWhere does this strategy work best?One per instrument, all starting with the same balance

The kind is fixed when you create the simulation. To try a different kind, create a new simulation.

Single account

A single-account simulation runs a strategy on one account. It answers the plainest question: if I had traded this way, with this money, what would have happened?

Most single-account simulations hold one algorithm. You can add more, and then they trade together on the one account, as a portfolio: they see the same balance and spend from it. Neurotrader combines them into an algorithm group, a single algorithm that holds the others and trades on their behalf. Within a step, an algorithm that orders later can be refused if the ones before it have already spent the money, exactly as it would be on a real account.

Use a single account when you want to know how one strategy, or one mix of strategies, performs as a whole.

Example: run SMA Crossover on BTCUSDT with hourly candles over the last three years, starting with 10,000 USDT, and see the final balance, the return and the deepest fall along the way.

Comparison

A comparison runs several algorithms side by side over the same market data. Each algorithm gets its own separate account, and every account starts with the same balance. Because nothing is shared, no algorithm can affect another, and the results compare fairly.

Use a comparison to choose between strategies, or between versions of one strategy:

  • Put your algorithm next to a yardstick such as Buy and Hold or Cash.
  • Compare two different strategies, such as SMA Crossover and RSI Threshold, on the same instrument.
  • Add the same algorithm several times with different parameters, and see which settings work best.

A comparison run's results show every algorithm in one table and one chart, with the best return and the worst drawdown marked. Below that, you can inspect one algorithm at a time: its balance, its orders and the candles it traded.

You can also compare mixes of strategies. Each algorithm in a comparison can itself be an algorithm group, so you can find out which combination of strategies does best.

Example: compare SMA Crossover, RSI Threshold and Buy and Hold on ETHUSDT with daily candles over five years, each starting with 10,000 USDT, and see which one ends highest and which one fell least on the way.

Instrument sweep

An instrument sweep runs one setup across several instruments. You choose an algorithm and its parameters once, and Neurotrader runs a copy of it on each instrument, each copy with its own account and the same starting balance. Each copy is named after the instrument it trades.

Use an instrument sweep to find out where a strategy works. A strategy that does well on one instrument may have been lucky. One that does well on many is more likely to have found something real, and one that does well on only some of them tells you which markets it suits.

A sweep keeps the setup identical on every instrument. All copies use the same algorithm with the same parameters, and all instruments use the same candle interval, so the only thing that differs between the copies is the market. When you change the setup, you change it once and every copy follows.

The setup can be one algorithm or an algorithm group. Choose instruments quoted in the same currency, such as BTCUSDT, ETHUSDT and SOLUSDT, and use that currency as the primary quote asset, so every copy's results are measured in the same money.

Example: run RSI Threshold with the same settings on BTCUSDT, ETHUSDT, SOLUSDT and XRPUSDT with four-hour candles, and see on which of them it beats buying and holding.

Choice of kind

  • To see how one strategy, or one portfolio of strategies, does: choose Single account.
  • To pick the best of several strategies or settings: choose Comparison.
  • To see whether a strategy works beyond the one instrument you designed it on: choose Instrument sweep.

Comparisons and instrument sweeps depend on your plan.

Live simulations

Every kind of simulation also runs on live prices. A live single account, a live comparison and a live instrument sweep work the same way as the historical ones, except that the algorithms trade today's market as it moves and the run continues until you stop it. You create them on the Live Mode page. See Operation modes.

Run history

Each time you start a simulation, Neurotrader records a run. The simulation's page lists its runs, newest first, with the return, the maximum drawdown and the number of orders filled for each.

A run ends in one of four ways:

  • Completed: it reached the end of the date range.
  • Cancelled: you stopped it early. Its results describe exactly the part that ran.
  • Failed: something went wrong before it could finish. The run says how far it got.
  • Interrupted: the engine stopped unexpectedly while the run was in flight.

You can give a run a label and tags so you can find it later, open it to see every order and every step in detail, restore its setup into the simulation, or delete it.

On this page