等级: 专业版
- 注册:
- 2022-1-11
- 曾用名:
|
1.请帮我看一下我这样将图表交易代码修改成后台交易代码是否正确?
2.后台交易策略怎么做数据回测?为什么我在后台交易策略上点右键回测都没数据出来,包括系统自带的后台策略模型。
图表交易代码//建立头寸
input:ss(1,1,10000,1);
if holding=0 then begin
if 开多条件 then
buy(1,ss,limitr,open);
end
if holding=0 then begin
if 开空条件 then
buyshort(1,ss,limitr,open);
end
//统计出场和止损的次数
variable:n1=0,n2=0,entry=0;
//止损2个atr
if holding>0 and low<enterprice-2*entry and holding>0 then
begin
sell(1,holding,marketr);
n1:=n1+1;
end
if holding<0 and high>enterprice+2*entry and holding<0 then
begin
sellshort(1,holding,marketr);
n1:=n1+1;
end
//破短期高低位,平仓出场
//INPUT:Y(10,1,100,5);
Y周期高点:=REF(HHV(H,20),1);
Y周期低点:=REF(LLV(L,20),1);
if low<Y周期低点 and holding>0 then
begin
止损:=sell(1,holding,marketr);
n2:=n2;
end
if high>Y周期高点 and holding<0 then
begin
止损:=sellshort(1,holding,marketr);
n2:=n2;
end
//止损条件止损
if holding>0 then begin
if time>=closetime(0) or 平多条件 then
sell(1,holding,limitr,close);
end
if holding<0 then begin
if time>=closetime(0) or 平空条件 then
sellshort(1,holding,limitr,close);
end
盈亏:asset,noaxis,coloryellow,linethick1;
修改成后台交易代码
//建立头寸
input:ss(1,1,10000,1);
if tholding=0 then begin
if 开多条件 then
tbuy(1,ss,lmt,open);
end
if tholding=0 then begin
if 开空条件 then
tbuyshort(1,ss,lmt,open);
end
//统计出场和止损的次数
variable:n1=0,n2=0,entry=0;
//止损2个atr
if tholding>0 and low<tenterprice-2*entry and tholding>0 then
begin
tsell(1,tholding,mkt);
n1:=n1+1;
end
if tholding<0 and high>tenterprice+2*entry and tholding<0 then
begin
tsellshort(1,tholding,mkt);
n1:=n1+1;
end
//破短期高低位,平仓出场
//INPUT:Y(10,1,100,5);
Y周期高点:=REF(HHV(H,20),1);
Y周期低点:=REF(LLV(L,20),1);
if low<Y周期低点 and tholding>0 then
begin
止损:=tsell(1,tholding,mkt);
n2:=n2;
end
if high>Y周期高点 and tholding<0 then
begin
止损:=tsellshort(1,tholding,mkt);
n2:=n2;
end
//止损条件止损
if tholding>0 then begin
if time>=closetime(0) or 平多条件 then
tsell(1,tholding,lmt,close);
end
if tholding<0 then begin
if time>=closetime(0) or 平空条件 then
tsellshort(1,tholding,lmt,close);
end
盈亏:tasset,noaxis,coloryellow,linethick1;
|
|