OrderModify()

 
2008.02.11 00:39:06 ReportsTrader GBPUSD,H1: OrderProcess: error 130 invalid stops Ask=1.1435 Bid=1.1427 MarketInfo(AUDNZD,MODE_STOPLEVEL)=5 cmd=OP_BUY OrderModify(11716965,1.1405,1.1407,1.1451,0,-1)

2008.02.11 00:29:14 ReportsTrader GBPUSD,H1: delete #11716966 sell stop 0.20 AUDNZD at 1.1371 sl: 1.1405 tp: 1.1325 ok

2008.02.11 00:24:20 ReportsTrader GBPUSD,H1: open #11716966 sell stop 0.20 AUDNZD at 1.1371 sl: 1.1405 tp: 1.1325 ok

2008.02.11 00:24:16 ReportsTrader GBPUSD,H1: open #11716965 buy stop 0.20 AUDNZD at 1.1405 sl: 1.1371 tp: 1.1451 ok

Buy and Sell pending positions are placed either side of the market, when the market reaches one of them then the other is cancelled, this is working. When the expert looks after it's little profit then OrderModify() prints error 130.
I have spent 2 weeks on this problem, another pair of eyes please.
 
Pick one...

ERR_INVALID_STOPS 130

Stops are too close, or prices are ill-calculated or unnormalized (or in the open price of a pending order). The attempt can be repeated only if the error occurred due to the price obsolescense. After 5-second (or more) delay, it is necessary to refresh data using the RefreshRates function and make a retry. If the error does not disappear, all attempts to trade must be stopped, the program logic must be changed.
 
[quotephy 12.02.08 00:17

Pick one...

ERR_INVALID_STOPS 130

Stops are too close, or prices are ill-calculated or unnormalized (or in the open price of a pending order). The attempt can be repeated only if the error occurred due to the price obsolescense. After 5-second (or more) delay, it is necessary to refresh data using the RefreshRates function and make a retry. If the error does not disappear, all attempts to trade must be stopped, the program logic must be changed.

][/quote]

phy, you did not even read the output of the expert published above!
 
I did.

I can't tell if your stops are un-normalized.

Can't tell if you have current bid/ask.

You showed output, not code.
 
On Market execution I have this message:
Invalid ticket for OrderModify function;
Here are the codes:
ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"EA"+Symbol(),MagicNumber,0,Blue);
OrderSelect(ticket,SELECT_BY_TICKET);
OrderModify(OrderTicket(),0,OrderOpenPrice()-StopLoss*Point,OrderOpenPrice()+TakeProfit*Point,0,Blue);
Thanks
FXman
 
Check ticket value if OrderModify() failed. For example:
bool result = OrderModify(OrderTicket(),0,OrderOpenPrice()-StopLoss*Point,OrderOpenPrice()+TakeProfit*Point,0,Blue);
if (!result) Print("OrderModify() ticket=",ticket," failed with error code ",GetLastError()); 
 
Thanks Rosh.It is working.
What is the different:
bool result = OrderModify(OrderTicket(),0,OrderOpenPrice()-StopLoss*Point,OrderOpenPrice()+TakeProfit*Point,0,Blue);
...
bool result = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-StopLoss*Point,OrderOpenPrice()+TakeProfit*Point,0,Blue);

instant 0 is OrderOpenPrice().
FXman
Reason: