以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  高级功能研发区  (http://weistock.com/bbs/list.asp?boardid=5)
----  [原创]筛选主力合约的宏  (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=4951)

--  作者:z7c9
--  发布时间:2011/1/22 19:41:49
--  [原创]筛选主力合约的宏

以下内容为程序代码:

1 sub getmydominantcontract()
2     dim marketname
3     dim sblock
4     dim contractvol    
5
6     marketname = array("SQ","DQ","ZQ","ZJ")
7     set sblock = createobject("stock.block")
8     
9     for i=0 to ubound(marketname)
10         n=marketdata.GetReportCount(marketname(i))
11         for j=0 to n-1
12             set myreport = marketdata.GetReportDataByIndex(marketname(i),j)
13             suffixlabel = right(myreport.label,2)            
14             if suffixlabel>="01" and suffixlabel<="12" then
15                 if myreport.volume>contractvol then
16                     contractvol=myreport.volume
17                     contractlabel=myreport.label
18                 end if
19             end if            
20             if suffixlabel = "20" then
21                 sblock.addstock marketname(i),contractlabel
22                 contractvol=0
23                 c自选","自设股"    
28 end sub
29

[此贴子已经被作者于2011-1-22 19:47:43编辑过]

--  作者:z7c9
--  发布时间:2011/1/23 14:59:42
--  
以下内容为程序代码:

1 sub getdominantcontract()
2     dim block
3     dim market
4     
5     set block=createobject("stock.block")
6     
7     block.open "自设股",1
8     
9     for i=0 to block.count-1
10         block.removeat(0)
11     next    
12     
13     market=array("SQ","DQ","ZQ","ZJ")
14     c"
16     contractvolume=0
17     
18     for i=0 to ubound(market)
19         n=marketdata.GetReportCount(market(i))
20         for j=0 to n-1
21             set report1=marketdata.GetReportDataByIndex(market(i),j)
22             suffixlabel=right(report1.label,2)
23             
24             if suffixlabel="00" then
25                 block.addstock contractmarket,contractlabel
26                 c"
28                 contractvolume=0
29             end if
30             
31             if suffixlabel>="01" and suffixlabel<="12" then
32                 if report1.volume>contractvolume then
33                     contractlabel=report1.label
34                     contractmarket=market(i)
35                     contractvolume=report1.volume
36                 end if
37             end if
38         next
39     next
40     
41     block.addstock contractmarket,contractlabel
42     block.tosave "自选","自设股"
43     msgbox "完成筛选主力合约"
44 end sub

--  作者:淡定688
--  发布时间:2011/2/28 22:28:39
--  

谢谢!分享!


--  作者:fisher
--  发布时间:2012/5/12 13:34:43
--  

这个该怎么用?

 

还真不会,指点指点?


--  作者:MEIYU
--  发布时间:2012/5/18 8:13:24
--  
具体如何建立一个宏呢?能用一个视频具体说明一下吗?或者有什么具体的教程没有?
--  作者:admin
--  发布时间:2012/5/18 9:15:07
--  
 

时间:2010-04-22

金字塔VBA编程教程

http://v.youku.com/v_show/id_XMTY3MjE1NjY0.html