Libraries: ALGLIB - Numerical Analysis Library

 

ALGLIB - Numerical Analysis Library:

ALGLIB math function library (v. 3.5.0) ported to MQL4.

Author: MetaQuotes Software Corp.

 

I think I will try to use this to run some analysis on my EA in real-time and have it adjust parameters in accordance.

I don't know if it will be more profitable, but that is another matter.

Thank you!

 

I think I will try to use this to run some analysis on my EA in real-time and have it adjust parameters in accordance.

I don't know if it will be more profitable, but that is another matter.

Thank you!

 

cannot cast 'CDoubleValue' to 'CLongValue' bitconvert.mqh 485 7


This include makes casting error.


Do you have new one?

 
Shin Joo Young:

cannot cast 'CDoubleValue' to 'CLongValue' bitconvert.mqh 485 7


where did you get this include file? We couldn't reproduce this error

 
Rashid Umarov:

where did you get this include file? We couldn't reproduce this error


I installed mt5 yesterday and I found bitconvert.mqh there.

I copy the file to mq4 terminal and it has no errors.

Old version of bitconvert.mqh attached.

Files:
 
Shin Joo Young:

I installed mt5 yesterday and I found bitconvert.mqh there.

Tell me the build of your MetaTrader 5 please. And where did you download it?
 
ffoorr:

It do not work for me.


I instaled all the files into an MT4 terminal, the include into the include folder Math\Alglib\Alglib , and scripts into the script folder, and so on.

And when I compile the script file : Alglib.mq4 it send errors :


Did someone try to use this librairy, and tell if it work on MT4 ?

 

OK, It work on MT4, so I deleted my first post.

Or at least it compile, I changed the Math folder for another one i have (on an MT5 terminal).

could someone show an exemple of how to realize a simple linear regression using this librairy, how to get the R  squarred,  and how to get the statistic : kurtosis, mean ect of a simple double array ?

 

Ok it compile and it work, but this part, into script alglib.mq4,  must be changed :

   if(order_type==6) // OP_BALANCE=6
        {
         if(NormalizeDouble(OrderProfit()+OrderSwap(),2)>=0.0)
            if(balance==0.0)
               balance=OrderProfit();
        }
        
      //--- get the profit and balance
      if(order_type==OP_BUY || order_type==OP_SELL)
        {
         if(balance==0.0)
           {
            Print("Trade operations with zero balance");
            delete balance_total;
            delete profit;
            return;
           }

change if this way :

  delete this because it do not work :  if(order_type==6) // OP_BALANCE=6
 

/* 
 if(order_type==6) // OP_BALANCE=6
        {
         if(NormalizeDouble(OrderProfit()+OrderSwap(),2)>=0.0)
            if(balance==0.0)
               balance=OrderProfit();
        }
     */   
      //--- get the profit and balance
      if(order_type==OP_BUY || order_type==OP_SELL)
        {    // add this : 
         balance += OrderProfit();
         if(balance==0.0)
           {
            Print("Trade operations with zero balance");
            delete balance_total;
            delete profit;
            return;
           }


here are the result ot script algib.mq4

23:59:05.205    UseAlglib EURUSD,H1: -----------------------------------------------
0       23:59:05.205    UseAlglib EURUSD,H1: Correlation function: y = 2.09x + 14.04
0       23:59:05.205    UseAlglib EURUSD,H1: Expected Payoff = 1.05
0       23:59:05.205    UseAlglib EURUSD,H1: AHPR = 1.0909
0       23:59:05.205    UseAlglib EURUSD,H1: Sharpe Ratio = 0.34
0       23:59:05.205    UseAlglib EURUSD,H1: LR Correlation = 0.97
0       23:59:05.205    UseAlglib EURUSD,H1: LR Standard Error = 6.84
0       23:59:05.205    UseAlglib EURUSD,H1: -----------------------------------------------
 

  OP_BALANCE do not exist in MT4 list.

calculations are wrong,

This is way too complicated for simple calculation on a simple array double

Reason: