Testreport中PEL引用出錯(cuò)! [金字塔]
-
咨詢內(nèi)容:
在Testreport中嘗試使用Pel指標(biāo)引用,但是測(cè)試結(jié)果中間漏掉了數(shù)據(jù),換品種,換代碼(樣板代碼)都是一樣的結(jié)果,請(qǐng)問是為什么?
一、引用指標(biāo)代碼(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è)置測(cè)試參數(shù)
Testreport.StartAndInitTestreport.InitCash=100*10000Testreport.ReportType=0MarketData.HistoryDataMode=0Testreport.OpenLossPrice=1Testreport.CloseLossPrice=1Testreport.ODDLOTSMode=1Testreport.CLOSEPOSMODE=1
'//////數(shù)據(jù)準(zhǔn)備
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
三、測(cè)試明細(xì)
此主題相關(guān)圖片如下:snap1.jpg?
?來源: CXH99.COM
-
金字塔客服:
補(bǔ)充:不引用Pel指標(biāo)就沒有出錯(cuò)!
?
-
用戶回復(fù):
工具-選項(xiàng)-維護(hù)
內(nèi)存保留數(shù)量,這里設(shè)置大一些比如10000然后再試下看呢
?
-
網(wǎng)友回復(fù):
這種情況一般是你引用的品種的周期缺失歷史數(shù)據(jù)導(dǎo)致的。
你可以做一些調(diào)試工作,將引用的指標(biāo)線單獨(dú)打印出來,看一下引用結(jié)果
?
-
網(wǎng)友回復(fù):
試了,后面的日期有了,但測(cè)試結(jié)果明顯不對(duì)!
Application.MsgOut F1.GetBufDateData(i) & "|" &Testreport.ASSET & "|" & F1.GetBufData("MR",i) & "-" & F1.GetBufData("MC",i)
我加了這么一行代碼,顯示指標(biāo)的歷史數(shù)據(jù)到2014年5月16日就沒有了。。
不過應(yīng)該也不是歷史數(shù)據(jù)缺失,因?yàn)橹苯佑肞el測(cè)試是好的,奇怪了,什么設(shè)置有問題呢?
此主題相關(guān)圖片如下:snap2.jpg
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容