Order Modify Error 1
Contents |
OrderModify Modification of characteristics of the previously opened or pending orders. boolOrderModify( intticket,//ticket doubleprice,//price doublestoploss,//stoploss doubletakeprofit,//takeprofit datetimeexpiration,//expiration colorarrow_color//color ordermodify error 130 ); Parameters ticket [in] Unique number of the mql4 ordermodify order ticket. price [in] New open price of the pending order. stoploss mql4 ordermodify error 130 [in] New StopLoss level. takeprofit [in] New TakeProfit level. expiration [in] Pending order expiration time. arrow_color [in] Arrow color for mql4 error 130 StopLoss/TakeProfit modifications in the chart. If the parameter is missing or has CLR_NONE value, the arrows will not be shown in the chart. Returned value If the function succeeds, it returns true, otherwise false. To get the detailed error information, call
Mt4 Ordersend Error 130
the GetLastError() function. Note Open price and expiration time can be changed only for pending orders. If unchanged values are passed as the function parameters, the error 1 (ERR_NO_RESULT) will be generated. Pending order expiration time can be disabled in some trade servers. In this case, when a non-zero value is specified in the expiration parameter, the error 147 (ERR_TRADE_EXPIRATION_DENIED) will be generated. Example: voidOnStart() { intTrailingStop=50; //---modifiesStopLosspriceforbuyorder№12345 if(TrailingStop>0) { OrderSelect(12345,SELECT_BY_TICKET); if(Bid-OrderOpenPrice()>Point*TrailingStop) { if(OrderStopLoss() here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us mql4 ordersend error 130 Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with orderselect us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, https://docs.mql4.com/trading/ordermodify just like you, helping each other. Join them; it only takes a minute: Sign up Error 1 in OrderModify up vote 0 down vote favorite I'm trying to modify an Order, but I always get Error #1. From my research, I have discovered that error 1 means I have input parameter in a wrong way. How http://stackoverflow.com/questions/32947073/error-1-in-ordermodify can I fix my OrderModify() function? stoploss = NormalizeDouble(Ask - Point * TrailingStop,Digits); int ticket; takeprofit = NormalizeDouble(Ask + Point * TrailingStopTP,Digits); double minstoplevel = MarketInfo( Symbol(), MODE_STOPLEVEL ); if(stoploss > NormalizeDouble(Ask - Point*minstoplevel,Digits)) { stoploss = NormalizeDouble(Ask - Point*minstoplevel,Digits); } if(takeprofit < NormalizeDouble( Ask + Point*minstoplevel2, Digits )) { takeprofit = NormalizeDouble( Ask + Point*minstoplevel2, Digits ); } if(AccountFreeMarginCheck(Symbol(),OP_SELL,lotsize)>0) { ticket=OrderSend(Symbol(),OP_BUY,lotsize,Ask, 0, 0.0, 0.0, "comment", MagicNumber, 0, Lime); if(ticket<0) { Print("Order send failed with error #",GetLastError()); } else { Print("Order send sucesso!! Ticket#", ticket); res=OrderModify(ticket,OrderOpenPrice(),stoploss,takeprofit,0,Blue); if(res==false) { Print("Error modifying order!, error#",GetLastError()); } else { Print("Order modified successfully, res#", res); } } } else { Print("Sem dinheiro na conta D="); } } mql mql4 share|improve this question edited Oct 5 '15 at 11:28 user3666197 7,86121330 asked Oct 5 '15 at 11:06 Filipe Ferminiano 1,14722046 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted Not exactly "wrong", OrderModify() legally sets _LastError == 1 There might be a bit surprise, but OrderModify() here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about http://stackoverflow.com/questions/27240934/modifying-order-returns-error-130 hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges http://d.hatena.ne.jp/fai_fx/20091122/1258815644 Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Modifying order returns error 130 up vote 1 down vote favorite I'm trying to modify an order, but I keep Error modifying order!, error#130. I'm using an ECN broker, error 1 so I need to modify the order to set a stoploss/takeprofit. What I am doing wrong? int digits = MarketInfo( Symbol(), MODE_DIGITS ); if ( digits == 2 || digits == 3 ) pipdigits = 0.01; else if ( digits == 4 || digits == 5 ) pipdigits = 0.0001; selltakeprofit = Ask + ( takeprofit * pipdigits ); sellstoploss = Ask - ( stoploss * pipdigits ); ticket = OrderSend( Symbol(), OP_SELL, lotsize, Ask, 100, 0, 0, modify error 1 0, 0, 0, CLR_NONE ); if ( ticket < 0 ) { Print( "venda Order send failed with error #", GetLastError() ); Print( "stop loss = ", sellstoploss ); } else { Print( "Order send sucesso!!" ); Print( "Balance = ", AccountBalance() ); Print( "Equity = ", AccountEquity() ); bool res = OrderModify( ticket, 0, sellstoploss, selltakeprofit, 0 ); if ( res == false ) { Print( "Error modifying order!, error#", GetLastError() ); Print( "sellstoploss ", sellstoploss ); Print( "selltakeprofit ", selltakeprofit ); Print( "StopLevel ", StopLevel ); Print( "Ask ", Ask ); } else { Print( "Order modified successfully" ); } } mql mql4 share|improve this question edited Dec 13 '14 at 18:39 user3666197 7,86121330 asked Dec 2 '14 at 2:33 Filipe Ferminiano 1,14722046 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted Error #130 is ERR_INVALID_STOPS. The most likely problem is that a) the stoploss level you are inputting is too close to the order open price. This is dictated by MarketInfo( Symbol(), MODE_STOPLEVEL ) // returns a min allowed distance [pts] else b) because you have not normalized the stoploss level with NormalizeDouble(). See below for a buy order example. In your example, i.e. for a sell order, note that you should be opening the order at the Bid price, not Ask as you have. Note also that the stoploss and takeprof error 1¤¬ÉÑȯ¤¹¤ë¤Î¤Ç¤¹¤¬¡¢¥³¡¼¥É¤ò¸«¤ë¸Â¤ê¤ª¤«¤·¤Ê½ê¤¬Ìµ¤¤¤è¤¦¤Ë¸«¤¨¤Þ¤¹¡£ for(i=0;i< OrdersTotal();i++){ if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true){ if (OrderMagicNumber() == MAGIC){ if(OrderType()==OP_BUY){ if ( (TL>0) && (Bid-TL*Point>=OrderOpenPrice()) && (Bid-TL*Point>OrderStopLoss()) ) OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TL*Point,OrderTakeProfit(),0,Green); } if(OrderType()==OP_SELL){ if ( (TL>0) && (Ask+TL*Point<=OrderOpenPrice()) && (Ask+TL*Point< OrderStopLoss()) ) OrderModify(OrderTicket(),OrderOpenPrice(),Ask+TL*Point,OrderTakeProfit(),0,Green); } } } } OrderModify error 1 ¤Ï¡¢¸½ºß¤Î OrderStopLoss() ¤ÈƱ¤¸²Á³Ê¤Ç¤â¤¦°ìÅÙ OrderModify ¤·¤è¤¦¤È¤¹¤ë»þ¤Ê¤É¤Ëµ¯¤¤ë¥¨¥é¡¼¤Ç¤¹¡£¤·¤«¤·¡¢Çä¤ê¥Ý¥¸¥·¥ç¥ó¤Î¾ì¹ç¤Ï¡¢ Ask+TL*Point < OrderStopLoss() ¤È¤¤¤¦¾ò·ï¼°¤¬¤¢¤ë¤Î¤Ç¡¢Æ±¤¸²Á³Ê¤Ç¤Î OrderModify ¤Ï¤·¤Ê¤¤¤Ï¤º...¤ÈÆɤá¤Þ¤¹¡£ ¼Â¤Ï¡¢¤³¤ÎÈæ³Ó¼°¤ËÌäÂ꤬¤¢¤Ã¤Æ¡¢MQL4ÆâÉô¤ÎÉâÆ°¾®¿ôÅÀ¿ô¤Î´Ý¤á¸íº¹¤Ë¤è¤Ã¤Æ Ask+TL*Point = 1.4855000000000000 OrderStopLoss() = 1.4855000000000002 ¤È¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¾ò·ï¼°¤¬À®Î©¤·¤Æ¤·¤Þ¤¤¤Þ¤¹¡£ (¥×¥í¥°¥é¥à¤ò¥Ç¥Ð¥Ã¥°¤·¤Æ¤¤¤ë¤È¤¤Ï¡¢¤É¤Á¤é¤ÎÃͤâ 1.4855 ¤À¤È»×¤¤¹þ¤ß¤ä¤¹¤¤¤Î¤Ç¡¢Èó¾ï¤Ëµ¤¤Å¤¤Ë¤¯¤¤¤È¤³¤í¤Ç¤¹¡£) ¤³¤Î¤è¤¦¤ÊMQL4ÆâÉô¤Ç¤ÎºÇ¾®·å¤ÎÀµ³Î¤ÊÃͤϡ¢ #include Mql4 Error Codes