Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]为什么设置到全局变量的主力合约代码为空

1楼
jinze 发表于:2012/11/4 11:48:44
 Sub Test()
 
 Dim MaxCode
 Dim MaxVolume
 
 '得到市场所有品种
 Count = MarketData.GetReportCount("ZQ")
 
 For i = 0 To Count-1
  Set Report1 = MarketData.GetReportDataByIndex("ZQ",i)
  '只处理SR合约
  if Left(Report1.Label,2) = "SR" Then
   '只处理有效合约
   if Right(Report1.Label,2) >= "01" And Right(Report1.Label,2) <= "12" Then
    If Report1.Volume > MaxVolume Then
     MaxCode = Report1.Label
     MaxVolume = Report1.Volume
    End if
   end if
  End if
 Next
 
 '显示成交量最大得合约
 MsgBox MaxCode
 CALL Document.SetExtString("code_zl",MarCode)
End Sub
消息显示主力合约筛选成功,但全局变量为空字符串。
2楼
admin 发表于:2012/11/4 17:39:41

为空表示代码有问题,初步发现你有个笔误

CALL Document.SetExtString("code_zl",MarCode)

共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.02734 s, 2 queries.