下载MetaTrader 5
要添加评论,请登录注册
您想要学习MQL5吗?300篇文章将有助于您!
Yi Chen
1838
Yi Chen 2016.01.11 12:23 

Dear,why dose below program always display  ” ordermodify error 130 ” ?

 

 void OnTick()

  {

//---

if(Hour() == 1 && OrdersTotal() == 0)

{

int ticket=OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0,NULL,1,0,NULL);

       for(int i=0;i<=OrdersTotal();i++)

           {

            if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == true && OrderType() == OP_SELL && OrderMagicNumber() == 1)

               {

                //--- calculated SL and TP prices must be normalized 

    double stoploss=NormalizeDouble(Bid-80*Point,Digits); /*Digits=3*/

    double takeprofit=NormalizeDouble(Bid+80*Point,Digits); 

                  int rsp = OrderModify(OrderTicket(),OrderOpenPrice(),stoploss,takeprofit,0,NULL);

                }

           }

       }

  }

 

thank you! 

 

 <journal>

2016.01.11 21:20:34.160 USDJPY-a01,M30: 2160205 tick events (2342 bars, 2161205 bar states) processed in 0:00:03.307 (total time 0:00:05.928)

2016.01.11 21:20:34.160 2015.12.29 23:59  Tester: order #1 is closed

2016.01.11 21:20:30.853 2015.10.01 01:00  rr USDJPY-a01,M30: OrderModify error 130

2016.01.11 21:20:30.853 2015.10.01 01:00  rr USDJPY-a01,M30: open #1 sell 0.10 USDJPY-a01 at 119.866 ok

2016.01.11 21:20:30.851 2015.10.01 00:00  rr test started

2016.01.11 21:20:30.282 TestGenerator: spread set to 10

/
要添加评论,请登录注册