GRNN Class

GRNN Class
Download ALL MT5 librarys (391)
YouTube Video Thumbnail



Similar MetaTrader Tools

GRNN Class

Info

The GRNN Class is a Library for MetaTrader 5 that the cnetgrnn class implements a generalized regression neural network (grnn). Network creation is defined in the class parametric constructor.

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 GRNN 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

The cnetgrnn class implements a Generalized Regression Neural Network (GRNN).

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: simplified order management class for mt4/mt5 - another powerful library for MetaTrader 5 traders.

The cnetgrnn class implements a Generalized Regression Neural Network (GRNN).

Also recommended: class calc frac - custom bar count for fractal detection - similar library with strong performance on MetaTrader 5.


Network creation is defined in the class parametric constructor.

The learn method facilitates network training by specifying the number of learning patterns, input and output data arrays, learning cycles, and maximum learning error. Input and output data are organized in one-dimensional arrays, vector by vector. The learning process concludes upon reaching the specified number of learning cycles or an acceptable error threshold.

The learn method returns:

- 0: Network learning is successful, and the result can be assessed via class variables: mse (learning error) and epoch (completed learning cycles).

- -4: Insufficient memory.

The calculate method, which takes input vector arrays and network response arrays as arguments, is employed to obtain the network's response.

Save and load methods are provided for network serialization and deserialization, respectively. These methods save and load network topology, learning errors, and array weights to and from a file. If the loaded network topology differs from the established network topology, the load method will return false.

The class is demonstrated in the accompanying examples: test_grnn_xor for learning the 'exclusive or' function and test_grnn_mul_add for learning integer multiplication and addition.

You may also like: cgv class for global variables - excellent alternative for library users on MetaTrader 5.

Source Code

#include <class_grnn.mqh>
double ivect[2];  // input vector
double outr[1];   // the network responses array
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()
{
   print("example for the input data range from -1 to 1");

.......

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.