sub ReportTest()
'//////设置测试参数
Testreport.StartAndInit
Testreport.InitCash=100*10000
Testreport.ReportType=0
MarketData.HistoryDataMode=0
Testreport.OpenLossPrice=1
Testreport.CloseLossPrice=1
Testreport.ODDLOTSMode=1
Testreport.CLOSEPOSMODE=1
'//////数据准备
set F1=MarketData.STKINDI("300059","SZ","al1",0,5)
Set His0=Marketdata.GetHistoryData("300059","SZ",5)
call Testreport.AddTestStock(His0,"300059","SZ",0)
Dim Data0
Set Data0=CreateObject("Stock.Array")
Dim Vl
vl=0
'/////K线循环
for i=0 to His0.Count-1
if i<=His0.Count-2 then
vl=int(Testreport.Cash(0)/(100*His0.open(i+1)))
else
vl=int(Testreport.Cash(0)/(100*His0.close(i)))
end if
if F1.GetBufData("MR",i) then
if Testreport.Holding=0 then
Testreport.Buy vl*100,His0.Open(i+1)
end if
end if
if F1.GetBufData("MC",i) then
if Testreport.Holding>0 then
Testreport.sell 0,His0.close(i)
end if
end if
if i=His0.Count-1 then
if Testreport.Holding>0 then
Testreport.sell 0,His0.close(i)
end if
end if
Application.MsgOut Testreport.ASSET
Testreport.StepIt i
next
set His0=nothing
Testreport.ShowReport
MarketData.DestroyHistoryData
end sub
Sub APPLICATION_VBAStart()
Application.ClearMsg
ReportTest
End Sub