rbf Neural Network Class

rbf Neural Network Class
Download ALL MT5 librarys (391)
YouTube Video Thumbnail



Similar MetaTrader Tools

rbf Neural Network Class

Info

The rbf Neural Network Class is a Library for MetaTrader 5 that this class implements a neural network of radial basis functions (rbf network). The classic design of an RBF network consists of two layers of neurons: a hidden layer with radially symmetric activation functions and an output layer with linear and sigmoid activation functions.

Usage

This tool is typically used for enhancing chart analysis and decision making.

Platform

This Library works exclusively on MetaTrader 5 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL5/Libraries folder via File ? Open Data Folder in MetaTrader 5.


How to Install and Use rbf Neural Network Class

1. Storage: Place library files in the MQL/Libraries directory to ensure they are accessible to your projects.

2. Implementation: Include the library in your code using the #import directive, ensuring you match the exact function names and parameters.

3. Compilation: Ensure the library is present in the directory before you compile your main EA or script, as the compiler links them during this phase.

4. Management: Keep libraries organized in sub-folders if you manage many custom functions to maintain a clean project structure.

Frequently Asked Questions

Q: What is a library file used for? A: Libraries store reusable code modules, allowing you to centralize common logic used by multiple EAs or indicators.

Q: Is a library executable? A: No, libraries are non-executable files containing functions; they must be imported into an EA, indicator, or script to function.

Q: Can I update a library while the platform is running? A: You should compile your EA or script after updating a library to ensure the latest code changes are integrated.

What this tool does

This class implements a neural network of radial basis functions (RBF network).

Typical Use Case

This Library excels in automated trading and technical analysis on MetaTrader 5.

Compatible Platform & Setup

This Library works on MetaTrader 5. Place the file in the MQL5/Libraries folder and restart the terminal.

Description & Settings

Related: as q neural net pure mq l5 neural network library - another powerful library for MetaTrader 5 traders.

This class implements a neural network of radial basis functions (RBF network).

Also recommended: cexecutionsafety: network latency guard for metatrader 5 expert advisors - similar library with strong performance on MetaTrader 5.


The classic design of an RBF network consists of two layers of neurons: a hidden layer with radially symmetric activation functions and an output layer with linear and sigmoid activation functions.

The output layer's activation function is automatically chosen during network training based on the test output data. For output values ranging from -1 to 1, a hyperbolic tangent is used, and for 0 to 1, a sigmoid function is applied. If the test output data falls outside the -1 to 1 range, no activation function is utilized.

The network is created using a parametric constructor, where the maximum number of neurons in the hidden layer is specified. The actual required number of neurons is determined during the learning process.

Network learning is facilitated by the 'learn' method, which takes the following parameters: the number of learning patterns, input and output data arrays, the number of learning cycles, and the maximum learning error. Input and output data are organized in one-dimensional arrays, vector by vector.

The learning process concludes when either the specified number of learning cycles is reached or the admissible error is attained. The 'learn' method returns specific values:

- 0 indicates successful network learning, and the learning result can be assessed through class variables: MSE (Mean Squared Error), epoch (number of completed learning cycles), and neurons (number of neurons in the hidden layer).
- -3 signifies an insufficient number of neurons in the hidden layer.
- -4 indicates a memory shortage.

The 'calculate' method is employed to obtain the network's response for a given input vector array.

The 'save' and 'load' methods are designed for saving and loading the network to/from a file, respectively. These methods preserve network topology, learning errors, and weight arrays. If the loaded network topology differs from the established one, the network won't be loaded, and the 'load' method will return false.

The class is demonstrated in the provided examples: 'test_rbfn_xor' for learning the XOR function and 'test_rbfn_mul_add' for learning multiplication and addition of integers. It is assumed that the class and example files are located in the same directory.

You may also like: MLP Neural Network Class for MetaTrader - excellent alternative for library users on MetaTrader 5.

Source Code

#include "class_netrbf.mqh"
double inppth[]={1,1,1,-1,-1,1,-1,-1}; // input teaching data array
double tchth[]={-1,1,1,-1};            // output teaching data array
double inpps[]={1,1,1,0,0,1,0,0};      // input teaching data array
double tchs[]={0,1,1,0};               // output teaching data array
void onstart()
  {
   cnetrbf *net;
   double ivect[2];     // input vector
   double out[1];       // the network responses array

.......

Leave your opinion, ask a question, share some knowledge

Limitations & Risk Warning

  • This tool is provided for educational and testing purposes only.
  • Past performance does not guarantee future results.
  • Trading involves substantial risk of loss. Use on a demo account first.
  • Results may vary depending on market conditions, broker, and settings.
  • We recommend thorough backtesting and forward testing before using with real funds.
© ROBOTFX Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.