Services. Are they up and running yet? - page 24

 
Aliaksandr Hryshyn:
1. Background loading of news
2. heavy calculations in multiple threads(running copies of the service) so that they do not affect the trade.
3. Expert Advisor collects information from the cup, and the service periodically packs it into a zip archive.
4. Collection of all trading information when multiple Expert Advisors work, processing and saving it in the database or sending.
5. ...
What are your options?
1. If uploading to a file, then yes.

2. You can.

3. not sure. Does the service accept the events of the stack? If not, they need to be passed from the EA and it loses its meaning.

4. If each EA simply writes its reports in a file, and the service reads and analyzes them, then, yes.

I am still thinking about my own variants
 
Roman:

Expert/Script requires an open chart.
The number of graphs, is limited by the terminal.
Each rendering/updating of the graph, is a system message queue and an unnecessary resource load.

Agreed.
 
fxsaber:

2-3 can be implemented via a script on OBJ_CHART.

The service is started at the start of the terminal, the script cannot do that.
 
Aliaksandr Hryshyn:
The service starts when the terminal starts, the script can't do that.

This is not required in these two tasks.

 
Aliaksandr Hryshyn:
1. Background news loading
2. Heavy calculations in multiple threads(running copies of the service) so that they do not affect the trade.
3. Expert Advisor collects information from the cup, and the service periodically packs it into a zip archive.
4. Collection of all trading information when multiple Expert Advisors work, processing and saving it in the database or sending.
5. ...
What are your options?

For all of these tasks we will need to solve the problem of data exchange between a group of Expert Advisors and the service

the maximum I can suggest for the service is to listen to the socket on which the prices from another broker will go and forward it to the custom tick chart in order to arbitrage, and on the custom chart an Expert Advisor working by TS

 
Igor Makanu:

for all of the above tasks, the task of exchanging data between the advisory group and the service will have to be solved

Perhaps the shared memory for data exchange between programmes will now be provided by DBs rather than resources, which will greatly simplify implementation and interaction.
 
Sergey Lebedev:
The main problem of Services is not the Terminal Handle - it's all margin cases.

An automatic reconnector cannot be realised without a Handle. And it's a very necessary thing for real trading.

 
Option to implement multi-currency OnTick/OnBookEvent in scripts/services.
//#property service

#include <NewData.mqh> // https://c.mql5.com/3/354/NewData.mqh

// Script/Service main function.
void OnStart()
{
  const string Symbols[] = {"EURUSD", "GBPUSD"};
  
  NEWDATA<TICK> Ticks(Symbols);
  NEWDATA<BOOKS> Books(Symbols);

  while (!IsStopped())
  {
    Ticks.Refresh();
    Books.Refresh();
        
    Sleep(50);
  }
}

void OnTick( const string &Symb )
{
  MqlTick Tick;
  
  if (SymbolInfoTick(Symb, Tick))  
    Print(Symb + " - new tick: " + (string)Tick.time);
}

void OnBookEvent( const string &Symb )
{
  MqlBookInfo Books[];

  if (MarketBookGet(Symb, Books))  
    Print(Symb + " - new book: " + (string)ArraySize(Books) + " bands.");
}


Result.

2021.04.26 11:18:38.527 EURUSD - new tick: 2021.04.26 11:18:39
2021.04.26 11:18:38.527 EURUSD - new book: 14 bands.
2021.04.26 11:18:38.904 GBPUSD - new tick: 2021.04.26 11:18:39
2021.04.26 11:18:38.904 GBPUSD - new book: 16 bands.
2021.04.26 11:18:38.965 GBPUSD - new tick: 2021.04.26 11:18:39
2021.04.26 11:18:38.965 GBPUSD - new book: 16 bands.
2021.04.26 11:18:39.029 EURUSD - new tick: 2021.04.26 11:18:39
2021.04.26 11:18:39.029 EURUSD - new book: 14 bands.
2021.04.26 11:18:39.091 GBPUSD - new tick: 2021.04.26 11:18:39
2021.04.26 11:18:39.091 GBPUSD - new book: 15 bands.
2021.04.26 11:18:39.278 GBPUSD - new tick: 2021.04.26 11:18:40
2021.04.26 11:18:39.278 GBPUSD - new book: 16 bands.
2021.04.26 11:18:39.465 GBPUSD - new tick: 2021.04.26 11:18:40
2021.04.26 11:18:39.465 GBPUSD - new book: 16 bands.
2021.04.26 11:18:39.714 GBPUSD - new tick: 2021.04.26 11:18:40
2021.04.26 11:18:39.715 GBPUSD - new book: 16 bands.
2021.04.26 11:18:40.589 GBPUSD - new tick: 2021.04.26 11:18:41
2021.04.26 11:18:40.589 GBPUSD - new book: 16 bands.
Files:
NewData.mqh  2 kb
 
Hi. I wanted to use a service to create a universal message sender (mail, telegram with screenshots) from all EAs from all charts. The idea was that EAs would send custom events with chart, message text and other parameters and the service would listen to the events, take screenshots of the specified charts and send the required messages. However, I've read that services can't accept events from charts. So, the solution is to use global variables of the terminal? Suppose a global array of structures, in which graphs will add elements, and the service, as processing (sending messages), remove them. What do you think of such an idea? Perhaps there are other ideas? I'm new to MQL, I'm reading more than writing. This idea appeared in order to release the Expert Advisor thread from the message sending operation. Also, it could be applied to sending messages by indicators.
 
Реter Konow #:
you can send all events to the service from the EA via resources. And now, also through the database.
Is the advisor to write it to a file, and connect it as a resource variable in the service?