counter need to reset

 

Hi all,

Could you help me here,

 

Using the code I want to put to zero the counter if the condition fails.

Right now if; 

              if(BounceCount >= Bounce && Bid > BuyTrigger)

is true the ea puts the order and the counter is set to zero, but if it fails the ea do not put the order and the counter is not set to zero.

I appreciate any support from you and thank you in advance.

 

Luis Neves 

 

//Buy Order Condition to Open--------------------------------------------------------------------------------------------+
           
       if(Bid > BuyTrigger)      
        {
         BounceCount++;
        }
       if(BounceCount >= Bounce && Bid > BuyTrigger)
        {//5            
                 RefreshRates();                               
       BuyTicket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage*pips2points,0,0,"Initial Buy Order",MagicNumber,0,Green);       
       if(BuyTicket > -1)     
        {//6
         PlaySound("alert.wav");
          Print(" Initial Buy Order Placed - BuyTicket: ",BuyTicket," Open Buy Price: ",DoubleToStr(OrderOpenPrice(),Digits)," Spread: ",DoubleToStr(Spread,Digits));                                                                                                
        }//6
      else
        {//7
        //GetLastError();
          BounceCount = 0;               
        }//7          
     return(0);
       }//5
 
luisneves:

Hi all,

Could you help me here,

 

Using the code I want to put to zero the counter if the condition fails.

Right now if; 

              if(BounceCount >= Bounce && Bid > BuyTrigger)

is true the ea puts the order and the counter is set to zero, but if it fails the ea do not put the order and the counter is not set to zero.

I appreciate any support from you and thank you in advance.

 

Luis Neves 

 

 

The counter is not set to zero when the order is placed, it is set to zero if the OrderSend() fails