Neural Network Wizard

How It Works

The Wizard follows a simple loop: you configure a network, generate the AFL, and paste it into AmiBroker to train and use it. This page walks through that loop end to end so you know where each later section fits. For the concepts underneath it — what training and prediction actually are — see Neural Networks for Traders.

1. Configure the network

In the main window you give the network a name and set its hyperparameters across four tabs:

  • Settings — epochs, learning rate, test split, error and learning algorithms.
  • Architecture — the model type (Feed-Forward, LSTM or GRU) and its layers.
  • Accuracy — regularization that curbs overfitting.
  • Optimizer — hyperparameters for the chosen learning algorithm.

2. Describe the data

A network needs to know what to learn from and what to predict. You add these in the network tree:

  • Inputs — the indicators or price series fed into the network.
  • Outputs — the value the network learns to predict, some number of bars ahead.
  • Code snippets — optional custom AFL woven into the generated formulas.
  • Ticker training pool — the symbols a Standard network trains across.
Note

A network is valid — and the Generate Formula button becomes enabled — once it has a name, at least two inputs and at least one output.

3. Generate the AFL

Click Generate Formula. The Wizard validates the network and produces the AFL in a tabbed results window. For a Standard network you can choose a Combined Formula (one self-contained file that trains on demand and plots automatically — the default) or the classic Separate Formulas pair, one to train and one to plot the prediction. For a Walk-Forward network you get a single formula that does both in one pass. See Generating the Formula.

4. Train in AmiBroker

Steps 4 and 5 below describe the Separate Formulas. If you copied the Combined Formula instead, the two steps collapse into one file: drop it on a chart, click its Train button once, and it plots the prediction automatically from then on — see Generating the Formula.

Copy the Training Formula into AmiBroker and run it (typically as a scan or by applying it to a chart). It trains the network on your data and writes the trained weights to a .net file named after your network.

Warning

Train before you plot. The indicator formula loads the saved .net file, so it has nothing to show until the training formula has run at least once.

5. Plot the prediction

Copy the Indicator Formula onto a chart. It loads the trained network and plots its prediction, which you can read as an indicator or feed into the buy/sell logic of a larger system.

Warning

Judge the network on data it never trained on. After training, compare its error on the held-out test set with its error on the training data — if the test result is much worse, the network has overfit and won't perform live, however good the chart looks. And remember a prediction is only the start: you still need entry/exit rules, costs and risk management around it.

Tip

Iterate. Most of the work is in step 1–2: choosing good inputs and a sensible architecture, then re-training and comparing. Use File → Save (registered version) to keep a network design you can reopen and refine later.