mql4 issues - page 2

 
mo798ua:

wait, i comment out /*&&(isthiscandleswingl()) &&  minswingcandle<=2*/ and it work fine both crossup and

have different function they are no associated by any mean , please explain your point,thanks 

You have this condition :

   if((canbuy==true)&&(crossup==0)&& (isthiscandleswingh())&&  maxswingcandle<=2)

So crossup==0 must be true and isthiscandleswingh() must be true.

Inside isthiscandleswingh() :

if (crossup==true){
   double currentcandle=High[1];                 //check if cuurent candle is the hiest of previos 8 
   if (currentcandle>highestprevbar){
   return true;
   }
}

You want crossup to be true for the function to return true, but than means crossup!=0 (as false=0 and true any value not being 0).

Both crossup==0 and isthiscandleswingh() can never be true at the same time.

 
Alain Verleyen:

You have this condition :

So crossup==0 must be true and isthiscandleswingh() must be true.

Inside isthiscandleswingh() :

You want crossup to be true for the function to return true, but than means crossup!=0 (as false=0 and true any value not being 0).

Both crossup==0 and isthiscandleswingh() can never be true at the same time.

ok mate bear with im still giting used to mql4, i check if crossup=0 and is isthiscandleswingh to be true if in case if isthiscandleswingh result false it will return false that is why i put else return false ,if this is the wrong way to approach this issue what is the right way ? thank you for bring patient