Read historical orders in MT5

MQL5 Dönüştürme

İş tamamlandı

Tamamlanma süresi: 2 saat
Müşteri tarafından geri bildirim
good work as always :)

Şartname

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

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(361)
Projeler
630
72%
Arabuluculuk
14
43% / 7%
Süresi dolmuş
28
4%
Serbest
Yayınlandı: 9 kod
2
Geliştirici 2
Derecelendirme
(5)
Projeler
5
0%
Arabuluculuk
5
0% / 60%
Süresi dolmuş
2
40%
Serbest
3
Geliştirici 3
Derecelendirme
Projeler
0
0%
Arabuluculuk
1
0% / 0%
Süresi dolmuş
0
Serbest
4
Geliştirici 4
Derecelendirme
(28)
Projeler
36
17%
Arabuluculuk
5
20% / 40%
Süresi dolmuş
17
47%
Serbest
Yayınlandı: 5 kod
5
Geliştirici 5
Derecelendirme
(64)
Projeler
144
46%
Arabuluculuk
21
38% / 24%
Süresi dolmuş
32
22%
Çalışıyor
6
Geliştirici 6
Derecelendirme
(229)
Projeler
339
49%
Arabuluculuk
21
5% / 33%
Süresi dolmuş
24
7%
Serbest
7
Geliştirici 7
Derecelendirme
(32)
Projeler
41
68%
Arabuluculuk
5
0% / 60%
Süresi dolmuş
14
34%
Serbest
Yayınlandı: 1 kod

Proje bilgisi

Bütçe
30+ USD
Son teslim tarihi
from 1 to 2 gün