人人爽天天爽夜夜爽qc-人人爽天天爽夜夜爽曰-人人天天爱天天做天天摸-人人天天夜夜-色网站在线-色网站在线看

您現在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔模型>>正文內容

金字塔Dual Thrust日內策略模型源碼集錦 多個版本源碼[金字塔模型]

Dual Thrust與R-Breaker一樣,曾長期排名 Future Trust雜志最賺錢的策略。該策略在形式上和開盤區間突破策略類似。不同點主要體現在兩方面:Dual Thrust在Range(代碼中的浮動區間)的設置上,引入前N日的四個價位,使得一定時期內的Range相對穩定,可以適用于日間的趨勢跟蹤;Dual Thrust對于多頭和空頭的觸發條件,考慮了非對稱的幅度,做多和做空參考的Range可以選擇不同的周期數,也可以通過參數K1和K2來確定。 來源 m.kzuj.com.cn

  當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;
//交易條件 m.kzuj.com.cn
開多條件:=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
 //m.kzuj.com.cn
 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
 // m.kzuj.com.cn
 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.chengxuhuajiaoyi.com  if time>=closetime(0) then
  sellshort(1,holding,limitr,close);
end

資產:asset,noaxis,colorred,linethick2;

 

 

 

{別忘了將本網告訴您身邊的朋友,向朋友傳達有用資料,也是一種人情,你朋友會感謝你的。}

 

有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友

可聯系技術人員 QQ: 1145508240  有需要幫忙請點擊這里留言!!!進行 有償 編寫!不貴!點擊查看價格!

 


【字體: 】【打印文章】【查看評論

相關文章

    沒有相關內容
  主站蜘蛛池模板: 亚洲一区在线视频 | 九九热视频在线免费观看 | 一个人看的www片免费视频中文 | 五月天在线影院 | 在线观看www成人影院 | 三级黄色日本 | 成人免费专区 | 色天天综合网色鬼综合 | 亚洲无限码 | a级大片在线观看 | 黄 色 免 费 网站在线观看 | 一二三四在线视频播放社区 | 波多野结衣视频在线看 | 中文字幕25页 | 手机在线看片不卡中文字幕 | 国产成人拍精品视频网 | 久艾草国产成人综合在线视频 | 成人午夜看片 | 亚洲欧美日韩久久精品第一区 | 性xxx欧美| 丝袜久久 | 日日摸夜夜添夜夜添人人爽 | 黄色免费在线网站 | a在线免费观看视频 | 欧美亚洲日本 | 在线观看中文字幕亚洲 | 欧美日本一区二区三区道 | 永久网站www774777视频 | 欧美日韩国产成人高清视频 | 91精品一区二区三区在线播放 | 19国产精品麻豆免费观看 | 国产在线欧美精品 | 在线观看国产一区二三区 | 成人欧美在线 | 日本一区二区三区在线看 | 欧美有码在线观看 | 最近免费字幕中文大全视频 | 性欧美激情在线观看 | 黄色最新网站 | 涩涩动漫网站入口 | 在线 中文字幕 日韩 欧美 |