Rss & SiteMap

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

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

标题:最大持有股票数不得超过20个的股票策略

1楼
jinzhe 发表于:2016/10/31 16:51:03
1.最大持有股票数20
2.所有股票等权重买入,并且每10s发一次单,每单为卖一量的50%
3.买入条件为量比大于2小于3
2楼
王锋 发表于:2016/10/31 18:14:25
已经安排工作人员帮你编写范例,由于使用VBA进行开发,所有需要一点时间,请耐心关注本帖回复
3楼
yangze0927 发表于:2016/11/1 10:13:35
要多久呀
4楼
yukizzc 发表于:2016/11/1 11:20:37

'买入条件量比你可以直接用股票池选股选出来然后放到自选股分类的TEST板块中去,然后用下面vba程序去做买入动作

 

dim num

'每只股票投入资金量
dim money
money = 100000

'最大持有股票数量
dim max_holding
max_holding = 10


Set b = CreateObject("Stock.Block")

call b.open("TEST",1)

 

'第一个计时器建立头寸

call application.SetTimer(0,5000)

 

'第二个计时器10秒发单,直到money市值
call application.SetTimer(1,10000)

 


 

Sub APPLICATION_Timer(ID)

if ID = 0 then

 for i = 0 to b.count-1
  buynum = marketdata.GetReportData(b.GetStockCode(i),b.GetStockMarket(i)).SellVolume1*0.5
  Result = Order.HoldingInfoByCode2(b.GetStockCode(i),b.GetStockMarket(i),BuyHolding,BuyCost,BuyTodayHolding,SellHolding,SellCost,SellTodayHolding,PNL,UseMargin,"")
  cond_first = BuyHolding<1 and Result <>1
  if num+order.Holding2 + order.OrderNum2 <=max_holding and cond_first  then
   num = num+1
   call order.buy(1,buynum,0,0,b.GetStockCode(i),b.GetStockMarket(i),"",0)
  end if
 next
end if


if ID = 1 then
 for i = 0 to order.Holding2-1
 Result = Order.HoldingInfo2(i,BuyHolding,BuyCost,BuyTodayHolding,SellHolding,SellCost,SellTodayHolding,PNL,UseMargin ,Code,Market)
 buynum = marketdata.GetReportData(Code,Market).SellVolume1*0.5
 price = marketdata.GetReportData(Code,Market).NewPrice
  if BuyHolding<money/price then
   call order.buy(1,buynum,0,0,Code,Market,"",0)
  end if
  next
end if

End Sub


'


Sub APPLICATION_VBAEnd()
call application.KillTimer(0)
call application.KillTimer(1)
set b = nothing
End Sub


Sub APPLICATION_VBAStart()
num = 0
End Sub

5楼
yangze0927 发表于:2016/11/1 12:52:03

买入条件量比你可以直接用股票池选股选出来然后放到自选股分类的TEST板块中去,你这句等于是我要手动添加股票吗,而且你们VBA怎么去监控股票池我不知道

 

6楼
yangze0927 发表于:2016/11/1 12:53:56
你们后台交易可以选择监控的股票池,但是VBA我不知怎么去监控
7楼
yukizzc 发表于:2016/11/1 13:06:00

利用股票池选股后添加到板块中去,vba代码去对这个板块进行循环遍历就行了。

本例是利用股票池和vba结合的使用,简化算法代码

8楼
yangze0927 发表于:2016/11/1 13:08:33
怎么利用股票池选股后添加到板块中去
9楼
yukizzc 发表于:2016/11/1 13:39:09

工具-市场与板块,这边对应分类下的新建一个板块做保存。我这边例子是新建test的板块名


图片点击可在新窗口打开查看此主题相关图片如下:%i2c_f`h$txy%%4ul28{1.png
图片点击可在新窗口打开查看

10楼
yangze0927 发表于:2016/11/1 14:30:33

我用你们的程序买股票结果买了11只不是10只

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


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