Download MetaTrader 5

Invalid parameters error... but I'm only reading data...

To add comments, please log in or register
eliusm
48
eliusm  

Dear all!!

 In mi code (below) I'm only trying to read data from any order, and not delete orders or open anothers, but every time it show the "INVALID PARAMETER" error, (code 3). Why??

 Code:

double FindPrice;
int Type_Find1, Type_Find2, Ticket_Founded;

void start() {
   Type_Find1=OP_SELL;
   Type_Find2=OP_SELLSTOP;
   FindPrice= ..any price..;
   Find();
}

int Find() {
   Ticket_Founded=0;
   for(int f=0;f<OrdersTotal();f++) {
      if(OrderSelect(f, SELECT_BY_POS)) {
         if((OrderType()==Type_Find1 || OrderType()==Type_Find2) && (OrderOpenPrice()<FindPrice+0.005 && OrderOpenPrice()>FindPrice-0.005)) {
            Ticket_Founded=OrderTicket();
         }
      }
   }
   Err=GetLastError();
   if(Err!=0) Print("Error in Find: ",Err);
   return(0);
}

 I think it is not necessary to count back in the loop, because I'm not trying to delete or create orders.

 What parameters can be wrong if I only read data?


MT version 4 build 670. 

Thank you very much!!! 

Alain Verleyen
Moderator
32547
Alain Verleyen  
Probably as you are checking error when there is not.
To add comments, please log in or register