波浪趨勢交易策略理論[金字塔模型]
????? 交易條件以多頭為例:
??????a) 價格創20期新高
??????b)??a條件滿足后的3個周期內創2期新低,記錄下這個新低值
????? c) ?b條件滿足后的3個周期內再次出現20期新高,此時開倉買入
????? d)??止損條件:以b條件中的新低作為止損價格
????? e)? 止盈條件:當價格達到2倍風險數額即2*(開倉價-止損價)止盈???????????????????
?
?
//nlow記錄創20新高后3期內創2期新低時k線的最低值
//mhigh記錄創20期新低后3期內創2期新高時k線的最高值
VARIABLE:nlow=0,mhigh=0;
//定義手數量
Input:snum(1,1,100,1);
//中間變量
h20:ref(hhv(h,20),1);//20周期最高價
l20:ref(llv(l,20),1);//20周期最低價
h2:=ref(hhv(h,2),1);//2周期最高價
l2:=ref(llv(l,2),1);//2周期最低價
//創20新高后3期內創2期新低,記錄最低價
con1:=BARSLAST(h>h20)<=3 and BARSLAST(h>h20)>0 and low<l2;
if con1 then nlow:=low;
//創20期新低后3期內創2期新高,記錄最高價
con2:=barslast(low<l20)<=3 and BARSLAST(l<l20)>0 and high>h2;
if con2 then mhigh:=high;
?
//開多平多條件,創新低3周期內再次創20期新高。平多條件分為止損止盈
BuyCond:=barslast(con1)<=3 and BARSLAST(con1)>0 and high>h20;
SellCond1:=low<=nlow;
SellCond2:=high-enterprice>2*abs(enterprice-nlow);
//開空平空條件
BuyshortCond:=barslast(con2)<=3 and BARSLAST(con2)>0? and l<l20;
SellshortCond1:=high>=mhigh;
SellshortCond2:=enterprice-low>=2*abs(mhigh-enterprice);
?
//交易策略
if SellCond1 then 多損:Sell(holding>0,snum,market);
if SellCond2 then 多盈:Sell(holding>0,snum,market);
if BuyshortCond then buyshort(holding=0,snum,market);
if SellshortCond1? then 空損:sellshort(holding<0,snum,market);
if SellshortCond2? then 空盈:sellshort(holding<0,snum,market);
if BuyCond then Buy(holding=0,snum,market);
?
?
?
{別忘了將本網告訴您身邊的朋友,向朋友傳達有用資料,也是一種人情,你朋友會感謝你的。}
?
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容