Download MetaTrader 5

Placing short orders via OrderSend - error 130

To add comments, please log in or register
Rhias
7
Rhias  

Hi guys,

I'm trying to place a short order via OrderSend but I get error #130. Since I'm a noob in MQL development I'm sure you can solve this issue really fast. :P

So here's the code snippet:

double takeProfitTotal = NormalizeDouble(Ask-(TakeProfit*Point),Digits);
double stopLossTotal = NormalizeDouble(Ask+(StopLoss*Point),Digits);
Print("Try to OrderSend with Bid price " + Bid + ", take profit " + takeProfitTotal + " and stoploss " + stopLossTotal); 
int ticket = OrderSend(Symbol(), OP_SELL, 1, Bid, stopLossTotal, takeProfitTotal, "Test Order", 376, 0, clrRed);
if(ticket<0) {
    Print("OrderSend failed with error #",GetLastError());
} else {
    Print("OrderSend placed successfully with takeProfit " + takeProfitTotal + " and stoploss " + stopLossTotal); 

}

I have set the input parameters TakeProfit and StopLoss to 500.

When I execute the backtesting of the Expert Advisor I get the following log entrys:

Try to OrderSend with Bid price 1.06689, take profit 1.06237 and stoploss 1.07237

OrderSend failed with error #130

OrderSend error 130


Any suggestions how to solve this issue?


Kind regards

Rhias

Alain Verleyen
Moderator
33479
Alain Verleyen  
Please do some researches before posting, similar questions have been asked hundreds of time.
To add comments, please log in or register