Multiple dynamic logistic regression first unsuccessful attempt – library MetaTrader 5

For anyone who does not understand the code provided in this library read the article linked here https://www.mql5.com/en/articles/10626

Multiple Dynamic Logistic Regression Challenge

The biggest challenge I faced when building both linear and logistic regression libraries in both articles is multiple dynamic regression functions where we could use them for multiple data columns without having to hard-code things up for every data that gets added to our model, in the previous Article I hardcoded two functions with the same name the only difference between them was the number of data each model could work with, one was able to work with two independent variables the other with four respectively

void   MultipleRegressionMain(double& predicted_y[],double& Y[],double& A[],double& B[]); 
void   MultipleRegressionMain(double& predicted_y[],double& Y[],double& A[],double& B[],double& C[],double& D[]);

but, this method is inconvenient and it feels like a premature way of coding things up and it violates the rules of clean code and DRY (don’t repeat yourself principles that OOP is trying to help us achieve)

Unlike python with flexible functions that could take a large number of functional arguments with the help of *args and **kwargs, In MQL5 this could be achieved using string only as far as I can think, I believe this is our starting point

void CMultipleLogisticRegression::MLRInit(string x_columns="3,4,5,6,7,8")

the input x_columns represents all the independent variables columns that we will use in our library, these columns will require us to have multiple independent arrays for each of the columns but, there is no way we can create arrays dynamically, so the use of arrays fall flat here

Alternative:  SDX-TzPivots - indicator MetaTrader 4

We can create multiple CSV files dynamically and use them as arrays, for sure but this will make our programs more expensive when it comes to the use of computer resources compared to the use of arrays, especially when dealing with multiple data not to mention the while loops that we will frequently use to open the files will slow the whole process down, I’m not 100% sure so correct me if I’m wrong

thought we can still use the mentioned way,

 I have discovered the way forward to use arrays we are going to store all the data from all the columns in one array then use the data separately from one that single Array 

   int start = 0;
   if (m_debug) //if we are on debug mode print Each Array vs its row
      for (int i=0; i<x_columns_total; i++)
         {
            ArrayCopy(EachXDataArray,m_AllDataArray,0,start,rows_total);
            start += rows_total; 
            
            Print("Array Number =",i," From column number ",m_XColsArray[i]);
            ArrayPrint(EachXDataArray);     
         } 

Inside the for loop, we can manipulate the data in the arrays and perform all the calculations for the model the way want for all the columns, I have tried this method but I’m still on the unsuccessful attempt, the reason I explained this hypothesis is to let everyone reading this article understand this challenge and I welcome all your opinions in the comment sections on how we can code this multiple dynamic logistic regression function 

    📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks