EA that logs in and sends orders

Specifiche

I've been studying the possibility of developing an EA that connects to other mt5 accounts and "sends" orders from the master account using the login details of the slave accounts, I wrote the code below but I can't compile it and I don't know if it makes sense.


I'm looking for someone to adjust this code and compile this EA


//+------------------------------------------------------------------+
//| Global variables declaration                                      |
//+------------------------------------------------------------------+
input string otherAccountLogin = "";    // Login of the other account
input string otherAccountPassword = ""; // Password of the other account
input string otherAccountServer = "";   // Server of the other account
int otherAccount = 0;                   // Account number of the other account

//+------------------------------------------------------------------+
//| Expert Advisor initialization function                           |
//+------------------------------------------------------------------+
int OnInit()
{
   // Connect to the other account using the provided login, password and server
   otherAccount = AccountOpen(otherAccountLogin, otherAccountPassword, otherAccountServer);
   if(otherAccount == 0)
   {
      Print("Failed to connect to the other account");
      return INIT_FAILED;
   }

   return INIT_SUCCEEDED;
}

//+------------------------------------------------------------------+
//| Expert Advisor tick function                                     |
//+------------------------------------------------------------------+
void OnTick()
{
   // Get the latest trade from the current account
   MqlTradeRequest request;
   MqlTradeResult result;
   if(!AccountTradeLast(request, result))
   {
      Print("Failed to get the latest trade from the current account");
      return;
   }

   // Execute the trade in the other account
   if(!OrderSend(otherAccount, request, result))
   {
      Print("Failed to execute the trade in the other account");
      return;
   }

   Print("Trade replicated in the other account: ", request.symbol, " ", request.action, " ", request.volume);
}


Con risposta

1
Sviluppatore 1
Valutazioni
(186)
Progetti
205
26%
Arbitraggio
12
25% / 58%
In ritardo
39
19%
Gratuito
2
Sviluppatore 2
Valutazioni
(12)
Progetti
16
0%
Arbitraggio
0
In ritardo
2
13%
Gratuito
3
Sviluppatore 3
Valutazioni
(6)
Progetti
8
0%
Arbitraggio
8
13% / 75%
In ritardo
0
In elaborazione
4
Sviluppatore 4
Valutazioni
(553)
Progetti
627
40%
Arbitraggio
2
100% / 0%
In ritardo
1
0%
Gratuito
Pubblicati: 9 codici
5
Sviluppatore 5
Valutazioni
(294)
Progetti
469
39%
Arbitraggio
100
41% / 23%
In ritardo
77
16%
Caricato
Pubblicati: 2 codici
6
Sviluppatore 6
Valutazioni
(11)
Progetti
17
59%
Arbitraggio
2
0% / 100%
In ritardo
2
12%
Gratuito

Informazioni sul progetto

Budget
30 - 500 USD
Scadenze
da 1 a 10 giorno(i)