거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

Multiple dynamic logistic regression first unsuccessful attempt - MetaTrader 5용 라이브러리

조회수:
3035
평가:
(28)
게시됨:
2022.04.06 17:12
업데이트됨:
2022.04.06 17:15
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

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

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 

This is Just a hypothesis, it is aimed to inspire you into the process of coding the multiple dynamic regression Algorithm, as discussed in Data Science and Machine Learning Article series linked above 


    RSI_MAonRSI_Dual RSI_MAonRSI_Dual

    Two indicators iRSI (Relative Strength Index, RSI) smoothed using iMA (Moving Average, MA)

    SAR Color Filling Right zone SAR Color Filling Right zone

    iSAR indicator (Parabolic SAR, SAR) with filled areas between the indicator and the price. On the right side, a rectangle is drawn equal in size to the fill area

    RSI_MAonRSI_Dual_EA RSI_MAonRSI_Dual_EA

    Strategy based on the signals of the custom indicator 'RSI_MAonRSI_Dual'

    Bollinger and Envelope candle extremes Bollinger and Envelope candle extremes

    Candle close above/below BB & Envelopes