以下内容为程序代码:
1 Sub ORDER_OrderStatusEx2(OrderID, Status, Filled, Remaining, Price, Code, Market, OrderType, Aspect, Kaiping, Account, AccountType)
2
3 if Status="Tradeing" and filled>0 and Account="00545" and (StrComp(left(Code,2),"IC")=0 or StrComp(left(Code,2),"IF")=0) then'只跟IC
4 'if Status="Tradeing" and filled>0 and Account="00545" and StrComp(Code,"IC06")<>0 then
5 'if Status="Tradeing" and filled>0 and Account="00545" then
6 Call Order.HoldingInfoByCode2(Code, Market, BuyHoding_1, BuyCost_1, BuyTodayHoding_1, SellHoding_1, SellCost_1, SellTodayHoding_1, PNL_1, UseMargin_1,Account)
7 Call Order.HoldingInfoByCode2(Code, Market, BuyHoding_2, BuyCost_2, BuyTodayHoding_2, SellHoding_2, SellCost_2, SellTodayHoding_2, PNL_2, UseMargin_2,"01306")
8 if round(BuyHoding_1*0.51)>BuyHoding_2 then order.Buy 1,round(BuyHoding_1*0.51)-BuyHoding_2,0,0,code,market,"01306",0
9 if round(BuyHoding_1*0.51)<BuyHoding_2 then order.Sell 1,BuyHoding_2-round(BuyHoding_1*0.51),0,0,code,market,"01306",0
10 if round(SellHoding_1*0.51)>SellHoding_2 then order.Buyshort 1,round(SellHoding_1*0.51)-SellHoding_2,0,0,code,market,"01306",0
11 if round(SellHoding_1*0.51)<SellHoding_2 then order.sellshort 1,SellHoding_2-round(SellHoding_1*0.51),0,0,code,market,"01306",0
12 end if
13 '
14 'if Status="Tradeing" and filled>0 and Account="01306" then
15 'Call Order.HoldingInfoByCode2(Code, Market, BuyHoding_1, BuyCost_1, BuyTodayHoding_1, SellHoding_1, SellCost_1, SellTodayHoding_1, PNL_1, UseMargin_1,"00545")
16 'Call Order.HoldingInfoByCode2(Code, Market, BuyHoding_2, BuyCost_2, BuyTodayHoding_2, SellHoding_2, SellCost_2, SellTodayHoding_2, PNL_2, UseMargin_2,"01306")
17 'if round(BuyHoding_1*0.51)>BuyHoding_2 then order.Buy 1,round(BuyHoding_1*0.51)-BuyHoding_2,0,0,code,market,"01306",0
18 'if round(BuyHoding_1*0.51)<BuyHoding_2 then order.Sell 1,BuyHoding_2-round(BuyHoding_1*0.51),0,0,code,market,"01306",0
19 'if round(SellHoding_1*0.51)>SellHoding_2 then order.Buyshort 1,round(SellHoding_1*0.51)-SellHoding_2,0,0,code,market,"01306",0
20 'if round(SellHoding_1*0.51)<SellHoding_2 then order.sellshort 1,SellHoding_2-round(SellHoding_1*0.51),0,0,code,market,"01306",0
21 'end if
22 '
23
24 End Sub
原版代码~你们自己改一下帐号
我测试了我的调试机上没问题
实盘机器上不知道为啥有问题
调试机上是32位版本~win7操作系统
实盘机上也是32位版本~
Windows Server 2003 企业版
[此贴子已经被作者于2015/6/15 11:19:51编辑过]
你可以调试一下,在出现溢出的那一行代码上,将所有用到的变量都打印出来,怀疑是里面有无效值导致的计算溢出