within deinit, cannot delete pendings

 

Hello, can anyone help with this problem?

When exiting my EA (File\Exit), I want the remaining pending to be deleted.

So I write:

.... 

void OnDeinit(const int reason)

  {Delete=OrderDelete(MyPendingTicket,CLR_NONE);

   Sleep(3000);

  }    ...

I added  Sleep(3000) to check, and 3 sec pause is clearly executed before the EA closes.

But the pending still remains open in the market. Please help to find the mistake! 

 
slimalex:

Hello, can anyone help with this problem?

When exiting my EA (File\Exit), I want the remaining pending to be deleted.

So I write:

.... 

void OnDeinit(const int reason)

  {Delete=OrderDelete(MyPendingTicket,CLR_NONE);

   Sleep(3000);

  }    ...

I added  Sleep(3000) to check, and 3 sec pause is clearly executed before the EA closes.

But the pending still remains open in the market. Please help to find the mistake! 

//---
void OnDeinit(const int reason)
  {
    If(REASON_CLOSE)
      {Delete=OrderDelete(MyPendingTicket,CLR_NONE);
   
       Sleep(3000);

      }    ...
  }