Live Trading : Error 130 Market Order

 

Dear Forum,


I have a strange problem if my EA runs in realtime: after a pending order is changed in a market order I most of the times get a 130 error. With backtesting this never happend !

I re-read the tutorial. The only obligatory limitation is the following :


changing a sell Order: SL-ASK <= StopLevel


But my Alert Funktion tells me allways the following :

2009.06.15 18:27:59 LYTH-Expert1 EURUSD,H1: Alert: Modification rejected: 130

...

2009.06.15 18:28:00 LYTH-Expert1 EURUSD,H1: Alert: (SELL) parameters ticket 53807311 price: 1.37644 SL 1.37609 TP 0 Bid: 1.37567 Ask: 1.37585

...

2009.06.15 18:27:59 LYTH-Expert1 EURUSD,H1: Alert: (SELL) parameters ticket 53807311 price: 1.37644 SL 1.37614 TP 0 Bid: 1.37575 Ask: 1.37593


and so on...

as you can see the distance between Ask and SL is more than 20 !! ( Its a sell market order) the price is the OrderOpenPRice()


the corresponding code is the following:



TS = Reduced with a redcuing algorithm. Maybe less to the marketprice than the stoplevel.


double dist= MarketInfo(Symb,MODE_STOPLEVEL);
RefreshRates();
if ((TS-Ask)<= (dist*Point) )
TS =Ask + ((dist+1)*Point);

if (debug)
Print( "TS after CalcMinStopLevel TS = ",DoubleToStr(TS,5)," SL= ",DoubleToStr(SL,5), "Price= ",DoubleToStr(Price,5));

if (r5(Price)==r5(OrderOpenPrice()) && r5(TS)==r5(OrderStopLoss()) )
break;

Ans=OrderModify(Ticket,Price,TS,0,0);//Modify it!



Pretty simple, what the heck is going on here?


thanks for any idea!


regards,


filip




 
This might be a stupid thing but isnt it sell the bid and not ask?
 
jirimac:
This might be a stupid thing but isnt it sell the bid and not ask?

i dont think so, i copied this line ( SL-ASK) from the documntation here...

 

I meet the same problem:

same code, for BUY it works, but for SELL it pop up 130error.