Normalizing the SL/TP usually solves the problem. It still seems incredible that values like Bid, High, Low and Ask can’t be used as provided by the server, but have to be normalized in OrderSend() and OrderModify().
whn i take a buy order with code ordersend on mql terminal…the order opens above the ask everytime,bt whn it comes to sell…its perfect…hw do i correct the code in order to open a buy order at exact point …
@ztory666 is on to it. You need to specify price value for things like stop loss and take profit, which means doing some pip-to-digit math. See if this helps:
double Stoploss = 50;
double Takeprofit = 50;
int start()
{
int ticket = OrderSend(Symbol(),OP_BUY,1.0,Ask,3,Ask-(Stoploss*.0001),
Ask+(Takeprofit*.0001),“Order #1”,1234,0,Red);
It’s probably because it’s an market execution broker. Basically the price that you send to the broker is meaningless. You can just send the order like this
can someone here help me out!!..whn take a buy order,the order opens above the ask price ,this happens everytime…bt whn i take a sell order it opens exact at market price bid perfectly…how do i correct the ordersend function fr a buy order…i m working on broker hotforex
You don’t have to modify the order to set SL and TP with OrderModify() function.
You don’t have to normalize these prices with NormalizeDouble() function.
Just in case I forgot something, in which symbol do you get that error?