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

 
2002569:Hello, can you tell me if it is possible to connect a copying signal and a robot to an account in mt4 and connect the whole thing to the vps?

All of this is quite feasible

 
Hi all, could you please tell me how to pause a function, not the whole EA, but just one function, for example an alert?
 
VasiliKolchanov:
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.

 
VasiliKolchanov:
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

 
Ihor Herasko:

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.


 
VasiliKolchanov:
I triggered the alert at a certain price level, there are a lot of instruments and the price will not immediately move away from the level of alert action, of course it will keep on chasing and chasing. You can disable the alert using the flag, but since there are many instruments, it is easy to forget to enable the alert, so for this I need to disable it temporarily and enable it (or rather its function) again after a specified time period.
 
VasiliKolchanov:
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:

input uint  i_uAlertPeriod  = 120;                      // Период отображения Alert, сек.

...

void DoAlert(string sText)
{
   static datetime dtLastTime = 0;
   if (TimeCurrent() - dtLastTime < i_uAlertPeriod)
      return;

   dtLastTime = TimeCurrent();
   Alert(sText);
}
 
MT4 History Analysis (Closed Trades)
Help me to deal with the history of trades in 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

 
Sergey Nikolenko:
MT4 History Analysis (Closed Trades)
Help me to deal with the history of trades in 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)

Только "Полезные функции от KimIV".
Только "Полезные функции от KimIV".
  • 2011.02.18
  • www.mql5.com
Все функции взяты из этой ветки - http://forum.mql4...
 
Ihor Herasko:

For this case, you can set an Alert triggering period. Let's say in seconds:

Ihor thanks for the answer, just one question, won't it be a delay of action, i.e. during the pause the alerts will accumulate with each tick, and when the time expires the EA will still give them to me (all accumulated) ? It may sound ridiculous, but sorry newbie - I'm learning.
Reason: