Building A Function I need your help !!!

 

Hi everyone

I want to build a Function that assign a letter or anything and after that calculate and get total = profit + or - target daily then stop the EA.

Something like this , I don't have any idea how to do it !

void or bool   Profit_Daily()

{
  if(OrderSelect(0, SELECT_BY_POS,MODE_HISTORY)==true) 
  {
    (OrderProfit()= a); 
    }
 
     if(OrderSelect(1, SELECT_BY_POS,MODE_HISTORY)==true) 
  {
    (OrderProfit()= b); 
    }
    
  if(OrderSelect(2, SELECT_BY_POS,MODE_HISTORY)==true) 
  {
    (OrderProfit()= c); 
    }
  

 double total = a + b + c  ;
 
  
  }

Thanks