请教!!!
Params //此处添加参数 Vars //此处添加变量 String my_tb("tbf_wd118552"); Integer accountIndex; Integer LastIndex; Integer nCount; //Integer InvalidInteger(); Numeric a; Numeric b; Numeric c; Global Numeric k; bool m; Defs //此处添加公式函数 Events //此处实现事件函数 //初始化事件函数,策略运行期间,首先运行且只有一次 OnInit() { A_BindTradeAccount(my_tb); } //Bar更新事件函数,参数indexs表示变化的数据源图层ID数组 OnBar(ArrayRef<Integer> indexs) { if (k==0) { if (BarExistStatus() == 1 /*BarStatus() == 2*/) { if (close>open ) { a=IntPart((A_FreeMargin(accountIndex = 0)*0.32)/((close+MinMove()*5)*MarginRatio()*ContractUnit())); b=Q_AskPrice()-MinMove()*5; print("委托价格:"+text(b)); m=A_SendOrder(Enum_Buy,Enum_Entry,a,b); print("开仓"); print("开仓价格:"+text(b)); if (m == true) { print("是否发单:"+"成功"); } Else { print("是否发单:"+"失败"); } } } LastIndex = A_GetLastOpenOrderIndex(Enum_Buy,Enum_Entry); print("索引:"+text(LastIndex)); print("手数:"+text(a)); print("开仓资金:"+text(A_FreeMargin(accountIndex = 0)*0.32)); print("可用资金:"+text(A_FreeMargin(accountIndex = 0))); print("未成交数:"+text(A_GetOpenOrderCount())); print("对手价:"+text(Q_AskPrice())); if (A_AccountDataExist(A_AccountIndex(A_AccountID())) == True) { print("账户有效"); } k=1; } } 以上代码,用BarStatus() == 2时结果如下: 用BarExistStatus() == 1时: 另外,模拟盘Q_AskPrice()函数取不到值。