以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  交易策略发布专区  (http://weistock.com/bbs/list.asp?boardid=10)
----  [交易系统]趋势跟踪  (http://weistock.com/bbs/dispbbs.asp?boardid=10&id=5498)

--  作者:z7c9
--  发布时间:2011/3/12 8:59:23
--  [交易系统]趋势跟踪

图片点击可在新窗口打开查看

 

input:period(60,5,120,5);
input:length(20,5,40,5);
input:trailingstop(3,1,6,1);

variable:stopline=0;

topband:=ref(hhv(high,period),1)+mindiff;
botband:=ref(llv(low,20),1)-mindiff;

atr:=ref(ma(tr,length),1);

trailingstopnum:=trimprice(trailingstop*atr);

if holding=0 then begin
 if barpos>period and high>=topband then
  buy(1,100%,limitr,close);
end

if holding>0 then begin
 if high-trailingstopnum>stopline then
  stopline:=high-trailingstopnum;
 
 if enterbars>=2 and low<=stopline then begin
  sell(1,holding,limitr,close); 
  stopline:=0;
 end 
end

partline(holding>0 and enterbars>=2,stopline,coloryellow,1);

盈亏:asset,noaxis,colormagenta;      
收益:(asset-500000)/500000,linethick0;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;

[此贴子已经被作者于2011-10-3 11:22:26编辑过]

--  作者:a7777
--  发布时间:2013/1/29 21:14:54
--  
图片点击可在新窗口打开查看