Download MetaTrader 5

Ordertype based on indicator - page 3

To add comments, please log in or register
ffoorr
1081
ffoorr  
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
15598
whroeder1  
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