Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 625
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
experiment with such code, read the message in EA log (switch TF, enter variable, reload terminal without closing EA...)
and the second variant is to describe at global scope a variable with static modifier
Firstly, this is mql4.
Secondly, I need to run OnInit() at any change of variables of Expert Advisor.
That's all I ask for help!
Yes, rebooting the terminal and changing the text helps, but when you change variables, OnInit() does not work and that's why I get all the problems!!!!
Firstly, it's mql4. Secondly, I need to run OnInit() to change EA's variables.
Secondly, I need it to run OnInit() when Expert Advisor variables are changed.
That's all I ask for help!
Restarting the terminal and changing the text helps, but when you change the variables, OnInit() does not work and that's why I get all the problems!!!!
I have the following solution. OnInit() copies the variables at the 1st run of the EA. On Calc...() or whatever in MT4, it checks if the variables are identical to their copies. If the variables do not coincide, then we forcefully run OnInit() and if necessary, we will run something else before that to update the EA. And finally, return.
Firstly, it's mql4. Secondly, I need to run OnInit() to change EA's variables.
Secondly, I need it to run OnInit() when Expert Advisor variables are changed.
That's all I ask for help!
Yes, rebooting the terminal and changing the safeties helps, but when you change variables, OnInit() does not work and that's why I get all the problems!!!!
Have you looked at the code I gave you? It was MT4 and everything works as you asked
read the documentationhttps://docs.mql4.com/ru/runtime/event_fire
I have run the code I suggested, changed the external variable var twice, here is the Expert Advisor log:
Here's the code where the "bugs are".
You can call any function from anywhere in an MQL program. The function of initializing an Expert Advisor is a function, and you can force-call OnInit(), but usually you don't need it.
there are a lot of errors in the code, in
it is better to normalize prices, then they will work, then the server will give out an error of "wrong prices", it is desirable to normalizeStopLoss_SELL
and most likely, you need to check if the StopLoss is equal to zero, and it is not desirable to compare real numbers to be equal, you should try to compare real numbers to > or <
If there are a lot of errors, would you mind pointing them all out?
did you look at the code I gave you? it was MT4 and everything works as you ask
then read the documentationhttps://docs.mql4.com/ru/runtime/event_fire
I have run the code I suggested, changed the external variable var twice, here is the Expert Advisor log:
Here's the code where the "bugs are".
You can call any function from anywhere in MQL-program, the function of initializing an Expert Advisor is also a function. You can force-call OnInit(), but usually you don't need it - the terminal callsOnInit() by itself.
Thanks a lot thanks to your code of errors I found !!!!!!!!! GOOD LUCK !!!! AND THANKS FOR THE HELP !!!!!!
Please advise. How can I make the standard MA indicator be displayed not for the whole history, but for a specified number of candles? Thank you.
How do I manually set quotes totest an EA?
There must be a solution, but I couldn't find it
What's wrong with F12 after a pause?
I meant specifically to set the price movement
How do I manually set quotes totest an EA?
Surely there is a solution, but I could not find it
Write your own ticks and put them in the strategy tester.