分析家公式网,提供指标公式,股票软件 用户登录  |  用户 注册

软件名称:[B]金字塔Dual Thrust日内策略模型源码集锦 多个版本源码[金字塔模型][/B]
软件类型:国产软件
运行环境:Win2000/WinXP/Win2003/WinVista
软件语言:简体中文
授权方式:共享软件
软件大小:0 Bytes
官方主页:Home Page
更新时间:2013-11-08 00:36:48
软件简介:

Dual Thrust与R-Breaker一样,曾长期排名 Future Trust杂志最赚钱的策略。该策略在形式上和开盘区间突破策略类似。不同点主要体现在两方面:Dual Thrust在Range(代码中的浮动区间)的设置上,引入前N日的四个价位,使得一定时期内的Range相对稳定,可以适用于日间的趋势跟踪;Dual Thrust对于多头和空头的触发条件,考虑了非对称的幅度,做多和做空参考的Range可以选择不同的周期数,也可以通过参数K1和K2来确定。 来源 www.70822.com

  当K1<K2时,多头相对容易被触发,当K1>K2时,空头相对容易被触发。因此,投资者在使用该策略时,一方面可以参考历史数据测试的最优参数,另一方面,则可以根据自己对后势的判断,或从其他大周期的技术指标入手,阶段性地动态调整K1和K2的值。

 


此主题相关图片如下:dual thrust.jpg
按此在新窗口浏览图片

 
//策略: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<closetime(0)-nmin*100;
t2:=time>=closetime(0)-nmin*100;
手数:=ss;
//交易条件 www.70822.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);
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;//区间下沿

下日波动: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
 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 holding<0 then begin
 if high>=upperband then begin
  sellshort(1,holding,limitr,max(open,upperband));
  buy(1,volunit,limitr,max(open,upperband));
 end
 //www.70822.com
 if time>=closetime(0) then
  sellshort(1,holding,limitr,close);
end


资产:ASSET,PRECISION0,NOAXIS,COLORFF00FF;
goodin:=(1-(asset/hhv(asset,5520)))*100;
资产回撤百分比:goodin;
资产实际亏损:hhv(asset,5520)-asset,COLORgreen;

//////////////=================================

第三版本源码:

input:k(0.7,0.1,1,0.1);

dist1:=barslast(day>ref(day,1))+1;
dist2:=ref(dist1,dist1);

predayhigh:=ref(hhv(high,dist2),dist1);
predaylow:=ref(llv(low,dist2),dist1);
predayclose:=ref(close,dist1);
predayrange:=max(predayhigh-predayclose,predayclose-predaylow);

="Verdana">dayopen:=ref(open,dist1-1);

upperband:=dayopen+k*predayrange;
lowerband:=dayopen-k*predayrange;

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
 // www.70822.com
 if time>=closetime(0) then
  sell(1,holding,limitr,close);
end

if holding<0 then begin
 if high>=upperband then begin
  sellshort(1,holding,limitr,max(open,upperband));
  buy(1,volunit,limitr,max(open,upperband));
&nb
[url=http://www.70822.com/soft/sort013/sort068/down-66997.html]金字塔Dual Thrust日内策略模型源码集锦 多个版本源码[金字塔模型][/url]

关于本站 | 网站帮助 | 广告合作 | 声明 | 友情连接 | 网站地图 |
分析家公式网声明:本站所有股票公式软件资料均网上公开收集,如侵权请联系删帖。站内所有广告,均与本站无关!
Copyright © 2003-2024 70822.Com. All Rights Reserved .
页面执行时间:203.12500 毫秒