Skip to Content
NeurotraderDocs
Reference

Built-in algorithms

Every algorithm that ships with Neurotrader, with its trading rule and a table of its parameters, defaults and limits.

Neurotrader ships with a set of algorithms that are ready to add to a simulation. Use this page to look up what each one does and what its parameters accept. The app shows the same information in the details pane of the Algorithms page.

Baselines

Every trading algorithm on this page is a baseline: a simple, well-known rule with nothing hidden in it. Baselines exist to be measured against. A strategy of your own is only interesting if it does better than they do, on the same data, after fees. The app lists them under the category Simple baseline.

Six of them are plain yardsticks that use no indicator at all:

YardstickQuestion
CashDid the strategy do better than doing nothing?
Buy and HoldDid it do better than simply owning the asset?
Dollar-Cost AveragingDid it do better than buying a fixed amount regularly?
Constant MixDid it do better than a fixed split between the asset and cash?
Equal WeightDid it do better than holding every instrument equally?
RandomDid it do better than chance?

The others follow indicator rules. Two more built-in entries, Group and Remote, are not strategies. They hold or reach other algorithms.

None of these algorithms is a recommendation, and a good backtest of any of them is not a promise.

Conventions

  • Instruments. Unless its section says otherwise, an algorithm trades one instrument.
  • Order sizes. An algorithm that buys with the whole cash balance holds back 1% of it, because the order is sized at one candle's close and fills at the next candle's open.
  • Committed Fraction. Several algorithms have a committed parameter: the fraction of the free cash balance that one entry uses.
  • Schedule. Several algorithms act on a schedule. A schedule is day, week or month, meaning the first candle of each calendar day, week or month, or "every N candles", a count from 1 upward. The default is month. A calendar schedule means the same on hourly and on daily candles.
  • Bounds. "above 0" excludes the value itself, and "0 to 1" includes both ends unless the table says otherwise.

Cash

Holds the starting balance and never trades. It is the floor every other strategy is measured against: its return is zero, and its net worth line is flat. Cash takes no parameters.

Buy and Hold

Buys the asset with the whole cash balance on the first candle and holds it to the end of the run. If the first order is rejected, it tries again on the next candle. It trades exactly one instrument and takes no parameters.

Dollar-Cost Averaging

Buys a fixed amount of the asset at market on a schedule and never sells. A contribution that the free balance cannot cover in full is skipped, not reduced, so a fixed starting balance pays for a fixed number of contributions.

ParameterKeyTypeDefaultBounds
ContributionnotionalNumber100Above 0
SchedulescheduleSchedulemonthSee Conventions

The contribution is an amount of the simulation's primary quote asset. Both parameters are required.

Constant Mix

Holds a target fraction of the net worth in the asset and the rest in cash. It trades back to the target on a schedule, when the weight has drifted by more than a band, or on whichever happens first.

ParameterKeyTypeDefaultBounds
Target WeighttargetNumber0.6Above 0, below 1
Rebalance SchedulescheduleSchedule, or emptymonthSee Conventions
Drift BandbandNumber, or emptyEmptyAbove 0

The target is required. An empty schedule means the band alone decides, and an empty band means the schedule alone decides. The band is a fraction: 0.05 is five percentage points. A band narrower than a typical candle's move trades on nearly every candle and loses to fees.

Equal Weight

Holds every instrument it reads at the same share of the net worth, and rebalances on a schedule, on a drift band, or on whichever happens first. It is the baseline for several instruments: it needs two or more, all quoted in the same asset.

ParameterKeyTypeDefaultBounds
Invested FractioninvestedNumber1Above 0, up to 1
Rebalance SchedulescheduleSchedule, or emptymonthSee Conventions
Drift BandbandNumber, or emptyEmptyAbove 0

The invested fraction is the share of the net worth held in instruments at all, and it is required. The rest stays in cash. A rebalance sells and buys in one step, and the buys can only spend the cash that is free at that moment, so a fully invested portfolio can take two rebalances to settle.

Random

Makes random buy and sell decisions. On each candle on which a trade is affordable, it trades with the given probability, and each entry carries a take profit and a stop loss. It holds one such position at a time. The choices come from the run's seed, so the same run repeated makes the same trades. The app also lists it under Stochastic.

ParameterKeyTypeDefaultBounds
Trade Probabilitytrade_probabilityNumber0.50 to 1
Take Profit (%)take_profitNumber0.3Above 0, below 100
Stop Loss (%)stop_lossNumber0.3Above 0, below 100

The trade probability is required. The take profit and the stop loss are distances from the entry price, in percent. The stop loss also sets how much of the account one trade needs.

SMA Crossover

Buys with the cash balance when a fast simple moving average crosses above a slow one, and sells the position when it crosses back below.

ParameterKeyTypeDefaultBounds
Fast Periodfast_periodWhole number91 or more
Slow Periodslow_periodWhole number212 or more

Both periods are in candles and both are required. The slow period must be longer than the fast one.

SMA Long/Short

Long while a fast simple moving average is above a slow one and short while it is below, on a margin account at a chosen leverage. The signal is the same as SMA Crossover. What it adds is the short side and the loan behind it. It closes its position on a margin call, and it does not trade on an account that does not offer its leverage, which includes every spot account. See Margin and leverage.

ParameterKeyTypeDefaultBounds
Fast Periodfast_periodWhole number91 or more
Slow Periodslow_periodWhole number212 or more
LeverageleverageNumber21 or more
Minimum Margin Levelmin_margin_levelNumber1.51 or more

All four are required. The leverage must be a level the simulation offers. No new position is opened while the account's margin level is below the minimum. Closing is never held back.

MACD Crossover

Buys when the MACD line crosses up through its signal line and sells when it crosses back down. This is the same idea as SMA Crossover, a fast average overtaking a slow one, built from exponential averages.

ParameterKeyTypeDefaultBounds
Fast Periodfast_periodWhole number121 or more
Slow Periodslow_periodWhole number262 or more
Signal Periodsignal_periodWhole number91 or more
Committed FractioncommittedNumber1Above 0, up to 1

All four are required. The slow period must be longer than the fast one.

RSI Threshold

Buys when the relative strength index crosses up through a lower threshold and sells the position when it crosses down through an upper one. It acts on the crossing, not on the level: an index that stays below the threshold for weeks produces one buy. Compare it with Bollinger Band Reversion, whose levels move with volatility.

ParameterKeyTypeDefaultBounds
PeriodperiodWhole number142 or more
Oversold ThresholdlowerNumber30Above 0, below 100
Overbought ThresholdupperNumber70Above 0, below 100
Committed FractioncommittedNumber1Above 0, up to 1

All four are required. The app also lists it under Technical analysis.

Bollinger Band Reversion

Buys when the price closes below the lower Bollinger band, and closes the position when the price returns to the middle band or, by choice, to the upper one. The level it trades against widens and narrows with volatility.

ParameterKeyTypeDefaultBounds
PeriodperiodWhole number202 or more
Band WidthmultiplierNumber2Above 0
ExitexitChoicemiddlemiddle or upper
Committed FractioncommittedNumber1Above 0, up to 1

All four are required. The band width is the number of standard deviations between the middle band and the outer bands.

Time-Series Momentum

Holds the asset while its return over the last N candles is positive, and holds cash otherwise. It looks again only on its schedule. It has two states and no sizes in between: already holding is not a signal to buy more.

ParameterKeyTypeDefaultBounds
LookbacklookbackWhole number121 or more
Re-evaluation SchedulescheduleSchedulemonthSee Conventions

Both are required. Looking again on every candle is a different strategy with far more trades.

Donchian Breakout

Places a stop order at the highest high of the last N candles and buys when the price breaks through it. It leaves on a break of the lowest low of the last M candles, again with a stop order. It is the baseline that works with waiting orders: its journal shows stops being placed, moved and triggered.

ParameterKeyTypeDefaultBounds
Entry Channelentry_periodWhole number202 or more
Exit Channelexit_periodWhole number102 or more
Committed FractioncommittedNumber1Above 0, up to 1

All three are required. The exit channel is shorter than the entry channel by convention, so a position is left faster than it is entered.

ATR Trailing Stop

Enters exactly as Donchian Breakout does, and exits with a stop that follows the price upward at a distance of a multiple of the average true range. The stop moves up and never down. Run it against Donchian Breakout to compare two exits from the same entry.

ParameterKeyTypeDefaultBounds
Entry Channelentry_periodWhole number202 or more
ATR Periodatr_periodWhole number141 or more
Stop MultiplemultipleNumber3Above 0
Ratchet ThresholdratchetNumber0.50 or more
Committed FractioncommittedNumber1Above 0, up to 1

All five are required. A wider stop multiple survives more noise and gives back more profit. The ratchet threshold is how far the stop must improve, in average ranges, before it is moved. Moving a stop is a cancel and a new order, so at 0 the stop is replaced on nearly every candle.

Group

Holds several algorithms that trade one account together. You do not add Group yourself: the app builds it when you put several algorithms on one account. See Algorithm groups.

Remote

Connects a simulation to a program of your own that the engine calls on every step. See Remote algorithms.

ParameterKeyTypeDefaultBounds
URLurlTextNoneAn http, https, ws or wss address
EncodingencodingChoicejsonjson or msgpack
Protocol versionversionWhole numberEmpty1 or more

The URL is required. With http or https the engine sends one request per call. With ws or wss it keeps one connection for the run. Leave the protocol version empty to let the engine and your program agree on one.

On this page