How i can history trade information on MQL5

Rodrigo R. Mills
21
Rodrigo R. Mills  

Dear 

I have a MQL4 EA, now i am plan to convert MQL5. i did all coding. just i can't convert only below MQL4 coding

 for (int i = 0; i < OrdersHistoryTotal(); i++) {
      if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
      {
         if (OrderSymbol() == Symbol() && (OrderType() == OP_SELL || OrderType() == OP_BUY) && OrderMagicNumber() == MagicNumber && OrderCloseTime()!=0){
            if ( OrderOpenTime() >= date) {
               DailyProfit=DailyProfit+(OrderProfit()+OrderSwap()+OrderCommission());
               TotalDailyOrders++;
               if(OrderType()==OP_BUY)  DailyPips += NormalizeDouble(OrderClosePrice()-OrderOpenPrice(),_Digits);
               if(OrderType()==OP_SELL) DailyPips += NormalizeDouble(OrderOpenPrice()-OrderClosePrice(),_Digits);
            }     
         }   
      }
   }


what is the coding to get history trade in MQL5? please help me.....

Rodrigo R. Mills
21
Rodrigo R. Mills  
AcitiveJone:

Dear 

I have a MQL4 EA, now i am plan to convert MQL5. i did all coding. just i can't convert only below MQL4 coding


what is the coding to get history trade in MQL5? please help me.....



is Any one help me......

Vladimir Karputov
Moderator
219433
Vladimir Karputov  
Begin with it: HistorySelect
fxsaber
18931
fxsaber  
AcitiveJone:

I have a MQL4 EA, now i am plan to convert MQL5. i did all coding. just i can't convert only below MQL4 coding

what is the coding to get history trade in MQL5? please help me.....

MQL5-code:
https://www.mql5.com/en/code/16006
#include <MT4Orders.mqh> // Last version - https://www.mql5.com/ru/code/16006

 for (int i = 0; i < OrdersHistoryTotal(); i++) {
      if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
      {
         if (OrderSymbol() == Symbol() && (OrderType() == OP_SELL || OrderType() == OP_BUY) && OrderMagicNumber() == MagicNumber && OrderCloseTime()!=0){
            if ( OrderOpenTime() >= date) {
               DailyProfit=DailyProfit+(OrderProfit()+OrderSwap()+OrderCommission());
               TotalDailyOrders++;
               if(OrderType()==OP_BUY)  DailyPips += NormalizeDouble(OrderClosePrice()-OrderOpenPrice(),_Digits);
               if(OrderType()==OP_SELL) DailyPips += NormalizeDouble(OrderOpenPrice()-OrderClosePrice(),_Digits);
            }     
         }   
      }
   }

That's all !!!


More examples.

Alain Verleyen
40754
Alain Verleyen  
fxsaber:
MQL5-code:

That's all !!!


More examples.

Nice work. Congrats.