Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1396

 
Artyom Trishkin #:

Hmmm...

At some point in time the function call is blocked by the subsystem. Maybe you shouldn't wait, but just quit until the next login?

The service only logs in when the terminal is started, or when the service itself is started. Consequently, if you exit, the next call will be at restart of one of the two... but both are done manually...

 
Alexey Viktorov #:

The service only logs in when the terminal is started, or when the service itself is started. Consequently, if you exit, the next login will be when you restart one of the two... but both are done manually...

Got it. I.e. is the service running in a loop? Or in a timer?

 
Artyom Trishkin #:

Got it. I mean, does the service work in a loop? Or in a timer?

The service works like a script. The only difference is that the service starts with the start of MT, while the script, you know... Accordingly, if something doesn't work, it won't work until MT is restarted. It turns out that it is desirable to pause and repeat... I think so.

 
Alexey Viktorov #:

The service works like a script. The only difference is that the service starts when the MT starts, while the script, you know... So, if something doesn't work, it won't work until the MT is restarted. It turns out that it is desirable to pause and repeat ... I think so.

You didn't understand my question. Or maybe I'm not making myself clear ¯\_(ツ)_/¯

 
Artyom Trishkin #:

You didn't understand my question. Or maybe I'm not making myself clear ¯\_(ツ)_/¯

One of the two. But the service does not work in the loop and does not work in the timer.

 
Alexey Viktorov #:

One of the two. But the service doesn't work in a loop and doesn't work in a timer.

Are you saying that it only triggers once when you start the terminal? No. How then?

 
Artyom Trishkin #:

Are you saying that it only triggers once when you start the terminal? No. How then?

Until I figured it out or they made it possible to disable showing of trading history on a chart, I have been using this service

//+------------------------------------------------------------------+
//| Service program start function                                   |
//+------------------------------------------------------------------+
void OnStart()
 {
  long currChart = ChartNext(0);
  while(currChart >= 0)
   {
    ObjectsDeleteAll(currChart, "autotrade");
    currChart = ChartNext(currChart);
   }
 }
//+------------------------------------------------------------------+

I dare say it works successfully. I'm too lazy to search for it. It's much easier to repeat it.

This service

//+------------------------------------------------------------------+
//| Service program start function                                   |
//+------------------------------------------------------------------+
void OnStart()
 {
  Print("Запуск произведён успешно");
 }
//+------------------------------------------------------------------+

It prints once at terminal startup. So it is easy to check.

 
Alexey Viktorov #:

Until I figured it out or they made it possible to disable the display of trading history on the chart, I used the following service

I dare say it works successfully. I'm too lazy to find where I wrote about it before. It's much easier to repeat it.

This service

It prints once when you start the terminal. So it's easy to check.

Are you saying that service prints ONLY once on terminal start? Like a script? Only the script is run manually or programmatically, and the service is run on terminal startup. Is it like that? And, are you saying that the service no longer works? That is, it is triggered only ONE time?

 
JRandomTrader #:

For example, like this.

Macros are global.

can you explain where you need to write them?

in the class or in the advisor

 
Artyom Trishkin #:

Are you saying that the service is executed ONLY once when you start the terminal? Like the script? Only the script is run manually or programmatically, and the service is run when the terminal is booted. Is it like that? And, are you saying that the service no longer works? That is, it works only ONE time?

Artem, well why to me to prove something to you? Write one line and check.

Reason: