How to use Meta Trader as services?

 

Hi,

I want to use meta trader as services. I see services is available but I don't know is this what I'm looking for.

I have one demo account. From this demo account I want to get 24/7 informations for old trades or new trades and then I need to send on email everytime when are changed.

Robot for my problem is not possible because requested attach to the Graph.

Thanks for the answer.

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Account Properties - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Dejan Krapež :

Hi,

I want to use meta trader as services. I see services is available but I don't know is this what I'm looking for.

I have one demo account . From this demo account I want to get 24/7 informations for old trades or new trades and then I need to send on email everytime when are changed.

Robot for my problem is not possible because requested attach to the Graph.

Thanks for the answer.

Try a service like this:

//+------------------------------------------------------------------+
//|                                                History Deals.mq5 |
//|                              Copyright © 2021, Vladimir Karputov |
//+------------------------------------------------------------------+
#property service
#property copyright "Copyright © 2021, Vladimir Karputov"
#property version   "1.00"
//--- input parameters
input int      InpTimeFrequency  = 3;
//---
datetime m_last_time=0;
//+------------------------------------------------------------------+
//| Service program start function                                   |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   datetime time_trade_server=TimeTradeServer();
   if(time_trade_server-m_last_time>=InpTimeFrequency)
     {
      Print("last_time: ",m_last_time,", TimeTradeServer: ",time_trade_server);
      m_last_time=time_trade_server;
      //--- History Deals functions ***
      
     }
   OnStart();
  }
//+------------------------------------------------------------------+

You just have to fill in the functionality - referring to the trading history ...

Reason: