EA that logs in and sends orders

Spécifications

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);
}


Répondu

1
Développeur 1
Évaluation
(186)
Projets
205
26%
Arbitrage
12
25% / 58%
En retard
39
19%
Gratuit
2
Développeur 2
Évaluation
(12)
Projets
16
0%
Arbitrage
0
En retard
2
13%
Gratuit
3
Développeur 3
Évaluation
(6)
Projets
8
0%
Arbitrage
8
13% / 88%
En retard
0
Gratuit
4
Développeur 4
Évaluation
(568)
Projets
642
40%
Arbitrage
2
100% / 0%
En retard
1
0%
Gratuit
Publié : 9 codes
5
Développeur 5
Évaluation
(295)
Projets
471
39%
Arbitrage
102
40% / 24%
En retard
78
17%
Occupé
Publié : 2 codes
6
Développeur 6
Évaluation
(11)
Projets
17
59%
Arbitrage
2
0% / 100%
En retard
2
12%
Gratuit
Commandes similaires
I need to modify the CURRENCY indicator to allow viewing the same currency on different timeframes simultaneously, overlaid on the same chart. Insert the same currency multiple times into the indicator. Example: USD D1 USD H4 USD H1 USD M30 USD M15 USD M5 Display all these curves on the same chart, each representing the currency's slope on a different timeframe. Customizable settings for each line, including: Color

Informations sur le projet

Budget
30 - 500 USD
Délais
de 1 à 10 jour(s)