counter need to reset

Back to topics list To post a new topic, please log in or register
avatar
220
luisneves 2015.08.18 13:29
 

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

 

avatar
Moderator
3427
GumRai 2015.08.18 14:20 #
 
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
Back to topics list  

To add comments, please log in or register