Problem with OrderModify error 130
What does TakeProfit - Stoploss have to do with anything?
What was the Bid price when you tried to modify the order?
You're probably trying to set the SL at a price higher than the current price.
143.83 - 142.27 > 0.06 = 1.56
That logic is wrong when setting up the value for SL, I think.
OR the point is close to the Bid/Ask
That logic is wrong when setting up the value for SL, I think.
OR the point is close to the Bid/Ask
The logic is most definitely wrong, there is no doubt about that
Let's use an example, if the japan pair has only 2 digits
Open a Buy order at 144.00
SL is 143.50
H =145.00 (Day high)
if(NormalizeDouble(H-OrderOpenPrice(),MyDigits)> //if(145.00-144.00>0.50) Yes, that's true NormalizeDouble(BE,MyDigits) && NormalizeDouble(H-SL,MyDigits)> //if(145.00-0.50>143.50) Yes, true as well NormalizeDouble(OrderStopLoss(),MyDigits)) { //Why normalise to 10 Digits?????? NewSL = NormalizeDouble(H-SL, MyDigits);//145.00-0.50= 144.50 BUT normalised to 10 Digits NewTP = OrderTakeProfit(); Print(NewTP+" - "+NewSL+" > "+SLev+" = "+(NewTP-NewSL)); if(NormalizeDouble(NewTP-NewSL, MyDigits)>NormalizeDouble(SLev, MyDigits)) { modify=OrderModify(OrderTicket(), OrderOpenPrice(), //Open price is 144.00 NewSL, //NewSL is 144.50 NewTP, //No where has OrderClosePrice or Bid been checked, 0, //So while Bid is below 144.50 the modify will fail clrYellow); } }
and result
2014.04.20 22:29:59.759 2014.01.06 21:50 px EURJPY,Daily: OrderModify error 130
2014.04.20 22:29:59.759 2014.01.06 21:50 px EURJPY,Daily: 143.83 - 142.27 > 0.06 = 1.56
MODE_STOPLEVEL is 0.06
and TakeProfit - StopLoss is 1.56
why I have styll error 130????