Thread: How to code?
View Single Post
  #89 (permalink)  
Old 05-06-2006, 03:39 AM
cardio cardio is offline
Senior Member
 
Join Date: Sep 2005
Location: St Louis, MO, USA
Posts: 176
cardio is an unknown quantity at this point
Check symbol and EA magicnumber

Hi

Thanks codersguru

The following also checks the symbol and magicnumber (I hope)- so one doesn't get one's ea messing with each other

Code:
double GetLastProfit(string symbol1,int magicEA )
{
   int total = HistoryTotal();
   
   datetime cur_order = 0;
   datetime last_order=0;
   double profit=0;
      
   for(int cnt = 0 ; cnt < total ; cnt++)
   {
      OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY);
      if(OrderSymbol()!= symbol1 || OrderMagicNumber() != magicEA) continue;
      cur_order = OrderCloseTime();
      if(cur_order>last_order)
      {
         last_order = cur_order;
         profit = OrderProfit();
      }
   }
   return (profit);
}

Last edited by cardio; 05-06-2006 at 04:05 AM.
Reply With Quote