测试第二步的测试时间段 对应这个时间段对应周期的历史数据补充下。
工具-》数据补充里手工补充
1,时间段选择是否正确?另外把指标放到K线主图上,看看信号情况是否与历史回测匹配
金字塔老师,我是把TB的程序编辑过来的,测试后发现两者结果相差很大,虽然参数是相同的,请帮我看一下我改编的是不是有问题:
TB程序如下:Params
Numeric M1(0.27);
Numeric M2(0.25);
Numeric LOTS(1);
Numeric Length1(4);
Numeric Length2(32);
Vars
NumericSeries upline;
NumericSeries downline;
Numeric spread;
NumericSeries OPENP;
NumericSeries MA1;
NumericSeries MA2;
Begin
MA1=Average(Close, Length1);
MA2=Average(Close, Length2);
spread=Max(CloseD(1)*0.008,Max(HighD(1)-CloseD(1),CloseD(1)-LowD(1)));
OPENP=OpenD(0);
upline=Max(Highest(h[1],3),OPENP+M1*spread);
downline=Min(Lowest(l[1],3),OPENP-M2*spread);
PlotNumeric("upline",upline);
PlotNumeric("downline",downline);
PlotNumeric("MA1",MA1);
PlotNumeric("MA2",MA2);
//开仓部分
if(Time>0.0900 )
{
If(MarketPosition == 0)
{
If(h>=upline )
{
If(ma1>ma2 )
{
Buy(LOTS,upline);
}
}
}
If(MarketPosition == 1)
{
If(l<=downline)
{
If(ma1<ma2 )
{if( Date>LastEntryDate) Sell(LOTS,downline);
}
}
}
}
End
我改编后金字塔程序如下:
INPUT:N1(4,1,21,,1),N2(32,5,34,1),M1(0.27,0.1,0.5,0.01),M2(0.25,0.1,0.5,0.01),ss(1,0,100000000,1);//参数值
昨高:=CALLSTOCK(STKLABEL,VTHIGH,6,-1);//昨高
昨低:=CALLSTOCK(STKLABEL,VTLOW,6,-1);//昨低
昨收:=CALLSTOCK(STKLABEL,VTCLOSE,6,-1);//昨收
今日开盘价:=Valuewhen(date<>ref(date,1),open);
S1:=max(昨收-昨低,昨高-昨收);//中间变量
S:=max(昨收*0.008,S1);//中间变量
上轨:max(HHV(HIGH,3),今日开盘价+M1*S);//求上轨
下轨:min(LLV(LOW,3),今日开盘价-M2*S);//求下轨
短期均线:ma(CLOSE,N1);//求短期均线
长期均线:ma(CLOSE,N2);//求长期均线
手数:=SS;
//条件
开仓条件:=high>=上轨 and 短期均线 > 长期均线;//开多条件:
平仓条件:=low<=下轨 and 短期均线 < 长期均线;//平仓条件
//交易系统
IF TIME>090000 AND HOLDING = 0 THEN BEGIN
开多:=BUY(开仓条件 ,手数,MARKET);
开仓日期:=date;
END
IF date>valuewhen(开仓条件,date) AND HOLDING > 0 THEN BEGIN
平仓:=sell(平仓条件 ,手数,MARKET);
END
请老师帮我看一下,我改编的对不对?
1,tb代码里面涵括自定义函数部分把?提供下交易思想让工作人员给您看看哦