the reason is that I really didn’t know how to do that and how much this is important, just like my poor coding. I try my best to do it and learn it quickly.
//+------------------------------------------------------------------+
//|B1 profit calculator Function |
//+------------------------------------------------------------------+
double B1profit(void){
CPositionInfo pi;
CTrade trade;
double B1Prf=0;
int i,j;
for(i=0;i<CROSS_NUMBER;i++) {
for(j=0;j<MAX_LEVEL;j++){
if(pi.SelectByTicket(baseTickets[i][j])&&pi.Comment()=="B1"&&pi.PositionType()==POSITION_TYPE_BUY)
{B1Prf += pi.Profit();//+PositionGetDouble(POSITION_SWAP); //*********//commision is omited
}
}
}
return B1Prf;
}