NXL2 Notes (July 11th, 2005)

Some knowledge of Visual Basic as well as prior acquaintance to neural networks are necessary to use NXL2.

NXL2 is now released (v1.132). It is basically a neural net library (API) using an algorithm close to QuickProp (Scott Fahlman), which can easily be called from MS Excel or MS Access. It is composed of over 40 different functions catering for most neural net applications (predictions and classifications).

Each function is documented separately on the ForeTrade site (http://www.foretrade.com/nxl.htm), but the best way to start with NXL2 is to run the provided Excel spreadsheet samples, and read the VBA code included which is relatively simple.

Neural net VB code:

The general VB code structure is as the following:
Set number of inputs, outputs, patterns
This will allow NXL2 to construct data structures when a new neural net is built in memory
Check the lib is enabled (Demo or Full mode)
A personal 12 character long code will be generated upon valid registration
Build Net
Generation of a neural net architecture and involved data structures in DLL memory
Change some training parameters
Default parameters set while building can be changed at this stage
Load Data in memory (training data and often test data)
Train the net
Loop through training data, and check for error level on training or test data.
Release memory inside the DLL
Absolutely essential, otherwise no new net can be created, and memory will NOT be deallocated with closing Excel. If anything else, a ReleaseNet call should be added to the workbook close event.

Memory usage:

One important feature to remember is that the library uses dynamic arrays so that it can be used with virtually unlimited number of inputs and outputs (in full mode). Memory is allocated at the time of building the neural net (BuildNet) and must be released with ReleaseNet when the neural net is no longer needed. It is well described in the accompanying spreadsheet code (QP2.2.xls). Failing to release memory may cause memory leaks, which are errors often hard to trace, and would eventually crash Excel. It is possible that a really really huge neural model exceeds the DLL memory capacity, but it has never been reached in any of our experimentations.


Most variables (input, output, pattern number) passed to the library are "1-based", and reset to 0 inside the library. This means for instance, and inputs go from 1 to NumInputs, patterns range from 1 to NumPatterns. The only exception is the SaveNet/LoadNet functions which call weights starting with weight no 0. Again, this is well commented in the VBA code.

Training issues:

The data provided in the Excel sample is a fairly complex non-linear function, to be mapped by the neural network. NXL2 does a very good job at modeling that function.
Like in most neural net applications, the required accuracy influences significantly the processing time (network learning).
A basic "early stopping" technique is implemented. It stops learning when the gradient of the error curve (on Test data) comes close to nil. This means that learning can then only improve almost insignificantly.

Training is calibrated (i.e. training data is presented several times before testing the net on unseen data), in other words, NXL2 validates the network against test data every so many epochs, or training batches. An epoch is the presentation of the entire training set to the neural network while training. Calibrating generally improves learning time, however, difficult (noisy data or sparse patterns in data set) problems may require to lower the Calibration parameter to test the net more often.

Data scaling:
Data is scaled in Excel using a Map function provided in the VBA code. Mapping is often essential in neural applications, to level the impact of inputs against one another. it is also possible to apply data squashing, or clip statistical outliers.

Saving/Loading a net, Exit Conditions:
It is possible to store/retrieve the net to/from a separate worksheet in the same workbook for instance. It is usually good to associate SaveNet with the net training exit condition so that the best neural net is saved. Indeed, the error level often deteriorates (on test data) after reaching an overall minimum. With the supplied data, the function to map is relatively simple, so the net can almost always improve if one lets it carry on forever, if not stopped after a number of training epochs.
The provided code stores node weights. It is left up to the user to also store/retrieve other parameters.

Trading applications:
You can copy/paste or program indicators using Excel or VBA functions, and use NXL2 to predict a %change in Open or Close, and to predict the future value of an indicator. In many trading experimentations, classifications seem to bring about better results. In any case, the quality of the neural model depends essentially on the quality of data preprocessing. The provided sample proves that the neural nets do a great job on sample data mapping a pattern that is present on every record. It is NEVER so easy in trading applications, and whatever most neural net salespeople will tell you, this neural library does perfectly what it is designed to do. The rest is left on your hands, i.e. find good inputs, output(s), and preprocess them the best way you can.

Library Activation:
The library will run in demo mode until activated for your computer. A code can be generated (c.f. additional Excel menu). Registered clients will receive their personal code to fully enable their neural library. In demo mode, nets are limited to 300 training patterns, and 15 nodes (including input and output nodes). Once activated, the NXL2 library has virtually no limits (cf. ForeTrade site for latest price details).

Assistance in building your own neural solutions will be charged at reasonable rates: $35/week email support (support@foretrade.com). Support can however be VERY time consuming, particularly when it comes to using an API, so this implies the question is 'standard' (so the answer also is), and that the user has done his homework with sample code.
Dedicated development is charged from $30 to $100/hour according to complexity and scale.

Latest information will posted on the Foretrade web site.

Thank you for your interest in NXL2