Download MetaTrader 5
To add comments, please log in or register
Join MQL5 Cloud Network affiliate program and make money!
eliusm
48
eliusm 2014.08.05 14:46 

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
28535
Alain Verleyen 2014.08.05 15:24  
Probably as you are checking error when there is not.
/
To add comments, please log in or register