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

波浪趋势交易策略理论[金字塔模型]

: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">  趋势交易是投资中非常常见的交易手法,通过观察,在一轮完整的趋势行情中,价格并不会一路上涨或下跌而是在一波行情后会有一小段反向调整接着进入第二轮趋势行情。我们的波浪策略就是寻找分析这段调整行情来确定下一轮的趋势,策略以股指期货为例。

      交易条件以多头为例:

      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  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!

 


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容