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

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
We are extending the initializing sequences "{ ... }", in the next build any expression will be allowed, not just a constant.
Instead of this change, there will be a restriction on using constants for enumerations (as for a normal expression): if a constant is not part of an enum, an appropriate error will be generated.
Analysis of existing codes has shown that the single zero sequence "{0}" is often used incorrectly.
For example, like this:
Such a notation means to set the value of zero for the first field of the structure and zero out the rest of the fields.
For the above code line, according to the new rules, there will be an error since the first field has the type ENUM_TRADE_REQUEST_ACTIONS, an enumeration that lacks the value "0".
The correct way would be:
MqlTradeRequest request={};
This is correct:
MqlTradeRequest request={};
And then what would request.action be equal to?
And then what would request.action be equal to?
Zero, of course, as if ZeroMemory is called for the object of this structure
How do I keep track of time series and indicators based on them?
Forum on trading, automated trading systems and trading strategy testing
Bugs, bugs, questions
Slava, 2021.05.29 18:16
I want to remind you.
1. For each symbol, for which at least one chart is open, a separate thread is working for processing the incoming ticks. Several charts may be open for some symbol, but there will still be only one thread.
2. The symbol thread handles timeseries, not charts. That is, the very same data arrays, which are submitted to the CopyRates request.
3. it is useless to ask your symbol in OnTick or OnCalculate, if it is synchronized. Of course it is!
4. All timeseries are handled in order, from lowest to highest. First we apply the tick, then the calculation of all indicators, created at this time series. If you ask data for the same H1 symbol from the indicator, working on M1, you will never get data with the applied tick. The data will always be one tick back, no matter what tricks you apply. Because one thread per symbol with consecutive timeframe processing.
5. The previous statement does not apply to EAs and scripts, because EAs and scripts each work in their own separate threads.
How do I keep track of time series and indicators based on them?
Forum on trading, automated trading systems and trading strategy testing
Bugs, bugs, questions
Slava, 2021.06.01 06:34
When you first request, the indicator may not receive data from its symbol but another timeframe only for one reason - the required timeseries has not yet been built or has already been destroyed after some time, when there were no requests.
After an unsuccessful request, just send a command to your chart to update it and terminate OnCalculate immediately. It is guaranteed that OnCalculate will be called and the timeseries will be ready by this time
Forum on trading, automated trading systems and trading strategies testing
Features of mql5 language, subtleties and tricks
fxsaber, 2017.11.30 09:48
Memo
The point is different - could it be an oversight rather than a deliberate change in behaviour? Did you find out?
The point is different - could it be an oversight rather than a deliberate change in behaviour? Did you recognise it?
I didn't. The feedback is almost non-existent. However, here's a feature I just found out about.
This Expert Advisor alerts when switching between accounts. It would seem that it should not do so according to the rule.
Forum on trading, automated trading systems and strategy testing
Features of mql5 language, subtleties and tricks
fxsaber, 2017.11.30 09:48
Memo
This advisor alerts when switching between accounts. It would seem that it should not do this, according to the rule
No one has guaranteed that other event handlers will be interrupted (or not run).
After the alert, both deinit and init happen, right?