金字塔获取主力合约最简单的VBA代码[金字塔模型]
- 内容:
		'本过程需要两个参数 '1.sMarketCode市场代码,如中金所是ZJ,上期所SQ,郑商所ZQ,大连所DQ '2.sStockPre品种代码的前缀,如股指IF,螺纹钢RB等,就是合约代码的符号,不要月份。 '调用方法:GetContractCode 'ZJ','IF' '返回股指期货的主力合约 '调用上述过程之后,ZhuLiCode就保存了主力合约的代码 '本方法是通过判断那个合约的成交量与连续合约的成交量相等的方式来判断主力合约的,跟金字塔内部的方式一致。 public ZhuLiCode '主力合约代码 Sub GetContractCode(sMarketCode,sStockPre) '根据市场编码取得主力合约编码 
 If sMarketCode="" then
 sMarketCode="ZJ"
 End if
 
 n = marketdata.GetReportCount(sMarketCode)
 
 For j = 0 To n - 1
 Set report1 = marketdata.GetReportDataByIndex(sMarketCode, j)
 suffixlabel = Right(report1.Label, 2)
 If sStockPre=left(report1.Label,len(sStockPre)) then
 If suffixlabel = "00" Then
 ZhuLiVol=report1.volume
 End If
 
 If cdbl(suffixlabel) >= 1 And cdbl(suffixlabel) <= 12 Then
 If report1.volume = ZhuLiVol Then
 ZhuLiCode = report1.Label
 'application.MsgOut ZhuLiCode
 exit for
 End If
 End If
 End if
 Next
 End Sub
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 262069696  进行 有偿 编写!(不贵!点击查看价格!)
                    
相关文章
- 
                        没有相关内容
                       

 
                     会员登录/注册
会员登录/注册