以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]测评完全不对,百思不得其解  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=11687)

--  作者:fengxiaoyong
--  发布时间:2012/5/15 22:08:55
--  [原创]测评完全不对,百思不得其解
今天把TB下收益率还不错的系统移植到金字塔来,但是发现测评交易次数和成功率以及信号完全不对,数据也是补全的,不知道是怎么回事,我把程序贴出来如下,请各位看看,帮我分析一下
图片点击可在新窗口打开查看此主题相关图片如下:1.jpg
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:2.jpg
图片点击可在新窗口打开查看
runmode:0;
input:N1(5),N2(11),InitalStop(0.2),BreakEventStop(0.2),
      TrailingStop(0.5),ntimes(4),everylots(1);
variable:bcrossup :=0;
variable:bcrossdown :=0;    
nshort  : ema((high+low+2*close)/4,n1);
nlong   : ema((hhv(high,n2)+llv(low,n2)),n2)/2;

blongEntryCon : cross(nshort,nlong) and nshort>ref(nshort,1) and nlong>ref(nlong,1);
bshortentrycon :cross(nlong,nshort) and nshort<ref(nshort,1) and nlong<ref(nlong,1);
bReLongCon :=  nshort>ref(nshort,1) and nlong>ref(nlong,1) and nshort>nlong  and high>hhv(HIGH[1],N1) and close>nlong;
bReShortCon := nshort<ref(nshort,1) and nlong<ref(nlong,1) and nshort<nlong  and low<llv(low[1],N1) and close<nlong;
nhighswing :=hhv(high,enterbars);
nLowSwing :=llv(low,enterbars);
if holding>0 then
begin
    stopline :=avgenterprice*(1-InitalStop/100);
    if nhighswing>avgenterprice * (1+BreakEventStop/100) then stopline :=avgenterprice;
    else if StopLine < nHighSwing*(1-TrailingStop/100) then stopline :=nHighSwing*(1-TrailingStop/100);
    else if stopline>=(close+low+2*high)/4 then
    begin
               myprice := stopline;
               if thisclose<myprice then myprice:=thisclose;
               风险平多: sell(holding>0,everylots,myprice);     
    end; 
    if bshortentrycon then    指标平多 : sell(holding>0,everylots,thisclose);

end
if holding<0 then
begin
          StopLine :=avgenterprice*(1+InitalStop/100);//初始止损
          If nLowSwing <= avgenterprice * (1-BreakEventStop/100)  then StopLine := avgenterprice;
          else If StopLine > nLowSwing*(1+TrailingStop/100) then   StopLine := nLowSwing*(1+TrailingStop/100);//// 追踪止损的价位超过保本止损价,止损价随盈利峰值价的上升同步提高
 else If((high+low*2+close)/4 >= StopLine) then
          begin
          MyPrice = StopLine;
          If thisclose < MyPrice  then MyPrice = thisclose;
             风险平空:  sellshort(1 and  holding<0,EveryLots,MyPrice);
 end
     if bLongEntryCon then 指标平空:  sellshort(1 and  holding<0,EveryLots,thisclose);
end
if holding=0 then
begin
  if blongentrycon  then     指标开多仓:buy(1 and holding=0,everylots,thisclose);//(blongentrycon and holding=0,everylots,market);
  if bshortentrycon then     指标开空仓:buyshort(1 and holding=0,everylots,thisclose);//(bshortentrycon and holding=0,everylots,market);
  if brelongcon then  指标继续开多仓:buy(1 and holding=0,everylots,thisclose);//(brelongcon and holding=0 ,everylots,market);
  if bReShortCon then 指标继续开空仓:buyshort(1 and holding=0,everylots,thisclose);//(bReShortCon and holding=0,everylots,market);
end
资产:ASSET,NOAXIS;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;

--  作者:admin
--  发布时间:2012/5/15 22:11:12
--  

在图表上显示的进出场点正常吗?


--  作者:fengxiaoyong
--  发布时间:2012/5/15 23:35:59
--  
图表显示的进出场点是正常的
--  作者:admin
--  发布时间:2012/5/15 23:51:21
--  

仔细检查第一步的周期选择,还有第二步的时间段


--  作者:rushtaotao
--  发布时间:2012/5/16 8:43:42
--  

图片点击可在新窗口打开查看此主题相关图片如下:时间段.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:日期.png
图片点击可在新窗口打开查看
其次就是保证数据完整,还有双向测试还是单向测试,如果信号和TB完全一样,测试结果应该是一样的
--  作者:fengxiaoyong
--  发布时间:2012/5/16 23:02:38
--  
我把数据补齐了周期也选择了但是交易只有一次和tb完全不一样
--  作者:fengxiaoyong
--  发布时间:2012/5/16 23:03:45
--  
谁能实际的帮我解决一下问题代码都贴出来了你们可以自己测试一下
--  作者:antonyxu99
--  发布时间:2012/5/16 23:19:00
--  如何寻找每日开盘到现在的最低价?

我帮人转过无数的tb到金字塔,有一些常见问题需要注意的,比如序列变量和全局变量的差别,金字塔和tb差别很大;

函数的差别——尤其是比如开仓,金字塔不会自动平了开,tb会;还有比如enterbar和entrybar差别,等

你得把tb的代码贴出来我才能给你检查出到底哪儿的问题

[此贴子已经被作者于2012-5-16 23:19:38编辑过]

--  作者:admin
--  发布时间:2012/5/16 23:20:11
--  
我们是没法跟TB比对的,你可以截图上说明,告知你的测试范围参数,以及具体哪笔数据测试结果有问题,正确的应该是怎样,这样我们才能帮你找出问题
--  作者:fengxiaoyong
--  发布时间:2012/5/16 23:25:22
--  
我把代码都贴出来了你们测试出来的数据正常吗