Dear Mr. Rosh, How to make an instruction successfully ?

 

Hi ! Mr. Rosh

I found Demo Test is very defferent from Back Test !

An ea operates very good in Back Test but Ii's failure in Demo Test

For example :

Using OrderModify(....) is very successful in Back Test

But it does not work at Demo

It seems your Server (MetaQuotes' Server) refuse acception the OrderModify(....)

It look like the server jump over the OrderModify(....) to next instruction !

Mr. Rosh,

1. How to make sure the Server to accept the OrderModify(....) ?

2. How to know the Server is to execute it already ?

Please help me !

Thank you in advance !

 
You have to check result of function OrderModify(). If result is true - all right. Otherwise you have to get error code with GetLastError() and handle it.
 

Thank you for responsed my question !

Well,I can use the cycle to force the server trying "the modify" again and again until "the modify" successfully

like this :

......

while(OrderModify(...))

{

Sleep(1000);

}

.....

It's OK ?

 
I don't see handling of OrderModify(). It is unsafe code. This is more correctly one:

int try=0;
bool result;
while(try<5)
  {
   RefreshRates();
   result=OrdersModify(...);
   if (result) break;
   if (!result)
      {
      int err=GetLastError();
      Print("OrderModify failed with error code=",err);
      if (error is critically) break; 
      }
  try++;
   Sleep(1000);
  }
 

Thank you so much !

I will try this and report thr result !

 
原因: