Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 551

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
All of this is quite feasible
Hi all, could you please tell me how to pause a function, not the entire EA, but only one function, for example an alert?
How is that? So far, only a rather comical situation appears: the man goes on, but let him leave his head in this place for a while. Then we will bring it back.
Probably something else is meant.
Hi all ! Could you please tell me how to pause a function, not the whole EA, but just one function, e.g. alerts ?
You can do everything with a program that can be described with words, in your question, you have described what you have to do.
This is how it is done: you describe the global (well, almost at the top of the program) variable in the program: bool pauza=false;
When it's false - function works, true - function is paused.
Now the function must react to pauza.
To do this, either add if(pauza)return; at the beginning of the function, or something similar at the place of function call.
It remains in the main function to check the condition and manage the function through the variable pauza.
If you need to control from outside the program (from another script, Expert Advisor, indicator), then use the global variable of the terminal
How is that? So far, only a rather comical situation appears: the man goes on, but let him leave his head in this place for a while. Then we will bring it back.
I guess that's not what you mean.
I have an alert triggered at a certain price level, there are many instruments, and the price will not immediately move away from the alert triggering level, of course it will chop and chop further. You can disable the alert using a flag, but since there are a lot of instruments, it is easy to forget to enable the alert, so I need to disable it temporarily and enable it (or rather its function) after a specified period of time.
For this case, you can set an Alert triggering period. Let's say in seconds:
I need to take data from the last closed trade, more precisely, I need lot value, how can I register this in Mt4
I looked everywhere, there is one for Mt5, but not for Mt4
I need to take data from the last closed trade, more precisely, I need lot value, how can I register this in Mt4
I looked everywhere, there is one for Mt5, but not for Mt4
Actually it should be the other way around)
For this case, you can set an Alert triggering period. Let's say in seconds: