Download MetaTrader 5
To add comments, please log in or register
Do you have Linux? Find out how to install MetaTrader on it!
Keep Marcos
120
Keep Marcos 2016.03.02 17:59 

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!!!! 

whroeder1
13597
whroeder1 2016.03.02 18:16  
  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
Keep Marcos
120
Keep Marcos 2016.03.02 18:43  

hey WHRoeder.

Thanks for answer!!

 

I changed

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

 

but no work.

 :((((((

Vasyl Nosal
18199
Vasyl Nosal 2016.03.02 23:30  
KeepMarcos:

hey WHRoeder.

Thanks for answer!!

 

I changed

 

but no work.

 :((((((

 

Screenshot?
/
To add comments, please log in or register