Download MetaTrader 5
To add comments, please log in or register
Copy the deals of successful traders. Subscribe to signals!
ffoorr
996
ffoorr 2014.09.16 10:38  
if(check == true)
{
   down= down = iCustom(NULL,0,"ASCTrend1sig_noSound", RISK, CountBars,1,0);
   up= down = iCustom(NULL,0,"ASCTrend1sig_noSound", RISK, CountBars,0,0);
}//if(checkforTrade == true) 


if(OrdersTotal() == 0 && check == true)
{
   if(down!= 0.0 && opentrade ==false)
   {
      opensell();
      check=false;
      opentrade=true;
   }// if(downtrend!=EMPTY_VALUE)
                
   else if(up!=0.0 && opentrade ==false)
   {
      openbuy();
      check=false;
      opentrade=true;
   }// else(uptrend!=EMPTY_VALUE)
    
    
  }// if(OrdersTotal()==0)

 
whroeder1
13936
whroeder1 2014.09.16 15:13  
albo111:  After one order is closed it opens another order with the same signal and thats what I doesent want
if(down!= 0.0 && ...
So stop looking at a level (down != 0) and start looking for a change of signal
static double down; // Or global.

bool signal_prev = down != 0;
down = iCustom(NULL,0,"ASCTrend",1,0);
if(down != 0.0 && !signal_prev && ...

/ /123
To add comments, please log in or register