Features of the mql5 language, subtleties and tricks - page 182

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
For example, I delete all objects on my VDS. I just don't want to overload the schedule. And there's no need for them there. I use globals. So it all depends on the situation.
Look, I don't like them for a reason:
Look, there's a reason I don't like them:
Well, there's no need to read it. You can use GlobalVariableCheck to check if the variable is there or not. You can do the same with objects.
So you only need to create/check/delete a variable.
Vladimir Simakov:
2. Availability of variables outside the program.
no problem, all functions that work with global variables have a return value - the result of the operation
there is a synchronization toolhttps://www.mql5.com/ru/docs/globals/globalvariablesetoncondition , it's not much, but use what you are offered
But the big inconvenience is the data type - only double , I do not like double , even if only ulong could be used, and the organization of name / value ---> string / double causes a desire to swap - to write data in string and key in double - more for one operation can be written / read
but having estimated all this "stuff" You may write them into binary files, i.e. total freedom and no uncertainties.
one probably needs to know how to work with them
@fxsaber showed examples of working with any typeshttps://www.mql5.com/ru/forum/320395/page6#comment_12910394
Well, there's no need to read. You can simply use GlobalVariableCheck to check if the variable exists or not. You do the same with objects.
So, you only need to create/check/delete a variable.
Yes, a trivial naming conflict and the string in the other robot
GlobalVariableDel(yourValueName);
will lose your deposit))))
Say that the name will be unique, that the other robot will never be there, that the child/wife/friend/drunkard will never come near the battle terminal))) Agreed, but the probability is not zero, which means the code becomes unreliable.
Yes, it's a trivial naming conflict and the other robot's line
will drain you of your deposit)))
You will say that the name will be unique, that the other robot will never be there, that the child/wife/friend/drunk himself will never come near the battle terminal))) Agreed, but the probability is not zero, which means the code becomes unreliable.
Bullshit and fantasy
An EA on money ALWAYS runs from a separate terminal, on its own VDS (or even server) and no one ever messes with it.
Bullshit and fantasy
An EA on the money ALWAYS runs from a separate terminal, on its own VDS (or even server) and no one ever messes with it.
What do you mean ALWAYS? Today - always, tomorrow you may calculate differently. And not everyone seems to agree with you.
I pointed out the real danger of using global variables of the terminal. This is neither good nor bad - it's a given that developers gave us, we just need to be aware of it and take it into account.
The same string
GlobalVariablesDeleteAll();
...made in any script and oops...
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5, tips and tricks
Vladimir Simakov, 2020.05.24 17:02
The same string
GlobalVariablesDeleteAll();
...made in any script and oops.
The same is with the graphical objects.
ObjectsDeleteAll(...
Only the EA resources cannot be changed by other programs.
Colleagues, please help me make a macro, if at all possible.
I need to dynamically declare a two-dimensional array. And the second dimension must also be changed. This is something like this loop:
Of course, the compiler will balk at this:
I would like to see a macro like the following:
Instead of a line:
double d_array[][would_be_size2];
Thank you.
Colleagues, please help me make a macro, if at all possible.
I need to dynamically declare a two-dimensional array. And the second dimension must also be changed. This is something like this loop:
Of course, the compiler will balk at this:
I would like to see a macro like the following:
Instead of a line:
Thank you.
But creating an array of sufficient (maximum) size outside the loop is hindered by politics ? :-)
The above approach (recreating the array in the loop every time) does not win anything in terms of speed or memory consumption.
I would like to see a macro similar to this:
It won't work.