MQL5 HistoryDealGetTicket(index) error with code 4755

 
HistorySelect(0,TimeCurrent());
   for(int i =0;i<HistoryDealsTotal();i++)
   {
      ulong ticket = HistoryDealGetTicket(i);
      Print(" i = " +i + " ticket = " + ticket+" total = "+HistoryDealsTotal());
      int err = GetLastError();
      Print(err);
      
      

   }

this is my EA's little code which doesn't works. I have no idea why that can't select Deals. On tester it works fine,but when i launch it on Demo Account occurs 4755 error.

 
Did you check the ticket value and did you reset last error?
Reason: