Features of the mql5 language, subtleties and tricks - page 238
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
I never imagined that I would use a machine-generated piece of code in the source code. Especially in a place of archival importance for performance.
Below is the generated code.
A much more concise script was written for generation. This may be useful to quickly test hypotheses and avoid human error.
Be careful, the same ChatGPT makes a lot of mistakes, both in syntax and logic, so you have to double-check everything.
But it is a really good giver, it helps you to express ideas in code.
Below is the generated code.
A much more concise script was written for generation. This may be useful to quickly test hypotheses and avoid human error.
There is not enough background information: did the new code get faster than the old code or not?
If not, why change the old understandable code for the new incomprehensible one?
If yes, why couldn't the MQL compiler generate the code optimal in terms of performance at once, while it has much more possibilities for this than chat
Be careful, the same ChatGPT makes a lot of mistakes, both in syntax and logic, so you have to double-check everything.
But it is a really good pitchman, it helps to express ideas in code.
Generating script.
Not enough background information: did the new code get faster than the old code or not?
The new code is faster.
If yes, then why the MQL compiler could not generate the code optimal in terms of performance at once, while it has much more possibilities for this than chat
This is algorithmic optimisation, not compiler optimisation.
The new one is faster.
This is algorithmic optimisation, not compiler optimisation.
How much faster? By 1.5% or 1.5 times? And as if it's faster? Or based on correct measurements?
So you didn't give it a code, but an algorithm?
Forum on trading, automated trading systems and testing trading strategies
Compilation of MQL5 programmes with AVX / AVX2 + FMA3 / AVX512 + FMA3 instruction set from build 3902
fxsaber, 2023.10.19 21:17
b4029. It's like scripts have become 20-50% faster to read.How much faster? By 1.5 per cent or 1.5 times? And by feel or by specific measurements?
So you didn't give it a code, but an algorithm?
That's what the Virtual source code uses. You have to make four checks on each tick.
But in some situations (switch 0-15) you can do with fewer checks: 0-4. It depends on the TS.
For example, if the TS opens/closes positions only with market orders and does not use SL/TP, then you do not need to make a single check.
But if all types of orders are used simultaneously, you need to make all four checks: there will be no acceleration.
That's why you should take a specific TS and look at the results of measurements for it. Different TS have different acceleration results.
It was possible to classify cases (number of cases) into more variants. I couldn't do it, frankly speaking.
In MQL5, there is a StringReserve function, using which we can theoretically reduce the number of memory reallocations for our string: we allocated a large enough buffer at once and then work in it.
But, as practice shows, any subsequent assignment of a value to this string changes the size of its buffer (i.e., apparently, memory reallocation occurs).
As a result, instead of
it makes sense to use
it makes sense to use
Exactly. This mechanism works great on string completion. For example, when generating large HTML reports.
How can I find out if a symbol has data, so that I don't leave it in the [Market Watch] window if it doesn't?
I use such a check in a loop:
But after that I cannot manually remove symbols from the [Market Watch] window either one by one or all at once, while the Expert Advisor is on the chart:
How can I find out if a symbol has data, so that I don't leave it in the [Market Watch] window if it doesn't?
SymbolInfoTick.