Read historical orders in MT5

MQL5 Convertir

Tâche terminée

Temps d'exécution 2 heures
Commentaires du client
good work as always :)

Spécifications

hi,


i need this function migrated MT5:


string getLastHistTradeString(){


   bool seperator = false;

   int acc = AccountNumber();

   string broker = AccountCompany();

   double balance = AccountBalance();

   

   

   string histTrades = "";

   for(int i=0 ; i <OrdersHistoryTotal() ; i++)

      {  

      

         OrderSelect(i, SELECT_BY_POS,MODE_HISTORY);

      

         if(OrderOpenTime() > lastDeliveredHistTrade)

         {

            

            

            int orderNumber = OrderTicket();

            datetime openTime = OrderOpenTime();

            int orderType = OrderType();

            double lots = OrderLots();

            string symbol = OrderSymbol();

            double openPrice = OrderOpenPrice();

            double sl = OrderStopLoss();

            double tp = OrderTakeProfit();

            datetime closeTime = OrderCloseTime();

            double closePrice = OrderClosePrice();

            double commision = OrderCommission();

            double swap = OrderSwap();

            double profit = OrderProfit();

            double equity = AccountEquity();

            double accountBalane = AccountBalance();

            

            string jsonString = "{\"accountNumber\": " + acc + ", "+

                                 "\"broker\": \"" + broker + "\", "+

                                 "\"orderNumber\": " + orderNumber + ", "+

                                 "\"orderOpenTime\": \"" + openTime + "\", "+

                                 "\"orderType\": " + orderType + ", "+

                                 "\"orderLots\": " + lots + ", "+

                                 "\"orderSymbol\": \"" + symbol + "\", "+

                                 "\"orderOpenPrice\": " + openPrice + ", "+

                                 "\"orderStopLoss\": " + sl + ", "+

                                 "\"orderTakeProfit\": " + tp + ", "+

                                 "\"orderCloseTime\": \"" + closeTime + "\", "+

                                 "\"orderClosePrice\": " + closePrice + ", "+

                                 "\"orderCommission\": " + commision + ", "+

                                 "\"orderSwap\": " + swap + ", "+

                                 "\"orderProfit\": " + profit + ", "+

                                 "\"accountBalance\": " + accountBalane + ", "+

                                 "\"accountEquity\": " + equity +

                                 "}";

           if(seperator){

            histTrades += ",";

           }

           

           histTrades += jsonString;

           seperator = true;

         }        

       }

       

       string finalString = "["+histTrades+"]";

       

       printf(finalString);

       

       return finalString;

   


}


it should read all historic trades and put it into a json string


you will give me the source code for it


thanks

Répondu

1
Développeur 1
Évaluation
(361)
Projets
630
72%
Arbitrage
14
43% / 7%
En retard
28
4%
Gratuit
Publié : 9 codes
2
Développeur 2
Évaluation
(5)
Projets
5
0%
Arbitrage
5
0% / 60%
En retard
2
40%
Gratuit
3
Développeur 3
Évaluation
Projets
0
0%
Arbitrage
1
0% / 0%
En retard
0
Gratuit
4
Développeur 4
Évaluation
(28)
Projets
36
17%
Arbitrage
5
20% / 40%
En retard
17
47%
Gratuit
Publié : 5 codes
5
Développeur 5
Évaluation
(64)
Projets
144
46%
Arbitrage
21
38% / 24%
En retard
32
22%
Travail
6
Développeur 6
Évaluation
(229)
Projets
339
49%
Arbitrage
21
5% / 33%
En retard
24
7%
Gratuit
7
Développeur 7
Évaluation
(32)
Projets
41
68%
Arbitrage
5
0% / 60%
En retard
14
34%
Gratuit
Publié : 1 code

Informations sur le projet

Budget
30+ USD
Délais
de 1 à 2 jour(s)