How can I get history deals from different EA?

 

I try to summary my account.

All deals come from my first EA.

I wrote another EA to summary this account.

But I can't get details.


int OnInit()

  {

//---

   Summary();

//---

   return(INIT_SUCCEEDED);

  }

void Summary()

{

   HistorySelect(0,TimeCurrent());

   int deals = HistoryDealsTotal();

   double balance = AccountInfoDouble(ACCOUNT_BALANCE);

   int counter = 0;

   bool got;

   for(int i=deals-1;i>=0;i--)

   {

      ulong tick = HistoryOrderGetTicket(i);

      ulong magic;

      got = HistoryDealGetInteger(tick,DEAL_MAGIC,magic); 

      long d_t = HistoryDealGetInteger(tick,DEAL_TIME_MSC);

      string deal_symbol = HistoryDealGetString(tick,DEAL_SYMBOL);

      double profit = HistoryDealGetDouble(tick,DEAL_PROFIT);

      datetime deal_time = (datetime)HistoryDealGetInteger(tick,DEAL_TIME);

   }

}


HistoryDealsTotal() works.

But HistoryDealGetInteger always returns false.