Testreport中PEL引用出錯!
作者:金字塔 來源:cxh99.com 發(fā)布時間:2018年02月24日
-
咨詢內(nèi)容:
在Testreport中嘗試使用Pel指標引用,但是測試結(jié)果中間漏掉了數(shù)據(jù),換品種,換代碼(樣板代碼)都是一樣的結(jié)果,請問是為什么?
一、引用指標代碼(al1)
m2:ma(close,20);
mr:cross(close,m2);mc:cross(m2,close);
buy(mr and holding=0,100%,market);sell(mc and holding>0,0,thisclose);
二、Testreport代碼
sub ReportTest()
'//////設置測試參數(shù)
Testreport.StartAndInitTestreport.InitCash=100*10000Testreport.ReportType=0MarketData.HistoryDataMode=0Testreport.OpenLossPrice=1Testreport.CloseLossPrice=1Testreport.ODDLOTSMode=1Testreport.CLOSEPOSMODE=1
'//////數(shù)據(jù)準備
set F1=MarketData.STKINDI("300059","SZ","al1",0,5)Set His0=Marketdata.GetHistoryData("300059","SZ",5)call Testreport.AddTestStock(His0,"300059","SZ",0)
Dim Data0Set Data0=CreateObject("Stock.Array")
Dim Vlvl=0
'/////K線循環(huán)
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.ClearMsgReportTest
End Sub
三、測試明細
此主題相關圖片如下:snap1.jpg
?
?來源: CXH99.COM
-
金字塔客服:
補充:不引用Pel指標就沒有出錯!
?
-
用戶回復:
工具-選項-維護
內(nèi)存保留數(shù)量,這里設置大一些比如10000然后再試下看呢
?
-
網(wǎng)友回復:
這種情況一般是你引用的品種的周期缺失歷史數(shù)據(jù)導致的。
你可以做一些調(diào)試工作,將引用的指標線單獨打印出來,看一下引用結(jié)果
?
-
網(wǎng)友回復:
試了,后面的日期有了,但測試結(jié)果明顯不對!
Application.MsgOut F1.GetBufDateData(i) & "|" &Testreport.ASSET & "|" & F1.GetBufData("MR",i) & "-" & F1.GetBufData("MC",i)
我加了這么一行代碼,顯示指標的歷史數(shù)據(jù)到2014年5月16日就沒有了。。
不過應該也不是歷史數(shù)據(jù)缺失,因為直接用Pel測試是好的,奇怪了,什么設置有問題呢?
此主題相關圖片如下:snap2.jpg