Download MetaTrader 5

Whats wrong with this Code

To add comments, please log in or register
Samih Abdelli
66
Samih Abdelli  

I started getting ERROR 130

when not using SL and TP, there is no prob, 

//+------------------------------------------------------------------+
void Buy(double lot, int magic){
   int tp=NormalizeDouble(Bid+100*Point,Digits);
   int sl=NormalizeDouble(Bid-100*Point,Digits);
   if(OrderSend(Symbol(),OP_BUY,lot,Ask,3,sl,tp,magic,magic,0,clrNONE)){
      Print(Symbol()+" Buy @ "+Ask);
   }else{      Print("Buy Open ERROR");   }
}
//+------------------------------------------------------------------+
void Sell(double lot, int magic){
   int tp=NormalizeDouble(Ask-100*Point,Digits);
   int sl=NormalizeDouble(Ask+100*Point,Digits);
   if(OrderSend(Symbol(),OP_SELL,lot,Bid,3,sl,tp,magic,magic,0,clrNONE)){
      Print(Symbol()+" Sell @ "+Bid);
   }else{      Print("Sell Open ERROR");   }
}
//+------------------------------------------------------------------+
Samih Abdelli
66
Samih Abdelli  
Samih Abdelli:

I started getting ERROR 130

when not using SL and TP, there is no prob, 


Sorry, I fount it

SL and TP are double not int

To add comments, please log in or register