//------------------------------------------------------------------------
// 简称: WTFS
// 名称: 集合竞价自选合约交替挂20/30价格
//------------------------------------------------------------------------
Params
Numeric millsecs(500);
Numeric OrderLots(1);
Vars
Global Integer timerId;
Global Bool IsOrderDone(False);
Events
OnInit()
{
timerId = createTimer(millsecs);
IsOrderDone = False;
}
OnTimer(Integer id,Integer intervalMillsecs)
{
If(IsOrderDone == True) Return;
Integer curHour = Hour();
Integer curMin = Minute();
If(curHour == 8 And curMin >= 55 And curMin <= 59)
{
Integer i;
Numeric orderPrice;
For i = 0 To DataCount-1
{
// 核心:交替挂 20 / 30
If(i % 2 == 0)
{
orderPrice = 20;
}
Else
{
orderPrice = 30;
}
// 每个合约只挂一个价格
Buy(OrderLots, orderPrice, i);
SellShort(OrderLots, orderPrice, i);
}
IsOrderDone = True;
}
}
OnExit()
{
}
//------------------------------------------------------------------------各位老师好,昨天刚开通TB3,想随机测试下集合竞价委托,但程序通过了,交易中一直不显示委托,不知道什么原因,非常感谢
