An independent plugin for AmiBroker · built for serious traders Documentation & support →

Neural Networks

Build, train and run neural networks directly from AFL — feed-forward MLP, LSTM and GRU — with the anti-overfitting controls that matter on market data.

Neural Networks

The Toolbox lets you build, train and run neural networks directly from AmiBroker formula language, so you can add a flexible, non-linear way of combining indicators to the platform you already use. Where a moving-average crossover uses a fixed rule you chose yourself, a network discovers the rule from your history — including subtle interactions that would be hopeless to write by hand.

Three architectures

The default is a feed-forward network (an MLP), which treats each bar independently and is fast, robust and the right choice for almost everything. Two recurrent architectures are also built in — LSTM and GRU — which read a window of consecutive bars in order and carry an internal memory, so they can learn patterns that depend on the shape of recent price action. You choose the model, the hidden layers and the activation for each layer with a single set of function calls.

Fourteen training algorithms

You are not limited to plain back-propagation. The Toolbox ships fourteen optimizers, from the resilient-propagation family (RPROP, iRPROP+, SARPROP) to the modern Adam family (Adam, AdamW, NAdam, AMSGrad, RMSProp and more). iRPROP+ is a robust set-and-forget default that needs no learning rate; AdamW pairs adaptiveness with built-in weight decay when overfitting is a concern. Learning-rate schedules — step, cosine annealing and SGDR with warm restarts — and minibatch training are available too.

Built to fight overfitting

The real challenge on noisy market data is not fitting the training bars but predicting new ones, and that comes down to controlling overfitting. The Toolbox holds back a slice of your data as an unseen test set, reports the training and test error so you can actually see overfitting happen, and gives you early stopping, dropout, weight decay, gradient clipping and proper weight initialisation to beat it. Automatic input and output scaling keeps every series on a comparable footing — feed a rate of change rather than raw price and predictions become far more reliable.

Two ways to work

Standard networks train once on a block of history and save to a file you run later — and a single network can be trained across a whole pool of symbols for a more general model. The adaptive walk-forward family does training and prediction in one call, retraining on a rolling window as it walks the chart so every prediction is genuinely out-of-sample. A trained standard network can even be compiled to pure AFL — its weights written out as ordinary formula language, so nothing is hidden in your backtest. Everything is driven from simple AFL function calls and comes with full documentation; the companion Neural Network Wizard builds and trains the networks for you visually.