Errors, bugs, questions - page 1525
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
MT4. Once again I would like to draw your attention to the peculiarities of the initialisation of global program variables.
Forum on trading, automated trading systems and strategy testing
Bugs, bugs, questions
Slawa, 2016.02.24 07:34
Queue. The application is only two hours old.
In general, such questions should be asked on the forum. Because many may be affected. I'll take the liberty of quoting you and immediately answering
This is planned behaviour. In fact, it is explicitly described in the documentation
Upload and download involve a complete reinitialization of everything.
In five, as you've rightly noticed, the situation is similar.
It's true, it was historically in four, and we changed this behavior at first when changing to new MQL4 (to have it behave like in experts, i.e. as you expect). But a lot of questions arose with the old indicators, that were based on this initialization. We were forced to return
In the five, this was the case immediately because of the architecture. When you change the parameters, the old indicator with the old parameters is destroyed and a new indicator with changed parameters is created.
Thanks. Conclusion - a quote from documentation: "... predefined function OnInit(), the purpose of which is correct initialization of all global and static variables of the program."
So zero or default all global variables or arrays toOnInit().
1. I create an array of the form:
CArrayString list[5];
2. I try to call method list via <Ctrl+Space>.
list[0].
The list of methods doesn't appear. Is it supposed to be like this?1. I create an array of the form:
2. I try to call the list of methods in the code via <Ctrl+Space>.
The list of methods does not appear. Is it supposed to be like this?Let me try to make a guess. If there are other errors in the code besides the fact that the method/member is not specified, the list will not always appear.
Tried it. No, wrong assumption. But a few repeated presses of the combination helped.
Alexey Kozitsyn:
But a few repeated presses of the combination helped.
Unfortunately your recipe doesn't work for me.
1. Simple code:
result: 50
2. Adding modifier input:
result: 4294967276
Expected a result of 50. Where am I wrong?
1. Simple code:
result: 50
2. We add a modifier input:
result: 4294967276
I was expecting a result of 50. Where am I wrong?
fmax compares two double numbers. So it goes like this:
and the result:
fmax compares two double numbers. So it goes like this:
In MQL, an implicit type conversion is declared and performed. In particular uint -> double.
The question is why it does not work correctly with input variables.
1. Simple code:
result: 50
2. Adding the input modifier:
result: 4294967276.
I was expecting a result of 50. Where am I wrong?
Please give me the full code.
There are 2 possibilities here and both are wrong.
1. The code is executed outside any functions.
2. input variable is declared inside the function