this code -- function

 

what is the function ? I don't know what it is to do ~~

for(int i=0;i<OrdersTotal();i++) 
{ 
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderComment()==Name_Expert) 
{ 
int type=OrderType();
switch(type)
{
case OP_BUY:
sB=1;
T++;
LastB=OrderOpenPrice();
break;
case OP_SELL:
sS=2;
B++;
LastS=OrderOpenPrice();

break;
}
} 
}
 

 

Update ~~~Now I know how to paste the code。

 
  1. OrderComment()==Name_Expert
    This is unreliable. Brokers are allowed to change the last N characters of comment. Use magic number instead.
  2. what is the function ? I don't know what it is to do ~~
    Simply finds the first open order by the EA and remembers if it is a buy or sell and the open price