int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)
@Scottish Mike
Metatrader 4 doesn’t do a good job of converting integers to doubles. Sometimes it triggers a hard to understand error and sometimes it does not. As there is no way to know when it will cause an exception, the best practice is to always explicitly use 0.0 for a double type rather than 0 which Metatrader interprets as an integer. I understand that type conversion is built into MT5.
@goodmast3r
You may be running into NFA FIFO rules. Try placing the order with no SL or TP, then use OrderModify to add a stop loss and take profit to your open order. If you need help implementing this I wrote up a sample for a buy/sell script that does this. Google “buy with place stop loss and profit target in MT4?” and you should find it at the top of the list.