You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How about declaring a variable of enum type?
implicit enum conversion tst1.mq5 24 17
you can also check EnumToString()...
I think the type without declared variables was just thrown out of the compilation as not used
I mean, you can accidentally declare a variable with the same name as in the enum already in use and then have a very long and painful time searching for where and where I shot myself in the knee
So what is the verdict, gentlemen? If I write an .mq5 program with .mqh (#include), I can safely write extern and not be afraid of unexpected consequences (as I did in mql4), or using input ?
In MT5 use input to declare external variables. Extern in MT5 has a different purpose.
In MT5 use input to declare external variables. Extern in MT5 has a different purpose.
Why cannot you use extern in MT5? - I compiled my example in MT5, I do not see a fundamental difference
Why can't extern be used in MT5? - I compiled my example in MT5, I don't see any fundamental difference
Because people out of habit from the old MQL4 are trying to use extern for input parameters.
And in the new MQL4 and MQL5, input is used together with #property strict, and extern is used for other purposes.
That's why it was said not to use extern.
Because people out of habit from ancient MQL4 try to use extern for input parameters.
And in new MQL4 and MQL5, input is used together with #property strict, and extern is used for other purposes.
That's why I told you not to use extern.
So everyone is trying to write a lot of bukuffs and the result is that they should NOT use ONLY in MQL5 and should NOT use anywhere else))))
ok, here comes the big argument, imho - if you see extern in an old code, replace it with input and fix all the warnings, and may the power of MQL be with you !!!!
You see, everyone tries to write a lot of bukuffs and end up with NOT using ONLY in MT5 or NOT using anywhere at all ))))
Ok, here comes the big argument, imho - if you see extern in an old code, replace it with input and correct all warnings, and may the power of MQL be with you !!!!
I don't understand much of what's written here.
But I meant not to use extern in MQL5 and MQL4 with #property strict to declare external parameters of programs, but to use for the purpose described (vaguely) in the help.
I've been thinking, just a thought... In MQL5, isn't working with iCustom() much more problematic than in MQL4 (or generally with indicator calls in MQL4)? Is it so? If yes, then I will continue.
I've just started to learn MQL5 a little...
I will probably start a new topic.I'm just thinking... In MQL5 it's much more difficult to work with iCustom() than in MQL4 (or generally with indicators calling in MQL4), isn't it? Is it so? If so, I will continue.
not more problematic, it's just that in MQL5 you have to work with iCustom() in two steps:
1. get the indicator handle
2. request the values of indicator buffers through CopyBuffer()
in MQL4 - iCustom() works as a function call with parameters - you call it, receive it
in MQL5 it works the same way - the developers purposely reduced the functionality of built-in functions and made access to timeseries inconvenient - they just recently added iClose(), iHigh() to MQL5, before they needed to copy the data into an array as with CopyBuffer()
in general, MT5 has more writing than MT4
not more problematic, it's just that in MQL5 you have to work with iCustom() in two steps:
1. get the indicator handle
2. request the values of indicator buffers through CopyBuffer()
in MQL4 - iCustom() works as a function call with parameters - you call it, receive it
in MQL5 it works the same way - the developers purposely reduced the functionality of built-in functions and made access to timeseries inconvenient - they just recently added iClose(), iHigh() to MQL5, before they needed to copy the data into an array as with CopyBuffer()
in general, MT5 has more writing than MT4
https://www.mql5.com/ru/forum/316800
Unfortunately, the implementation of extern variables in MQL5 is not finalized, and that's why I don't recommend using it - it might cause problems. I mean the lack of control over the mandatoryone-time initialization of these variables.
For example, you may write it in such a way:
and there will be no error. Imagine that these initializations are performed in different plugins. Then the final result will depend on the order in which these files are included.
Or we can write it like this (executable file):
here we haven't initialized the extern-variable at all, but there's no error either.
Accordingly, there's no control over whether or not the same variables are defined in other files. You can accidentally change its name, but the program will compile as if nothing had happened, although in other files we have a variable with a different name.
All in all, it does not fit anywhere. That's why it's better to use functions instead of extern-variables. They are guaranteed to have only one definition, no more and no less.