委托数量错误
老师好,我在实盘模拟的时候,交易助手一直提示委托数量错误,不知哪里的问题,以下为代码。Numeric money;//开仓资金 Numeric myprice;//委托价格 Numeric mrate;//委托价格 Numeric lmrate;//委托价格 Numeric smrate;//委托价格 Numeric lotsl;//委托数量 Numeric lotss;//委托数量 Numeric mylentry;//委托数量 Numeric mysentry;//委托数量 Numeric lposition;//多头持仓量 Numeric sposition;//空头持仓量OnReady() { SetBackBarMaxCount(1+Max(SlowLength,Length)); MarginRate mRate;//获取账户对应合约的保证金率 A_GetMarginRate(relativeSymbol, mRate); lmrate = mRate.longMarginRatio; smrate = mRate.shortMarginRatio; Position pos;//获取指定合约当前仓位 A_GetPosition(relativeSymbol, pos, \"\"); lposition = pos.longCurrentVolume; sposition = pos.shortCurrentVolume; }OnBar(ArrayRef<Integer> indexs) { money = A_CurrentEquity * 0.1;//按总风险度的20% myprice = Open;//这里使用open,更为精确的是使用委托价格 lotsl = IntPart(money/(myprice*contractunit*BigPointValue* lmrate)); //计算开仓手数 mylentry = Max(1,lotsl); Range[0:0] { If( lposition == 0 && close[1] < open)//举个简单例子 { Array<Integer> orderids; A_Buy(RelativeSymbol,mylentry, Q_askPrice(), orderids,\"\",\"\"); } } }