请教:“mq5”如何根据持仓订单编号得到魔术编号(Ask: "mq5" how to get the magic number according to the position order number)

 

问:“ mq5”如何根据持仓订单号获得幻数

Ask: "mq5" how to get the magic number according to the position order number

 
Jian Guo Jiang:

问:如何根据下达订单号获得魔数?

Ask: How to get the magic number according to the position order number

OrderSelect选中订单然后OrderMagicNumber得到魔数,你可以看看帮助文档里的例子:


  if(OrderSelect(10,SELECT_BY_POS)==true)
    Print("Magic number for the order 10 "OrderMagicNumber());


把按位置选中改成按订单号选中就可以了

 
Huajun Huang:

OrderSelect选中订单然后OrderMagicNumber得到魔数,你可以看看帮助文档里的例子:


  if(OrderSelect(10,SELECT_BY_POS)==true)
    Print("Magic number for the order 10 "OrderMagicNumber());


把按位置选中改成按订单号选中就可以了

感谢,这是mt4的方法,我想知道mt5有没有更加快捷的方式

 
Jian Guo Jiang:

感谢,这是mt4的方法,我想知道mt5有没有更加快捷的方式

MT5我就不了解了

 
   long magic;
   ulong ticket = 123;
   if(PositionSelectByTicket(ticket))
   {
      magic = PositionGetInteger(POSITION_MAGIC);
   }
 
Ziheng Zhuang:
谢谢 看来mt5没有捷径
 
Jian Guo Jiang:

问:“ mq5”如何根据持仓订单号获得幻数

Ask: "mq5" how to get the magic number according to the position order number

和mt4格式都差不多,就是获取的函数不同而已