Function mxcc(Formula)
mxcc=0
Set Grid = Technic.GetGridByName("Main")
Set Market = grid.GetMarketinfo()
sc = market.id
'得到该窗格所对应的动态行情对象
Set ReportData = Grid.GetReportData()
Label = ReportData.Label
lab = Left(Label,2)
'得到市场所有品种
Count = MarketData.GetReportCount(sc)
For i = 0 To Count-1
Set Report1 = MarketData.GetReportDataByIndex(sc,i)
if Left(Report1.Label,2) = lab Then
if Right(Report1.Label,2) >= "01" And Right(Report1.Label,2) <= "12" Then
If Report1.Volume >0 Then
mxcc = mxcc+Report1.Volume
End if
end if
End if
Next
End Function
公式中调用这个函数,没有数据显示
你需要显示什么
想算出对应品种所有合约的持仓量之和。
我的想法是这样的
1、通过获得目前合约的代码和该品种所在市场的代码
2、在该市场寻找符合条件的该品种所有合约
3、将这个品种的每个合约的持仓量相加
4、最后返回这个持仓量之和。
达到可以调用该品种的持仓量,共投资参考。