I am trying to open trades based on a Fractals. Code compiled without error but it is NOT opening any trade..

 

Hi, I am new to MQL4 programming. I am trying to add code to my EA using fractal. The condition is if there is NOT Up Fractal in last 4 bars , it should open BUY trade..Here code compiles without Error but it is NOT opening trade.. here's the code:


bool Upfractal()
 {
  int a;
  for(a=1;a<5;a++)
  {
  if(iFractals(NULL,0,MODE_UPPER,a)!=0)
  return(true);
  }
  return(false);
 }

void ManageOpen()
  {
   if(Upfractal()==false)
    {  
     OpenPosition(OP_BUY);
    }
  }

Regards.

 
Ahmed Hussain: Here code compiles without Error but it is NOT opening trade..
  1. Unless that code is actually being called, nothing will ever happen.
  2. Always post all relevant code.
         How To Ask Questions The Smart Way. 2004
              Be precise and informative about your problem

  3. Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?

 
William Roeder:
  1. Unless that code is actually being called, nothing will ever happen.
  2. Always post all relevant code.
         How To Ask Questions The Smart Way. 2004
              Be precise and informative about your problem

  3. Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?

Function is being called in if statement and it is getting executed now. Thanks.

Reason: