EA opening only BuY orders/ SELL NOT

To add comments, please log in or register
Stanislav Ivanov
6589
Stanislav Ivanov  

Hi, I`m posting a piece of code from my EA - it has a problem - its not opening any SELL orders.

if(!AreThereOrders() && order4_allow==true)
{    
if( fisher1>0 && cci0<-70 && stoch0>50 && rsi0>45)
{
         ticket=OrderSend(Symbol(),OP_BUY,lotsize_4,Ask,slippage,NormalizeDouble(Bid-(stoploss_order4*point),Digits),NormalizeDouble(Bid+(takeprofit_order4*point),Digits),NULL,magic4,0,clrGreen);
         if(ticket>0)
           {           
               Print("Order Opened BUY - 4!!");
           }
         else
            Print("Error occured BUY -4 not sent! Error code :",GetLastError());
            return;
}
else if( fisher1<0 && cci0>70 && stoch0<50 && rsi0<45)
{
 ticket=OrderSend(Symbol(),OP_SELL,lotsize_4,Bid , slippage , NormalizeDouble(Ask+(stoploss_order4*point),Digits ),NormalizeDouble(Ask-(takeprofit_order4*point),Digits),NULL , magic4,0,clrRed);
        if(ticket>0)
           {           
               Print("Order Opened SELL -4!!");
           }
         else
            Print("Error occured SELL -4 not sent! Error CODE:",GetLastError());   
}

}//
William Roeder
20208
William Roeder  
Stanislav Ivanov: I`m posting a piece of code from my EA - it has a problem - its not opening any SELL orders.
  1. If your condition is working, what is your error code? No error code, your condition isn't working. Use the debugger or print out your variables, including _LastError and find out why.
  2. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is usually wrong

Stanislav Ivanov
6589
Stanislav Ivanov  
thank you
To add comments, please log in or register