Error send

 

Already many thanks for your help!


 I'm going through a hard time finding the error.

the "if" is working properly, but sometimes it does not respect the order.

int TotalOrdersCount()
  {
   int result=0;
   for(int i=0;i<OrdersTotal();i++)
     {
      int MyOrderSelect=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderMagicNumber()==MagicNumber) result++;

     }
   return (result);
   } 
 double RSI = iRSI(NULL,NULL,14,PRICE_CLOSE,0);

if(TotalOrdersCount()==0)
     {
      int result=0;
      if(RSI<25) // Here is the open buy condition
        {
         result=OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask-StopLoss*MyPoint,0,NULL,MagicNumber,0,Blue);

 

 What erro?

 first order, the RSI is above the 70 line, is incorrect!

 the second and third order the RSI is below the 25 line. is correct!!!!

 

Very very thanks!!!! 

 
  1. double RSI = iRSI(NULL,NULL,14,PRICE_CLOSE,0);
    Second argument is the period, and int. NULL is not either.
  2. What function is that code located in?

  3. Check your return codes (OrderSend and OrderSelect) Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
 

hey WHRoeder.

Thanks for answer!!

 

I changed

double RSI = iRSI(Symbol(),15,14,PRICE_CLOSE,0)

 

but no work.

 :((((((

 
KeepMarcos:

hey WHRoeder.

Thanks for answer!!

 

I changed

 

but no work.

 :((((((

 

Screenshot?
Reason: