以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  高级功能研发区  (http://weistock.com/bbs/list.asp?boardid=5)
----  [求助]帮我看下这段代码有什么毛病...  (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=25179)

--  作者:bbking
--  发布时间:2012/9/3 13:12:58
--  [求助]帮我看下这段代码有什么毛病...

Sub ORDER_OrderStatusEx2(OrderID, Status, Filled, Remaining, Price, Code, Market, OrderType, Aspect, Kaiping, Account, AccountType)
 
dim acfl1
acfl1="800007"\'跟踪帐户
if Status="Tradeing" and filled>0 and Account=acfl1 and code="if09" then
 
if aspect=0 then

call Document.SetExtData("ACFL1_thold_if",document.GetExtData("ACFL1_thold_if")+filled)
end if
 
if aspect=1 then
  
call Document.SetExtData("ACFL1_thold_if",document.GetExtData("ACFL1_thold_if")-filled)
end if
 
end if

End Sub

 

=====================

买入N手外生全局变量就加上N手

卖出N手外生全局变量就减去N手~

但是无论我怎么操作那个ACFL1_thold_if还是等于0...

[此贴子已经被作者于2012-9-3 13:21:17编辑过]

--  作者:guotx2010
--  发布时间:2012/9/3 15:05:33
--  

if aspect=0 then 你想表示的是买入开仓,可是买入平仓也会成立的,所以应该加上kaiping的判断吧

if aspect=0 and kaiping=0 then

 


--  作者:bbking
--  发布时间:2012/9/3 15:54:09
--  
以下是引用guotx2010在2012-9-3 15:05:33的发言:

if aspect=0 then 你想表示的是买入开仓,可是买入平仓也会成立的,所以应该加上kaiping的判断吧

if aspect=0 and kaiping=0 then

 

这个无所谓开平~

只要是买入1手那个全局变量就+1

卖出就-1

但是我这段代码ACFL1_thold_if一直等于0~

我有点不明白


--  作者:guotx2010
--  发布时间:2012/9/3 17:01:16
--  
那你使用application.msgout输出信息,看看代码走到了没有?
--  作者:rushtaotao
--  发布时间:2012/9/4 10:28:38
--  

if Status="Tradeing" and filled>0 then
测试了一下  总觉得你这句话有问题 你用这句话 替换你第一句if语句

我替换了一下 就可以了  主要的问题是 第一句if没执行