Download MetaTrader 5
To add comments, please log in or register
Deposit to your account via WebMoney
TUNISIAFX 2016.02.05 20:47 

how we can verfied if the last trade is win or a loose trade ?

what is the functions and commands that we must use or a little exemple of script?

Thank you very much,  seriously i need your help to finish my strategy

Osama Shaban
Osama Shaban 2016.02.05 22:27  

Hi ...

I did this function in some of my codes ... It returns Last  order type, Last order Lots and Last order Profit ...

So, just check in your main code if last order profit >=0 ... It works charm :) 

void LastClosedTrade(){ 
   int cnt, total; 
   total = OrdersHistoryTotal(); 
   for(cnt=0;cnt<total; cnt++){ 
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC && OrderProfit()!=0){
         LastOrderType = OrderType(); 
         LastOrderLots = OrderLots(); 
         LastOrderProfit = OrderProfit(); 
To add comments, please log in or register