Skip to Content
NeurotraderDocs
Tutorials

Algorithm comparison

A comparison simulation of SMA Crossover, RSI Threshold and Buy and Hold on BTCUSDT, how to read the comparison card, and the same strategy as an instrument sweep.

A return on its own says little. A strategy that made 20% sounds good until you learn that simply holding the asset made 35% over the same year. In this tutorial you put two strategies and a yardstick side by side in one simulation, read which did best, and then ask a second question: does the better strategy work on other instruments too?

It builds on First backtest. Do that one first if you have not created a simulation before.

Comparisons and instrument sweeps depend on your plan. See Plans and quotas.

The example

PartChoice
AlgorithmsSMA Crossover, RSI Threshold and Buy and Hold
InstrumentBTCUSDT
CandlesHourly (1h), over the latest twelve complete months
Starting balance10,000 USDT for each algorithm
  • SMA Crossover follows trends: it buys when a fast moving average crosses above a slow one and sells when it crosses back.
  • RSI Threshold does the opposite kind of thing: it buys when the RSI indicator rises back through an oversold level and sells when it falls back through an overbought one.
  • Buy and Hold is the yardstick. It buys once with the whole balance and holds to the end. A strategy that cannot beat it has only added effort and fees.

In a comparison each algorithm gets its own account, and every account starts with the same balance. No algorithm can spend another's money, so the results compare fairly. See Comparison.

Part 1: comparison simulation

Details, balance and data

  1. On the Simulations page, select New Simulation.
  2. On Details: enter the name BTC strategy comparison, choose Comparison under Type, pick USDT as the Quote asset, and leave the fees at 0.1 and Margin off. Select Next.
  3. On Balances: add 10000 USDT. Each algorithm's account starts with a copy of this balance. Select Next.
  4. On Data: select the add button, select the Last year preset, set the interval to 1h, search for BTCUSDT, select it and select Add. Select Next.

Three algorithms

On the Algorithms step you add each algorithm and tell it which data to read. In a comparison this link is yours to make, because different algorithms may read different data.

  1. Select the add button (the plus icon). The Add algorithm dialog opens.
  2. Select SMA Crossover, leave its label and parameters as they are, and select Add.
  3. On the new row, select the sources button, which reads 0 sources, and tick BTCUSDT. The row now says "Reads BTCUSDT".
  4. Select the add button again, select RSI Threshold, and select Add. Its defaults are a Period of 14, an Oversold Threshold of 30 and an Overbought Threshold of 70. Link it to BTCUSDT in the same way.
  5. Add Buy and Hold a third time round. It has no parameters. Link it to BTCUSDT.
  6. Check that all three rows say "Reads BTCUSDT". An algorithm that reads nothing has nothing to trade.
  7. Select Next.
Screenshot
The Algorithms step of the New simulation dialog for a Comparison: three rows, SMA Crossover, RSI Threshold and Buy and Hold, each with the line Reads BTCUSDT and a 1 source button.

Creation and run

  1. On Review, check that the type is Comparison and that there are 3 algorithms. Tick Open it and select Create simulation.
  2. On the simulation's page, select Run.
  3. Wait for the run to complete. All three algorithms run in the one run, over the same candles.

Part 2: comparison results

Summary

The run's summary card reads differently from a single-account run. Three separate accounts have no meaningful total, so instead of one return it shows the edges:

  • Best return, with the name of the algorithm that made it.
  • Worst return, with its algorithm.
  • Worst drawdown, the deepest fall any of the three took, with its algorithm.

The chart under the figures draws all three accounts on one axis.

In the Runs table, select the chevron at the start of the run's row to unfold one line per algorithm.

Comparison card

  1. Select Open full results.
  2. Find the Every algorithm card. It has a ranked table on one side and a chart of the three net worth lines on the other.
Screenshot
The Every algorithm card on the comparison run's page: a table ranking Buy and Hold, SMA Crossover and RSI Threshold with their Return, End in USDT, Max drawdown, Win rate and Orders filled, each row with a tick box and a colour swatch, beside a chart of three net worth lines in percent over twelve months.

Read the table column by column:

  1. # ranks the algorithms by Return, best first. Look at where Buy and Hold stands. Any algorithm ranked below it lost to doing nothing clever.
  2. End is each account's final value in USDT. Every account started at 10,000, so the differences are directly comparable.
  3. Max drawdown often tells a different story from the return. Buy and Hold takes every fall of the market in full. A strategy that steps aside during falls can end lower and still have been far easier to hold. Decide which matters more to you before you look at the ranking.
  4. Win rate is the share of closed trades that made money. Buy and Hold shows a dash: it never sold, so it closed no trade and has no win rate. A dash is never a zero.
  5. Orders filled shows how busy each algorithm was. Every fill paid a fee, so a busy algorithm starts each trade a little behind.

Then read the chart:

  1. Follow the three lines through the year. Notice where they part: a trend-following strategy tends to lag in a choppy stretch and keep up in a long move, and a mean-reversion strategy tends to do the reverse.
  2. Untick a row to hide its line and see the other two more clearly. Tick it to bring it back.
  3. Select the quote-asset button above the chart to see the lines in USDT instead of percent.

One algorithm in detail

  1. Select the SMA Crossover row in the table. The page scrolls to One algorithm in detail, which now shows that algorithm: its net worth, the candles with its orders marked, and its journal.
  2. Select the RSI Threshold row. The same section now shows the other strategy's orders on the same candles. Compare where each one bought and sold.

See Run results for everything on this page.

Parameter comparison

The same simulation can compare settings of one strategy.

  1. Return to the simulation's page.
  2. On the Algorithms card, select the add button and select SMA Crossover again.
  3. Set Label to SMA 20/50, Fast Period to 20 and Slow Period to 50, and select Add.
  4. Link the new row to BTCUSDT with its sources button.
  5. Select Run.

The new run ranks four accounts, with both versions of the crossover among them. The first copy still carries the label "SMA Crossover", so the two are easy to tell apart.

Part 3: instrument sweep

Suppose SMA Crossover came out ahead on Bitcoin. That may be skill or luck. An instrument sweep runs one setup on several instruments, each on its own account, so you can see where the strategy works. See Instrument sweep.

Sweep creation

  1. On the Simulations page, select New Simulation.
  2. On Details: enter the name SMA crossover sweep, choose Instrument sweep, pick USDT as the Quote asset. Select Next.
  3. On Balances: add 10000 USDT. Each instrument's account starts with it. Select Next.
  4. On Data: select the add button, select Last year, set the interval to 1h, then search for and select BTCUSDT, ETHUSDT and SOLUSDT, one after another. The button now reads Add 3 sources. Select it, then Next.
  5. On Algorithms: select the add button, select SMA Crossover, keep the default parameters and select Select. Select Next.
  6. On Review, the Algorithms line reads "1 algorithm, run once on each of 3 instruments". Tick Open it and select Create simulation.
  7. Select Run.

Two rules keep a sweep fair, and the app holds you to both: every instrument uses the same interval, and every instrument runs the same algorithm with the same parameters. The only thing that differs between the accounts is the market. All three instruments here are priced in USDT, the quote asset, so every result is in the same money.

On the simulation's page, the Algorithms card shows the setup once, not three copies. Change a parameter there and it changes on every instrument.

Sweep results

Open the run with Open full results. The page is the comparison page you have just read, with one word changed: the card is titled Every instrument, and each row is named after the instrument it traded.

Screenshot
The Every instrument card on the sweep run's page: a table ranking BTCUSDT, ETHUSDT and SOLUSDT by the Return of SMA Crossover on each, with End in USDT, Max drawdown, Win rate and Orders filled, beside a chart of three net worth lines in percent.
  1. Read the ranking. It now orders instruments, not strategies: where did this strategy do best?
  2. Compare the spread. Similar results across the three suggest the rules capture something general. One strong result and two weak ones suggest the strong one was a matter of that market, or of luck.
  3. Select a row to inspect the strategy on that instrument: its orders on that instrument's candles, and its journal.

A sweep compares the strategy with itself across markets. It does not tell you whether the strategy beat holding each instrument. For that, make a comparison on that instrument, as in Part 1.

Past results

These rankings describe one year that has already happened. A strategy that led on every instrument can still lose next year. Use comparisons to rule ideas out and to understand how a strategy behaves, then watch what survives in a live simulation, where no money is at risk, before you consider trading it.

Summary

  • Created a comparison, gave three algorithms an account each, and linked each to its data.
  • Read the comparison card: rank, ending value, drawdown, win rate and activity, then one algorithm in detail.
  • Added a second copy of an algorithm with different parameters.
  • Ran one setup across three instruments as a sweep and read where it worked.

On this page