以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 高级功能研发区 (http://www.weistock.com/bbs/list.asp?boardid=5) ---- Testreport中PEL引用出错! (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=159515) |
-- 作者:15601951291 -- 发布时间:2017/11/14 11:31:56 -- Testreport中PEL引用出错! 在Testreport中尝试使用Pel指标引用,但是测试结果中间漏掉了数据,换品种,换代码(样板代码)都是一样的结果,请问是为什么? 一、引用指标代码(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() \'//////设置测试参数 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 三、测试明细 |
-- 作者:15601951291 -- 发布时间:2017/11/14 11:40:02 -- 补充:不引用Pel指标就没有出错! |
-- 作者:yukizzc -- 发布时间:2017/11/14 12:50:09 -- 工具-选项-维护 内存保留数量,这里设置大一些比如10000然后再试下看呢 |
-- 作者:无为剑 -- 发布时间:2017/11/14 13:17:21 -- 这种情况一般是你引用的品种的周期缺失历史数据导致的。 你可以做一些调试工作,将引用的指标线单独打印出来,看一下引用结果 |
-- 作者:15601951291 -- 发布时间:2017/11/14 13:40:58 -- 试了,后面的日期有了,但测试结果明显不对! Application.MsgOut F1.GetBufDateData(i) & "|" &Testreport.ASSET & "|" & F1.GetBufData("MR",i) & "-" & F1.GetBufData("MC",i)我加了这么一行代码,显示指标的历史数据到2014年5月16日就没有了。。 不过应该也不是历史数据缺失,因为直接用Pel测试是好的,奇怪了,什么设置有问题呢?
|
-- 作者:无为剑 -- 发布时间:2017/11/14 13:45:22 -- 单独打印一下 Set His0=Marketdata.GetHistoryData("300059","SZ",5) 这个对象的数据看看是否有缺失 将 al1 指标加载到 300059 的k线图上看一下是否正常显示 将 al1 改到系统自带的MA均线指标调试一下看看是否有正常输出 |
-- 作者:15601951291 -- 发布时间:2017/11/14 13:49:18 -- 我发现问题了:主要是因为有历史数据1000根的限制引起的! 引用指标可以用1000根,但是是从2010年开始的,而maketdata的1000根是从后面算起的,两者不匹配。
|
-- 作者:15601951291 -- 发布时间:2017/11/14 13:50:33 -- 有没有办法可以让他们匹配起来?目前是标准版,暂时不想升级,后面可能考虑,1000根至少要可以匹配起来才可以使用。 |
-- 作者:15601951291 -- 发布时间:2017/11/14 13:54:37 -- 测试了,His0这个数据是正常的 指标单独显示在图表上也都是正常的
[此贴子已经被作者于2017/11/14 13:55:29编辑过]
|
-- 作者:无为剑 -- 发布时间:2017/11/14 14:46:01 -- 将 al1 改到系统自带的MA均线指标调试一下看看是否有正常输出 |