金字塔Dual Thrust日内策略模型源码集锦 多个版本源码[金字塔模型]
-
相关简介:Dual Thrust与R-Breaker一样,曾长期排名 Future Trust杂志最赚钱的策略。该策略在形式上和开盘区间突破策略类似。不同点主要体现在两方面:Dual Thrust在Range(代码中的浮动区间)的设置上,引入前N日的四个价位,使得一定时期内的Range相对稳定,可以适用于日间的趋势跟踪;Dual Thrust对于多头和空头的触发条件,考虑了非对称的幅度,做多和做空参考的Range可以选择不同的周期数,也可以通过参数K1和K2来确定。 来源 www.gszb.com 当
-
文章来源:公式网 发布时间:2015-10-23浏览次数:
Dual Thrust与R-Breaker一样,曾长期排名 Future Trust杂志最赚钱的策略。该策略在形式上和开盘区间突破策略类似。不同点主要体现在两方面:Dual Thrust在Range(代码中的浮动区间)的设置上,引入前N日的四个价位,使得一定时期内的Range相对稳定,可以适用于日间的趋势跟踪;Dual Thrust对于多头和空头的触发条件,考虑了非对称的幅度,做多和做空参考的Range可以选择不同的周期数,也可以通过参数K1和K2来确定。 来源 www.gszb.com
当K1
//策略:Dual Thrust
//类型:日内
//修订时间:2012.11.1
//Designed By Rogarz
//中间变量
input:n(1,1,100,1),K1(0.7,0.1,1,0.1),k2(0.7,0.1,1,0.1),nmin(10,1,100,1),ss(1,1,100,1);
CYC:=barslast(date<>ref(date,1))+1;
昨高:=callstock(stklabel,vthigh,6,-1);
昨低:=callstock(stklabel,vtlow,6,-1);
昨收:=callstock(stklabel,vtclose,6,-1);
开盘价:=valuewhen(cyc=1,open);
HH:=hhv(昨高,n);//N日high的最高价
HC:=hhv(昨收,n);//N日close的最高价
LC:=LLV(昨收,n);//N日close的最低价
LL:=LLV(昨低,n);//N日low的最低价
浮动区间:=max(HH-LL,HC-LL);//range
上轨:开盘价+k1*浮动区间;
下轨:开盘价-K2*浮动区间;
t1:=time>opentime(1) and time t2:=time>=closetime(0)-nmin*100; 手数:=ss; //交易条件 www.gszb.com 开多条件:=c>上轨 and holding=0; 开空条件:=c<下轨 and holding=0; //交易系统 开多:buy(开多条件 and t1 and cyc>1,手数,market); 开空:buyshort(开空条件 and t1 and cyc>1,手数,market); 收盘平多:sell(t2,手数,market); 收盘平空:sellshort(t2,手数,market); 这个策略在论坛中已有很多个版本,这个版本——引入了前N日的四个价位,以及K1、K2参数。默认参数设置与原论坛中的策略一致,为前一日,K1=k2=0.7. ////////////////////////================================================= 第二种版源码: 适合日线以下 任何周期 中间直接调用 日线数据 不过每天要把画面切换到 日线周期 刷新一个昨日的日线数据 还有注意费率设置 要改成期货 15% 合约单位 按该品种自己调整 手续费自己调整 input:k(0.7,0.1,1,0.1); 下日波动:max(callstock(stklabel,vthigh,6,0)-callstock(stklabel,vtclose,6,0),callstock(stklabel,vtclose,6,0)-callstock(stklabel,vtlow,6,0))*0.7; if holding<0 then begin
predayhigh:=callstock(stklabel,vthigh,6,-1);//昨日最高价
predaylow:=callstock(stklabel,vtlow,6,-1);//昨日最低价
predayclose:=callstock(stklabel,vtclose,6,-1);//昨日收盘价
predayrange:=max(predayhigh-predayclose,predayclose-predaylow);//取大波动值
dayopen:=callstock(stklabel,vtopen,6,0);//今天开盘价
upperband:intpart(dayopen+k*predayrange),colorred;//区间上沿
lowerband:intpart(dayopen-k*predayrange),colorgreen;//区间下沿
if holding=0 then begin
if high>=upperband then
buy(1,volunit,limitr,max(open,upperband));
end
if holding=0 then begin
if low<=lowerband then
buyshort(1,volunit,limitr,min(open,lowerband));
end
if holding>0 then begin
if low<=lowerband then begin
sell(1,holding,limitr,min(open,lowerband));
buyshort(1,volunit,limitr,min(open,lowerband));
end
if time>=closetime(0) then
sell(1,holding,limitr,close);
end
if high>=upperband then begin
sellshort(1,holding,limitr,max(open,upperband));
buy(1,volunit,limitr,max(open,upperband));
end
//www.88gs.com
if time>=closetime(0) then


现在就去充值积分
加入VIP可下载100以下的所有资源