Features of the mql5 language, subtleties and tricks - page 229
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 to fill an array with one line?
One more lifehack for access rights: If you have an irresistible desire to give access to private fields/functions of one class to another class, you can do the following using standard MQL tools:
We need to: make access to A::f1() from B
Let's rewrite it like this:
To call (A)a.f1() inside B, call CallAf1(a). If f1() has parameters, we add them to CallAf1().
Test:
You can make CallAf1() protected, but it will be a big hole in access rights - anywhere in the code you can create a descendant of class B and in it a public method to call CallAf1() - i.e. everyone will have access to A::f1().
P.S. The construct is very cumbersome (if you want, you can cram it into macros), but it has one advantage over friend C++: it gives access not to all class members, but only to selected ones.
One more lifehack for access rights: If you have an irresistible desire to grant access to private fields/functions of one class to another class, you can do this using standard MQL tools
Took a long time to get into it... good move with virtualisation, thanks!
REASON_ACCOUNT (even if the account is not changed, but just re-login is done) the Expert Advisor is completely unloaded and a new copy is loaded.
For this reason ExpertRemove in OnDeinit does not affect the new copy, because it touches the unloaded one.
Result after relogin.
After Deinit, the new EA copy waits for more than a second (up to two seconds) to start. What are the reasons for such a long wait and is it possible to speed it up?
SymbolInfoTick will return the latest tick on each of these three calls. That is, the so-called collection of ticks without skipping through indicators is questionable, to put it mildly.
Proof of the impossibility of collecting ticks by an indicator (without skips).
Result.
Forum on Trading, Automated Trading Systems and Testing Trading Strategies
Errors, bugs, questions
fxsaber, 2023.02.14 13:11
Unfortunately, MQL4 does not pull this kind of work yet.
begDayBar= iBarShift(_Symbol,_Period,begDayTime,false) according to the documentation the function returns -1 or the nearest bar offset depending on the exact parameter.
but today for some reason if begDayTime=2023.01.26 00:00:00 it returns -1 although there are such bars and they are not the last ones.
2023.02.15 15:19:23.254 !indDAY_WSOWROhLine (EURRUB_TOM,M15) begDayTime=2023.01.26 00:00:00 endDayTime=2023.01.27 00:00:00 begDayBar=-2 endDayBar=-1 indATR=0 Q5days=0
it may return -1 or it may return the correct bar.