集合竞价下单

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

请问如何集合竞价下单?
如何实现在集合竞价时间内自动下单
集合竞价时间可以发单吗?
要在夜盘20:55-20:59集合竞价这段时间,通过程序下单,应该用哪个函数呢?
要在夜盘20:55-20:59集合竞价这段时间,通过程序下单,应该用哪个函数呢?
过滤集合竞价
股票集合竞价
集合竞价自动过滤
tick图怎样不显示集合竞价?
在集合竞价阶段,能定时器发送委托单,能不能buy函数?

data-href=

今晚我看了一下模拟交易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+\"获取当前仓位不成功\");

}

}

}

}

郑商所的品种没问题,大商所上期所的不发单

这只是查询 你怎么下单的