Download MetaTrader 5

why do i get ordersend error 148 ??

To add comments, please log in or register
sergey
254
sergey  
//--- * short trade 




if  (trade_ok==true)

{

if ( ( Ask- SMA_10day  < buffer*Point*K ) && ( price_above==true))      
  
  {  
     ticket1=-1;
     ticket2=-1;
     while (MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID)<4*Point*K)  // spread < 4
     {
     Alert(MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID));
     RefreshRates();
     ticket1 = OrderSend(Symbol() , OP_SELL , 0.01*M , Bid , 3 , Ask+stoploss*Point*K , Ask-takeprofit*Point*K); 
     Sleep(2000);
     if (ticket1>0)  
     break;
     }
     
     if (AccountBalance()/max_account_balance>0.9) // no 10% drawdown
     {
     while (MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID)<4*Point*K) //spread < 4
     {
     Alert(MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID));
     RefreshRates();
     ticket2 = OrderSend(Symbol() , OP_SELL , 0.01*M , Bid , 5 , Ask+stoploss*9*Point*K , Ask-takeprofit*Point*K); 
     Sleep(2000);
     if (ticket2>0)  
     {
     entryprice=Ask;
     break;
     } 
     }
     }
trade_ok=false; 

  }
  
    //--- * end of short trade
     
     else 
     
       
//--- * long trade

if ( ( SMA_10day -  Bid < buffer*Point*K ) && (price_above==false))      
  
  {   
     ticket1=-1; 
     ticket2=-1;
     while (MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID)<4*Point*K) //spread < 4
     {
     Alert(MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID));
     RefreshRates();     
     ticket1 = OrderSend(Symbol() , OP_BUY , 0.01*M , Ask , 2 , Bid-stoploss*Point*K , Bid+takeprofit*Point*K);
     Sleep(2000);
     if (ticket1>0)
     break;
     } 
     if (AccountBalance()/max_account_balance>0.9) // no 10% drawdown
     {
     while (MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID)<4*Point*K) //spread < 4
     {
     Alert(MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID));
     RefreshRates();
     ticket2 = OrderSend(Symbol() , OP_BUY , 0.01*M , Ask , 3 , Bid-stoploss*9*Point*K , Bid+takeprofit*Point*K);
     Sleep(2000);
     
     if (ticket2>0)
     {
       entryprice=Bid;
       break;
     }
     }
     }
     trade_ok=false;    
  }

I seem to get Ordersend error 148

can anyone tell why ?

thanks

sergey
254
sergey  
sergeyrar:

I seem to get Ordersend error 148

can anyone tell why ?

thanks


P.S - without the condition : " if (AccountBalance()/max_account_balance>0.9) " it works fine
sergey
254
sergey  

nevermind I solved it.

Genesis Hafalla
1888
Genesis Hafalla  
How did you solved it Serge?
honest_knave
Moderator
2322
honest_knave  

Presumably by restricting the number of orders. This is a limit set by your broker:

148

ERR_TRADE_TOO_MANY_ORDERS

The amount of open and pending orders has reached the limit set by the broker

To add comments, please log in or register