MetaTrader 5 Platform update build 3660: Improvements and fixes - page 4

 
Beside this has anybody been able to sort a matrix according to a specified column?
 
Carl Schreiber #:
Beside this has anybody been able to sort a matrix according to a specified column?

With sort and argsort , no , getting the errors you mentioned.

int OnInit()
  {
//---
  matrix neo;
  neo.Init(6,3);
  //rantomize
    for(uint rows=0;rows<neo.Rows();rows++){
       for(uint cols=0;cols<neo.Cols();cols++){
          double rando_commando=(((double)MathRand())/32767.0)*20;
          neo[rows][cols]=((int)rando_commando);
          }
       }
  Print("Unsorted");
  Print(neo);
  //sort based on colum
    matrixColumnSort(neo,2,SORT_DESCENDING);
  Print("Sorted");
  Print(neo);
//---
   return(INIT_SUCCEEDED);
  }

void matrixColumnSort(matrix &the_matrix,
                      uint column,
                      ENUM_SORT_MODE sort_mode){
if(column<the_matrix.Cols()){
for(ulong i=the_matrix.Rows()-1;i>=1;i--){
   for(uint j=0;j<i;j++){
      //ascending 
        if(sort_mode==SORT_ASCENDING){
          if(the_matrix[j+1][column]<the_matrix[j][column]){
            the_matrix.SwapRows(j,j+1);
            }
          }
      //descending 
        else{
          if(the_matrix[j+1][column]>the_matrix[j][column]){
            the_matrix.SwapRows(j,j+1);
            }          
          }
      }
   }
}else{
Print("invalit column");
}
}
 
Carl Schreiber #:

Even tri does not work as described:

This is what I tried:

and this is what I get:

:(

It works as documented. What are you expecting as result ?
 
Carl Schreiber #:

Acc. to https://www.mql5.com/en/docs/matrix/matrix_manipulations/matrix_sort:

I should be able to sort a vector But (b3662):

Confirmed and reported to developer.
 
Carl Schreiber #:

Even tri does not work as described:

This is what I tried:

and this is what I get:

:(

Alain Verleyen #
:

It works as documented. What are you expecting as result ?

The function allows any value so I was assuming that this should have some effects otherwise MQ would have defined three enums for the different modes as MQ has done so in many other cases.

 

There is another problem with the matrices :(

I have an XML-file with 509 rows which I read into a matrix.

Now I want to print out some informations about the parameters used. So I copied the column vCol of a parameter (in the XML matrix col: iFirstXML - iLastVar) and assign these values into a new matrix mVars of only the parameters. One column one parameter, a specific statistical value:

   for(iV=0;iV<(int)iLastVar;iV++)  {
      iX = iV+(int)iFirstXML;
      vCol = XML.Col(iX);
      mVars[(int)€nRes][iV] = (double)nL;
      mVars[(int)€Max][iV] = vCol.Max();
      mVars[(int)€Min][iV] = vCol.Min();
      mVars[(int)€Mid][iV] = 0.5*(mVars[(int)€Max][iV] + mVars[(int)€Min][iV]);
      mVars[(int)€Med][iV] = vCol.Median();
      mVars[(int)€Mean][iV] = vCol.Mean();
      mVars[(int)€StDv][iV] = vCol.Std();
      mVars[(int)€nVal][iV] = vCol.Ptp()/mVars[3][iV];
...   
   while(v-->0) {
      Print(VarHeader[v],": ",mVars.Col(v));
   }

At the end I print each column with the parameter name at the beginning. This is what I get:

2023.04.05 15:11:23.531    analyseTesterXML (EURUSD,H1)    cTrail: [509,inf,0.8,0,1.35,1.3,1.343614931237721,0.3421638887597058]
2023.04.05 15:11:23.531    analyseTesterXML (EURUSD,H1)    nTrail: [509,inf,0,0,4.5,6,4.69155206286837,3.324781533768716]
2023.04.05 15:11:23.531    analyseTesterXML (EURUSD,H1)    doClsOppPos: [509,inf,0,0,0.5,1,0.5579567779960707,0.4966296526430073]
2023.04.05 15:11:23.531    analyseTesterXML (EURUSD,H1)    PT_Coeff: [509,inf,0.8,0,1.15,1.1,1.133005893909626,0.2330522719442697]
2023.04.05 15:11:23.531    analyseTesterXML (EURUSD,H1)    PT_PIP: [509,inf,3,0,5.5,5.5,5.55992141453831,1.60788968141974]
2023.04.05 15:11:23.531    analyseTesterXML (EURUSD,H1)    FullBarsStop: [509,inf,12,0,17,18,17.02161100196464,3.551684699169537]
2023.04.05 15:11:23.531    analyseTesterXML (EURUSD,H1)    HalfBarsBackTrigg: [509,inf,5,0,8.5,9,8.607072691552062,2.275440991525463]
2023.04.05 15:11:23.531    analyseTesterXML (EURUSD,H1)    BarsBack: [509,inf,500,0,1250,1300,1261.296660117878,461.7970029289808]


So: Max() of each column became inf ? //enum: €Max=1,€Min=2,..

This is the top of the XML-file opened in LO-Calc (excel):



Boolean values are converted to 0.0 and 1.0 and assigned - even here .Max() is inf ?

One can see that e.g. the mid value (=(max+min)/2) is correct. So the max value = 2000 for BarsBack must haven been correct only the printout fails.

 
Carl Schreiber #:

The tester (Win 10, b 3661) hangs :(

After testing the same EA with EURUSD and XAUUSD the tester hangs after the first few results:

started this morning:


This result hasn't really changed since 8 hors,

The MT5 task manager doesn't help, while Win10 TaskManager shows this:


Why is ntoskrnl.exe so heavily used? (Ram is no full so the system is not swapping).

My EA was tested with XAUUSD and the same period with 510 passes (+ some doubled calculated= within 24h so ~21 passes within 1 hour and now ...?

Meanwhile I updated to b.3675:


and still I am facing the same problem: the optimization snags so badly after the first few quick runs that everything comes to a standstill :(

Here are some screenshot taken at different times:

The first 32 in 1 hour but the next 12 in 4 hours (~3 per hour):

and now 33 in 9 hours (~3,7 per hour)


These are the settings:


The TaskManager of MT5 shows nothing that seemed striking to me and the Windows Taskmanager shows a usage of 100% CPU, and 48% for RAM - so the system was not blocked by swapping.

By the way the optimization table has 68 rows and the biggest pass number is 67. So the first fast passes are not so fast because they were early stopped due to no money.

 
Carl Schreiber #:

Meanwhile I updated to b.3675:

Is it the same behavior on older builds?
 
fxsaber #:
Is it the same behavior on older builds?

Previously it was b.3661 and now I have b.3675. so the same thing as 14 builds before :(

Do you know an older build that does not show this 'feature'?
MetaTrader 5 Platform update build 3660: Improvements and fixes - How to fix the problem of MT5 optimization in Windows 10
MetaTrader 5 Platform update build 3660: Improvements and fixes - How to fix the problem of MT5 optimization in Windows 10
  • 2023.04.02
  • www.mql5.com
The tester (win 10, b 3661) hangs :( after testing the same ea with eurusd and xauusd the tester hangs after the first few results: started this morning: this result hasn't really changed since 8 hors, the mt5 task manager doesn't help, while win10 taskmanager shows this: why is ntoskrnl. I've not faced issues (no running , hanging) with 3661 because i run all my optimizations (due to their nature) like so. So if it's an mt5 issue, it's waste of time and nothing will be fixed
 
Carl Schreiber #:

Do you know an older build that does not show this 'feature'?

Try some old builds from the archive (link in profile).


It is important to determine which build the problem started with. Then it will become much easier for developers to find the cause.