Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 940

 
Seric29:

The problem is that I apply templates to all functions that take arrays, and export and import of template functions is not possible, it will have to duplicate functions for each type, the same situation with dimensionality mql does not want to give them for nothing and again have to duplicate them by dimensionality turns out a kind of overload but adding additional arguments is not necessary nevertheless this is also unnecessary code, as for increasing function arguments mql also will not give just data will have to duplicate functions e So I don't think it's worth it, I thought about writing my own language but then again I wrote 15% of my robot and spent more than a year to calibrate everything and make it as universal as possible and provide fast performance and 3 years for calculations. I just don't have enough life to write my own language. It goes like this.

Having your own language is awesome!

But maybe you should first learn MQL.

And then you'll see that its features are not small even now.

But if you learn C++ you won't have any problems in programming at all.

Yes, I've looked through your code in C++ and see that you know very little.

 
Koldun Zloy:

Yes, your code in C++, I looked at it and see that you know very little.

It's better to learn programming at the age of 4, and I'm already 26, the probability of becoming a great programmer is very low, remember people like Elon Musk and others who could program at the age of 9, I would at least fulfill the main task.

 

There is a function

ArrayCopy

But it doesn't allow you to copy a specific column. Then there is a function

ArrayInitialize

and again the same nonsense, then there is the function

ArrayFill

but here too, you can't specify a column. What good are these functions if you have to write your own.

 
Seric29:

It's better to learn how to program from the age of 4, and I'm already 26.

Oh, you're smoking something strong! )))))

you can't teach computer programming from the age of 4 years old, because he wants to play with toys by throwing them on the floor, besides, a kid is not taught how to read, he can only count to ten (prodigies can count to 100! ))) )

You can not learn anything at 26 years of age? In the three months that you have been writing your problem, you would have solved it if you started reading and reading, the MQL forum is one of the few forums where you can get an answer to your question in 1-2 hours, it's really cool! Well, this is your way of life. Here I found one for your problem, it couldn't be better:

https://www.mql5.com/ru/forum/3457/page4494#comment_12804114

 
Seric29:

It is better to learn to program from the age of 4, and I am 26 already, the probability of becoming a cool programmer is very low, remember people like Elon Musk and others who could program at the age of 9, I would at least complete the basic task.

I didn't start at age 4, or even at age 9.

The probability of becoming a cool programmer starting at 26 is very high.

 

Guys I have a question but don't laugh why this code doesn't work

#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#define  Mkarr(q,w,e,r) switch(ArrayDimension(q)){case 3:q[w][e][r]=15;break;case 2:q[w][e]=15;break;}
int Mas[7],//#else
    Mas2[2][2]={{3,8},{4,17}},
    Mas22[2][2]={{31,128},{94,107}},
    Mas3[2][2][2];

int OnInit()
  {int Perem=ArrayDimension(Mas); 
   Mkarr(Mas2,0,0,0);
   return(INIT_SUCCEEDED);
  }

Says wrong access to the array how does it know if all variants of the case are not checked and tries if nothing is checked too and throws an error? Is it possible to skip the code at compile time or it does not help?

 
Seric29:

Guys I have a question but don't laugh why this code doesn't work

Says wrong access to the array how does it know if all variants of the case are not checked and tried if nothing is checked too and throws an error? Is it possible to skip the code at compile time or it does not help?

That's not funny, it makes me want to cry.

why do you use macros if you don't know how to use them? uncompile the macro (just copy the fuck!) and you should see where the error is

SIN: ..... "The mice cried and cried but kept chewing on the cactus" ((((

 
Igor Makanu:

it's not funny, it makes me want to cry.

why do you use macros if you don't know how to use them? unpack the macro (just copy the fuck!) and you should see where the error is

SZY: ..... "The mice cried and cried, but kept gnawing on the cactus" ((((

I don't really understand it, macro may take any item and when processing it in the compiler I get a protection that one and the same item may not be both this and that. Is it possible to implement such an idea?

 
Seric29:

I don't know much about it, the macro takes any element and when processing it in the compiler there is a protection that one and the same element cannot be both those and those at the same time, I have such thoughts. Can such an idea be implemented?

one more time... Take your macrosubstitution in ME (or at least in notepad!) and "plug" it in instead of using it, replace all parameters in brackets with your numbers

I don't even know how to explain it any easier... Read Wiki if you don't have enough reference on MQL

Macro command

C preprocessor

 
Igor Makanu:

one more time... take your macro substitution in ME (even in notepad!) and "plug" it in instead of using it, replace all parameters in brackets with your numbers

replaced for you, here is the code without macros

//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//#define Mkarr(q,w,e,r) switch(ArrayDimension(q)){case 3:q[w][e][r]=15;break;case 2:q[w][e]=15;break;}
int Mas[7],//#else
Mas2[2][2]={{3,8},{4,17}},
Mas22[2][2]={{31,128},{94,107}},
Mas3[2][2][2];
int OnInit()
  {
   int Perem=ArrayDimension(Mas);
//   Mkarr(Mas2,0,0,0);
   switch(ArrayDimension(Mas2))
     {
      case 3:Mas2[0][0][0]=15;
      break;
      case 2:Mas2[0][0]=15;
      break;
     }
   return(INIT_SUCCEEDED);
  }

i don't know why you are spending so much time on working with multidimensional arrays if you can't understand C++ / MQL syntax and basics, you have arrays defined with one dimension and you are trying to use them with another, of course i may be wrong, but this trick should not work even in Python, imho

Reason: