你好,下面是一个简单的在自定义placeorder下单函数中调用A_SendOrderEx的代码,我想在自定义的placeorder函数参数orIDs能返回订单ID。但返现placeorder的A_SendOrderEx返回的orderIDs有值,但在Onbar中placeorder返回orIDs为空,这是为什么? 如果目的是要在Onbar的placeorder能返回订单ID,怎么修改代码,谢谢!
// 封装下单函数
Bool PlaceOrder(Integer BuyOrSell, Integer EntryOrExit, Integer MarketOrLimit, Integer lot, Numeric price, Array<Integer> orderIDs)
{
Bool ret;
ret = A_SendOrderEx(BuyOrSell, EntryOrExit, lot, price, orderIDs, "", CreateSource);
if(ret)
Print(" A_SendOrderEx, orderID="+TextArray(orderIDs)); //这里orderIDs有值
return ret;
}
//Bar更新事件函数,参数indexs表示变化的数据源图层ID数组
OnBar(ArrayRef<Integer> indexs)
{
Array<Integer) orIDs;
bool ret = PlaceOrder(Enum_Buy, Enum_Entry, Enum_Market, 1, Q_AskPrice(), orIDs); //但为什么返回的orIDs是空?
if(ret)
Print("OnBar, orIDs="+TextArray(orIDs)); //这里打印orIDs为空
}
明白了,要用ArrayRef