集合竞价下单

模拟交易集合竞价下单,If(Data[j].Q_Status() == Enum_QStatus_Ocall) 郑商所品种为 true,而上期所 大商所品种不执行下面的代码。

今晚我看了一下模拟交易20点56分Q_Status() 返回值不对,上期所、大商所品种返回8,应该返回2.

If(Data[j].Q_Status() == Enum_QStatus_Ocall) 判断的部分 我可能用currenttime你定时器跨度那么大,那你应该输出current时间和Q_Status,看看是错过了 还是条件没进去

TIMEID1 = CreateTimer(86400000,0.205600);//开盘前2分钟 TIMEID2 = CreateTimer(86400000,0.085800);//开盘前2分钟 TIMEID3 = CreateTimer(86400000,0.091300);//开盘前2分钟 TIMEID4 = CreateTimer(86400000,0.092800);//开盘前2分钟 TIMEID5 = CreateTimer(86400000,0.145500);//收盘前5分 TIMEID6 = CreateTimer(86400000,0.151300);//收盘前5分 OnTimer(Integer id,Integer millsecs) { Integer j; Numeric lots;//开仓手数 Position Position1;//Position结构体 print(DateToString(currentdate)+\" \"+TimeToString(CurrentTime));//输出当前日期和时间 //上跟K线收盘未成交的集合竞价发单 For j = 0 To DataSourceSize()-1 { If(Mod(j,2) == 1) { //开盘前挂单 tradeflg[j] = 0; Data[j].buyflg = 0; Data[j].sellshortflg = 0; Data[j].sellflg = 0; Data[j].buytocoverflg = 0; Bool ret = A_GetPosition(Data[j].Symbol,Position1); If(ret) { longPositionPrice[Data[j].Symbol] = Position1.longAvgPriceO; shortPositionPrice[Data[j].Symbol] = Position1.shortAvgPriceO; Print(Data[j].Symbol); Print(\"多头持仓价格:\"+Text(longPositionPrice[Data[j].Symbol])); Print(\"空头持仓价格:\"+Text(shortPositionPrice[Data[j].Symbol])); If(Data[j].Q_Status() == Enum_QStatus_Ocall) { lots =Value(GetTBProfileString(GetWorkspaceName()+\"_\"+FormulaName+\"_LONGLOTSNUM\",Data[j].Symbol));//理论持仓手数 Print(\"多头实际持仓: \"+Text(Position1.longCurrentVolume)); Print(\"多头理论持仓: \"+Text(lots)); If(lots > 0) //如果理论持仓手数大于0 { If(lots > Position1.longCurrentVolume)//如果多头理论持仓大于实际持仓 { lots = lots - Position1.longCurrentVolume;//开仓手数 Bool Orderret = Data[j].A_SendOrderEx(Data[j].Symbol,Enum_Buy,Enum_Entry,lots,Data[j].Close+minMoveNum*Data[j].minMove*Data[j].PriceScale,ORDERID,\"\",A_GetOrderCreateSource); If(Orderret) SetTBProfileString(GetWorkspaceName()+\"_\"+FormulaName+\"_LONGLOTSNUM\",Data[j].Symbol,Text(0)); } } If(lots == -1) //理论持仓手数=-1,多头平仓信号 { If(Position1.longCurrentVolume > 0)//多头有持仓 { lots = Position1.longCurrentVolume; Bool Orderret = Data[j].A_SendOrderEx(Data[j].Symbol,Enum_Sell,Enum_Exit,lots,Data[j].Close-minMoveNum*Data[j].minMove*Data[j].PriceScale,ORDERID,\"\",A_GetOrderCreateSource); If(Orderret) SetTBProfileString(GetWorkspaceName()+\"_\"+FormulaName+\"_LONGLOTSNUM\",Data[j].Symbol,Text(0)); } If(Position1.longCurrentVolume == 0) SetTBProfileString(GetWorkspaceName()+\"_\"+FormulaName+\"_LONGLOTSNUM\",Data[j].Symbol,Text(0)); } //空头发单 lots =Value(GetTBProfileString(GetWorkspaceName()+\"_\"+FormulaName+\"_SHORTLOTSNUM\",Data[j].Symbol)); Print(\"空头实际持仓 \"+Text(Position1.shortCurrentVolume)); Print(\"空头理论持仓 \"+Text(lots)); If(lots > 0) { If(lots > Position1.shortCurrentVolume) { lots = lots - Position1.shortCurrentVolume; Bool Orderret = Data[j].A_SendOrderEx(Data[j].Symbol,Enum_Sell,Enum_Entry,lots,Data[j].Close-minMoveNum*Data[j].minMove*Data[j].PriceScale,ORDERID,\"\",A_GetOrderCreateSource); If(Orderret) SetTBProfileString(GetWorkspaceName()+\"_\"+FormulaName+\"_SHORTLOTSNUM\",Data[j].Symbol,Text(0)); } } If(lots == -1) { If(Position1.shortCurrentVolume > 0) { lots = Position1.shortCurrentVolume; Bool Orderret = Data[j].A_SendOrderEx(Data[j].Symbol,Enum_Buy,Enum_Exit,lots,Data[j].Close+minMoveNum*Data[j].minMove*Data[j].PriceScale,ORDERID,\"\",A_GetOrderCreateSource); If(Orderret) SetTBProfileString(GetWorkspaceName()+\"_\"+FormulaName+\"_SHORTLOTSNUM\",Data[j].Symbol,Text(0)); } If(Position1.shortCurrentVolume == 0) SetTBProfileString(GetWorkspaceName()+\"_\"+FormulaName+\"_SHORTLOTSNUM\",Data[j].Symbol,Text(0)); } } } Else { PlayWavSound(\"C:WindowsMediaRing01\"); print(Data[j].symbol+\"获取当前仓位不成功\"); } } } }郑商所的品种没问题,大商所上期所的不发单

这只是查询 你怎么下单的