Discussing the article: "ALGLIB numerical analysis library in MQL5"

 

Check out the new article: ALGLIB numerical analysis library in MQL5.

The article takes a quick look at the ALGLIB 3.19 numerical analysis library, its applications and new algorithms that can improve the efficiency of financial data analysis.

Why choose ALGLIB when working with financial data?

Here are the key benefits of the library:

  • Portability: ALGLIB compiles easily on a variety of platforms using a variety of compilers making it accessible to developers of varying backgrounds.
  • Ease of use: Support for multiple programming languages so you can choose the language you are most comfortable with, without having to learn new syntax.
  • Open source: ALGLIB is open source and can be used under GPL 2+ terms. This makes it accessible for both scientific research and commercial projects.
  • Commercial user support: Commercial users can purchase a license that provides them with legal protection when using ALGLIB.

Besides, the library contains the large collection of test cases covering the major part of the proposed methods' functionality.

Author: MetaQuotes

 

I always wondered about "ALgLIB in MQL" - how close it is to the original and corresponds to it?

Understand correctly, the worst thing that can happen is to get different results using AlgLIB for example in C/C++ and in MQL.

 
Maxim Kuznetsov #:

I always wondered about "ALgLIB in MQL" - how close it is to the original and corresponds to it?

Understand correctly, the worst thing that can happen is to get different results using AlgLIB for example in C/C++ and in MQL.

The last two lines (about test cases) are just about this - run, test and compare, nobody is stopping you.
 
Aleksey Nikolayev #:
The last two lines (about test-cases) are just about that - run, test and compare, nobody is stopping you.

The last two lines are about test-case of the original AlgLIB. There are no tests in the MQL5 adaptation.

 
Maxim Kuznetsov #:

the last two lines about test-case of the original AlgLIB. There are no tests in the MQL5 adaptation.

I think there are some. But if they are not the ones, what prevents you from rewriting the ones in mql5?
 

A few links to broaden your horizons.

<img width="640" height="480" src="https://c.mql5.com/3/419/3676818984909.png" loading="lazy" alt style="vertical-align:middle;"/ translate="no">

 
Maxim Kuznetsov #:

the last two lines about test-case of the original AlgLIB. There are no tests in the MQL5 adaptation.

All extensive Alglib test-cases have always been from the very first ported version of the MQL5 library(October 2012):

\MQL5\Scripts\UnitTests\Alglib\
                               TestClasses.mq5
                               TestInterfaces.mq5
                               TestClasses.mqh
                               TestInterfaces.mqh

Now it is 3,850 kb of tests in source code and 105,000 lines of code covering almost all functionality.

Anyone can compile the unit tests TestClasses.mq5 / TestInterfaces.mq5 and run them in the terminal.

Библиотеки: ALGLIB - библиотека численного анализа - Хорошая библиотека численного анализа MetaQuotes.
Библиотеки: ALGLIB - библиотека численного анализа - Хорошая библиотека численного анализа MetaQuotes.
  • 2012.10.12
  • www.mql5.com
ALGLIB - библиотека численного анализа MetaQuotes. Библиотека ALGLIB - крайне нужный инструмент исследователя и строителя торговых систем. Хотелось бы увидеть развернутую документацию по использованию функционала библиотеки и несколько статей на эту тему
 

In addition to Alglib, there are testcases for other maths libraries:


 
Colleagues, where (in which file) can I see the version number of the library?
 

After the update the neural network stopped working.

I rolled back to the old version of ALGLIB. If you need it - attached.

Files:
Alglib_old.zip  644 kb
 

Afternoon!

Has anyone been able to figure out how to use non-linear ISC optimisation ?

Here is an example from Alglib site https://www.alglib.net/translator/man/manual.cpp.html#example_lsfit_d_nlf

Could you please tell me what I'm doing wrong?

//+------------------------------------------------------------------+
//|Optim.mq5 |
//|vp |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "vp"
#property link      "https://www.mql5.com"
#property version   "1.00"
#include <Math\Alglib\alglib.mqh>
 
 void function_cx_1_func(double &c[],double &x[],double &func,CObject &obj)
{
    // this callback calculates f(c,x)=exp(-c0*sqr(x0))
    // where x is a position on X-axis and c is adjustable parameter
    func = MathExp(-c[0]*MathPow(x[0],2));
}


void OnStart()
  {
int info;
CObject  obj;
vector v = {-1,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1.0}; 
double y[] = {0.223130, 0.382893, 0.582748, 0.786628, 0.941765, 1.000000, 0.941765, 0.786628, 0.582748, 0.382893, 0.223130};
double c[] = {0.3}; 
CMatrixDouble x;
x.Col(0,v);
double epsx = 0.000001;
int maxits = 0;
double diffstep = 0.0001;

//
// Fitting without weights
//
CLSFitStateShell state;
CAlglib::LSFitCreateF(x,y,c,diffstep,state);
CAlglib::LSFitSetCond(state,epsx,maxits);
CNDimensional_Rep rep;
CNDimensional_PFunc function_cx_1_func;
CAlglib::LSFitFit(state,function_cx_1_func,rep,0,obj);

CLSFitReportShell grep;
CAlglib::LSFitResults(state,info,c,grep); 
 
ArrayPrint(c); // EXPECTED: [1.5]
Print(grep.GetIterationsCount());
Print(grep.GetRMSError());
   
  }