//策略:菲阿里四价
//周期:日内
//类别:趋势突破
昨天高点、昨天低点、昨日收盘价、今天开盘价,可并称为菲阿里四价。它由日本期货冠军菲阿里实盘采用的主要突破交易参照系。
主要特点:
日内交易策略,收盘平仓;
菲阿里四价指昨日高点、昨日低点、昨日收盘、今日开盘;
上轨=昨日高点;
下轨=昨日低点;
用法:
当价格突破上轨,买入开仓;
当价格跌穿下轨,卖出开仓。
//策略:菲阿里四价
//周期:日内
//类别:趋势突破
//修订时间:2012.11.1
//Designed By Rogarz
//原版
//准备中间变量
input:ss(1,1,100,1);
昨高:=callstock(stklabel,vthigh,6,-1);//昨高
昨低:=callstock(stklabel,vtlow,6,-1);//昨低
昨收:=callstock(stklabel,vtclose,6,-1);//昨收
上轨:昨高;
下轨:昨低;
手数:=ss;
//条件
开多条件:=c>上轨;
开空条件:=c<下轨;
//交易系统
if time>090000 and time<145000then begin
开多:buy(开多条件 and holding=0,手数,market);
开空:buyshort(开空条件 and holding=0,手数,market);
end
if time>=145000 then BEGIN
收盘平多:sell(1,手数,market);
收盘平空:sellshort(1,手数,market);
end
################################################################################################
//策略:菲阿里四价
//周期:日内
//类别:趋势突破
//原版+止损+交易测试限制
//修订时间:2012.11.1
//Designed By Rogarz
//准备中间变量
input:ss(1,1,100,1),n1(10,1,100,1),n2(10,1,100,1)n3(4,2,100,1);
variable:交易次数:=0;//为了便于统计 开平1次后 交易次数为2
昨高:=callstock(stklabel,vthigh,6,-1);//昨高
昨低:=callstock(stklabel,vtlow,6,-1);//昨低
昨收:=callstock(stklabel,vtclose,6,-1);//昨收
上轨:昨高;
下轨:昨低;
手数:=ss;
//条件
开多条件:=c>上轨;
开空条件:=c<下轨;
多头止损条件:=c<enterprice-N1*mindiff and time<145500;
空头止损条件:=c>enterprice+n2*mindiff and time<145500;
//交易系统
if (time>090000 and time<145000 and 交易次数<=n3) and (开多条件 or 开空条件) and holding=0 then begin
开多:buy(开多条件 and holding=0,手数,market);
开空:buyshort(开空条件 and holding=0,手数,market);
交易次数:=交易次数+1;
end
//止损
if 多头止损条件 and holding>0 then begin
多头止损:sell(1,手数,market);
交易次数:=交易次数+1;
end
if 空头止损条件 and holding<0 then BEGIN
空头止损:sellshort(1,手数,market);
交易次数:=交易次数+1;
end
if time>=145000 then BEGIN
收盘平多:sell(1,手数,market);
收盘平空:sellshort(1,手数,market);
交易次数:=0;
end
################################################################################################
//策略:菲阿里四价
//周期:日内
//类别:趋势突破
//原版+止损+交易测试限制
//修订时间:2012.2.13
//Designed By Rogarz
//准备中间变量
input:ss(1,1,100,1),n1(10,1,100,1),n2(10,1,100,1)n3(4,2,100,1);
昨高:=callstock(stklabel,vthigh,6,-1);//昨高
昨低:=callstock(stklabel,vtlow,6,-1);//昨低
昨收:=callstock(stklabel,vtclose,6,-1);//昨收
上轨:昨高;
下轨:昨低;
手数:=ss;
//条件
开多条件:=c>上轨;
开空条件:=c<下轨;
多头止损条件:=c<enterprice-N1*mindiff and time<145500;
空头止损条件:=c>enterprice+n2*mindiff and time<145500;
//交易系统
if (time>090000 and time<145000 and TOTALDAYTRADE<=n3) and (开多条件 or 开空条件) then begin
开多:buy(开多条件 and holding=0,手数,market);
开空:buyshort(开空条件 and holding=0,手数,market);
end
//止损
if 多头止损条件 and holding>0 then begin
多头止损:sell(1,手数,market);
end
if 空头止损条件 and holding<0 then BEGIN
空头止损:sellshort(1,手数,market);
end
if time>=145000 then BEGIN
收盘平多:sell(1,手数,market);
收盘平空:sellshort(1,手数,market);
end
第一个是原版,第二个加了简单的止盈止损和交易次数限制。第三个主要介绍totaldaytrade函数。
希望起抛砖引玉的作用。各位有想法的同仁修改后,欢迎在之后跟帖。促进交流,共同成长。
第一个修改成可交易的:
input:手数(1,1,100,1);
//-----------变量
g:=callstock(stklabel,vthigh,6,-1); //昨高
d:=callstock(stklabel,vtlow,6,-1); //昨低
//----------条件
kd:=ref(c>g,1); //收盘上穿昨高
kk:=ref(c<d,1); //收盘下破昨低
t:=time>090000 and time<145000;
tc:=time>=145000;
//----------信号
开多:buy(kd and t and holding=0,手数,limitr,o);
开空:buyshort(kk and t and holding=0,手数,limitr,o);
尾平多:sell(tc,手数,limitr,o);
尾平空:sellshort(tc,手数,limitr,o);
老师,请问这个系统的 交易次数:=交易次数+1 是不是要来控制日内交易次数?但如代码中的开仓条件:
开多条件:=c>上轨;
if (time>090000 and time<145000 and 交易次数<=n3) and (开多条件 or 开空条件) then begin
开多:buy(开多条件 and holding=0,手数,THISCLOSE);
开空:buyshort(开空条件 and holding=0,手数,THISCLOSE);
交易次数:=交易次数+1;
这样好像是只要k线close>上轨 就交易次数增加1 ,是不是跟作者的意思有差别?
老师,请问这个系统的 交易次数:=交易次数+1 是不是要来控制日内交易次数?但如代码中的开仓条件:
开多条件:=c>上轨;
if (time>090000 and time<145000 and 交易次数<=n3) and (开多条件 or 开空条件) then begin
开多:buy(开多条件 and holding=0,手数,THISCLOSE);
开空:buyshort(开空条件 and holding=0,手数,THISCLOSE);
交易次数:=交易次数+1;
这样好像是只要k线close>上轨 就交易次数增加1 ,是不是跟作者的意思有差别?