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

 
Maxim Kuznetsov:

even the compiler will highlight "the result of OrderSelect must be checked" in the first case ;-)

If you change for the first one if (!OrderSelect(...)) continue; then the options are identical.

In the first one the code is visually linear, in the second one it looks like a staircase. I prefer the first one, it's easier to read and in general the appearance of deep logical tabs {{{{ }}}} hints that it's time to change something :-)

Thanks. Does writing in staircase affect code speed? It's easier for me to understand staggered writing.

 
novichok2018:

Thank you. Does stair-step recording affect the speed of code execution? It's easier for me to understand staircase writing.

It is the algorithm that influences the speed of execution in the first place. And how you represent it in the code doesn't really matter.

That's not what you think about.

You write code so that you can work with it later. So you write it anyway you like and don't bother your mind with problems you don't encounter in reality.

Well you don't have any speed problems which you need to avoid with tricks and peculiarities of coding. Simply guaranteed, you don't.

When (which is unlikely) they will appear, then you'll optimize performance.

 
Maxim Kuznetsov:

The speed of execution is primarily affected by the algorithm. And how you represent it in code is not that important.

That's not what you're thinking about.

You write code so that you can work with it yourself later. So you write it anyway you like and don't bother your mind with problems you don't encounter in reality.

Well you don't have any speed problems which you need to avoid with tricks and peculiarities of coding. Just guaranteed, you don't.

When (which is unlikely to happen) you'll optimize your code.

Thank you very much! Very understandable.

 
Is it possible in the old mt4 program folders to work still on XP vindos there and installed, if so how.
 
Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
  • 2019.05.06
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 
Alexander Layzerevich:
Please help me with this question :https://www.mql5.com/ru/forum/160683/page833#comment_11585085

I doubt it will help you, but that's about it:

- You took some of the code from MT5 and are trying to "bolt" it to MT4, that's not how the indicators are called in MT4

- You have not declared the function header correctly

- MT4 does not have the built-in CopyBuffer() function

This will not work in general, look for other options to add some more code parts - syntax of MQL4 and MQL5 is 95% similar, but you can't recklessly copy code parts between platforms

 
Igor Makanu:

I doubt it will help you, but that's about it:

- You took some of the code from MT5 and are trying to "bolt" it to MT4, that's not how the indicators are called in MT4

- You have not declared the function header correctly

- MT4 does not have the built-in CopyBuffer() function

the syntax of MQL4 and MQL5 is 95% similar, but you can't recklessly copy code sections between platforms

Sorry, I forgot to specify the code for MT5

It just does not call the Deviation(int kanal) function.

I wanted to ask how to do it correctly ?

 
Igor Makanu:

perform one-to-one example from the articlehttps://www.mql5.com/ru/articles/18

As an option, you have compiled a project for 64-bit dll, MT4 terminal is 32-bit, you need to configure and compile the project for 32-bit .dll

I am asking questions there too, I tried the proposed examples there, in fact I have posted pictures with experiments. Well yes something is there with these versions, normally all this should be in the help, how to connect what nuances. I was given some links with codes, I opened these classes and closed them, in general mockery of information, no what you want and do. Well, excuse me, I will return to this topic after 20 years of programming experience. How do I know that the compilation for 64, how do I find out?

 
Seric29:

How do I know that the dll is compiled for 64?

Look at the project properties in Visual Studio, there should be an option for what platform to compile dll - MT4 needs 32-bit code

PS: google find the VS setting

 
Igor Makanu:

I doubt it will help you, but that's about it:

- You took some of the code from MT5 and are trying to "bolt" it to MT4, that's not how the indicators are called in MT4

- You have not declared the function header correctly

- MT4 does not have the built-in CopyBuffer() function

the syntax of MQL4 and MQL5 is 95% similar, but you cannot recklessly copy code sections between platforms

Do you have the following code fragments?

Forum on trading, automated trading systems and strategy testing.

Any MQL4 beginners questions, help and discussion on algorithms and codes

Alexander Layzerevich, 2019.05.06 17:21

I am trying to receive indicatordata in MT5 using this function:

//************************************************************************************************/
double Envelopes(string symb, ENUM_TIMEFRAMES TF_1, int period, int method, int shift, int price,double Deviation(ENUM_TIMEFRAMES TF_2, int kanal), int buff, int index)
{
  double buf[1];
  int handle=iEnvelopes(Symbol(), TF_1, period, method, shift, price, Deviation(TF_2, kanal), buff);
   if(handle<0)
   {
    Print("Failed to create handle ATR, Error: ",GetLastError());
    return(WRONG_VALUE);
   } else
   {
    if(CopyBuffer(handle,0,index,1,buf)<0)
    {
     Print("Failed to copy data from the indicator ATR, Error: ",GetLastError());
     return(WRONG_VALUE);
    }
   }
   return(buf[0]);
}
//************************************************************************************************/

I receive error :


Please advise how to correct code for MT5

Highlighted is no different from a function declaration. It turns out that a function is declared in the input parameters of the function.
Reason: