[MQL4 CODE] How to calculate the last long and short order lot size?

/**
 * How to calculate the last long and short order lot size?
 */
double LastBuyLots; 
double LastSellLots; 
int MagicNumber=1111;
void Calculate_Last_Order_Lot_Size()
{
   for(int cnt=OrdersTotal()-1;cnt>=0;cnt--){ 
      OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); 
      if(OrderSymbol()!=Symbol()||OrderMagicNumber()!=MagicNumber)continue; 
      if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber) 
      if(OrderType()==OP_BUY) 
      { 
         LastBuyLots=OrderLots(); 
         break; 
      } 
      if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber) 
      if(OrderType()==OP_SELL) 
      { 
      LastSellLots=OrderLots(); 
      break; 
      } 
   }
}
#property copyright "Copyright 2021, www.comefx.com"
#property link      "https://www.comefx.com"
#property version   "1.00"
#property strict

Leave a comment

All comments are moderated before being published

Best Sellers

ADVANCED ARTIFICIAL INTELLIGENCE FOREX TRADING ROBOT FOR YOU

Comefx