'買(mǎi)入條件量比你可以直接用股票池選股選出來(lái)然后放到自選股分類的TEST板塊中去,然后用下面vba程序去做買(mǎi)入動(dòng)作
dim num
'每只股票投入資金量
dim money
money = 100000
'最大持有股票數(shù)量
dim max_holding
max_holding = 10
Set b = CreateObject("Stock.Block")
call b.open("TEST",1)
'第一個(gè)計(jì)時(shí)器建立頭寸
call application.SetTimer(0,5000)
'第二個(gè)計(jì)時(shí)器10秒發(fā)單,直到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
買(mǎi)入條件量比你可以直接用股票池選股選出來(lái)然后放到自選股分類的TEST板塊中去,你這句等于是我要手動(dòng)添加股票嗎,而且你們VBA怎么去監(jiān)控股票池我不知道