if not hangqing is nothing then
ctp=Order.StockType(symbol,matketID)
if ctp=1 then
strDate = Cstr(hangqing.Date)
'test_tuoke_Label5.caption = strDate
dim num
dim orderid
dim ConSign
dim Filled
dim R1
dim Action
dim OrderType
dim LmtPrice
dim Account
dim Kaiping
num = Order.OrderInfoByCode2(hangqing.Label,hangqing.marketName, orderid, ConSign, Filled, R1, Action, OrderType, LmtPrice, Account, Kaiping)
application.MsgOut num
if num > 1 then
if lastOrderID = orderid then
CancelCount = CancelCount + 1
else
CancelCount = 0
lastOrderID = orderid
end if
if (CancelCount > 2) then
call Document.DebugFile("D:\OrderLog.Txt", "CancelOrder:%.2f",orderid )
call Order.CancelOrder(orderid)
CancelCount = 0
end if
end if
if CountIndex > 5 then
dim BuyHoding
dim BuyTodayHoding
dim SellHoding
dim SellTodayHoding
dim BuyCost
dim SellCost
dim PNL
Dim UseMargin
call Order.HoldingInfoByCode2(hangqing.label,hangqing.marketname,BuyHoding,BuyCost,BuyTodayHoding,SellHoding,SellCost,SellTodayHoding,PNL,UseMargin)
if BuyHoding > 0 then
application.MsgOut hangqing.LowerLimitPrice
application.MsgOut hangqing.NewPrice
msg = "Sell= " & hangqing.LowerLimitPrice
msg = msg & " BuyHoding=" & BuyHoding
msg = msg & " num= " & num
call Document.DebugFile("D:\OrderLog.Txt", msg,1)
call Order.Sell(0,BuyHoding,hangqing.LowerLimitPrice,0,hangqing.label,hangqing.marketname,"",0)
CountIndex = 0
end if
end if
txt = " Buy= " & hangqing.UpperLimitPrice
call Document.DebugFile("D:\OrderLog.Txt", txt, 1)
call Order.Buy(0,lots,hangqing.UpperLimitPrice,0,hangqing.label,hangqing.marketname,"",0)
CountIndex = CountIndex + 1
elseif ctp=0 then
msgbox "IB账户不支持交易"
end if
end if
2楼的代码直接下单,3楼的代码就会弹出一楼的提示。
是在搞不懂这连个代码有什么区别。
注销部分是撤单的部分,应该不影响。
这个和交易时段没关系,两段代码今天一直是这个情况。
Buy 方法
开多操作
Buy(Type,Vol,Price,StoplmtPrice,Code,Market,AccountID,Valid)
Type 委托类型,分别可为 0限价 1市价 2停损 3限价停损
Vol 委托数量
Price 委托价格,当Type为2和3时为停损价格
StoplmtPrice 停损限价,当Type为3时必须指定停损限价
Code 品种代码,如 "600215"
Market 品种市场,如"SH"表示上海市场
AccountID 指定帐户,为空表示当前帐户
Valid 为1表示下单时弹出确认对话框,为0表示直接下单到服务器
谢谢!看到了。