欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → [技术指标]趋势跟踪

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有20339人关注过本帖平板打印复制链接

主题:[技术指标]趋势跟踪

帅哥哟,离线,有人找我吗?
z7c9
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
[技术指标]趋势跟踪  发帖心情 Post By:2011/11/22 17:57:40 [只看该作者]

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

 

runmode:0;

input:length(20,5,60,5);
input:ratio(4,1,5,1);

variable:trend=0;
variable:stopprice=0;

prebarhigh:=ref(high,1);
prebarlow:=ref(low,1);

atr:=trimprice(ref(ema(high-low,length),1));
trailingstop:=ratio*atr;

if barpos>length and trend=0 then begin
 trend:=1;
 stopprice:=prebarlow-trailingstop;
 drawicon(1,prebarlow-trailingstop,8,0);
 drawtext(1,prebarlow-trailingstop,'开多',colorred,1); 
end

if trend=1 then begin
 if prebarlow-trailingstop>stopprice then
  stopprice:=prebarlow-trailingstop;
  
 if low<=stopprice then begin
  trend:=-1;
  stopprice:=prebarhigh+trailingstop;
  drawicon(1,prebarhigh+trailingstop,9,0);
  drawtext(1,prebarhigh+trailingstop,'开空',colorgreen,1);  
 end
 
 stickline(close>=open,high,close,1,1,colorred);
 stickline(close>=open,close,open,10,1,colorred);
 stickline(close>=open,open,low,1,1,colorred);
 stickline(close<open,high,open,1,0,colorred);
 stickline(close<open,open,close,10,0,colorred);
 stickline(close<open,close,low,1,0,colorred); 
end

if trend=-1 then begin
 if prebarhigh+trailingstop<stopprice then
  stopprice:=prebarhigh+trailingstop;
  
 if high>=stopprice then begin
  trend:=1;  
  stopprice:=prebarlow-trailingstop;
  drawicon(1,prebarlow-trailingstop,8,0);
  drawtext(1,prebarlow-trailingstop,'开多',colorred,1);  
 end
 
 stickline(close>=open,high,close,1,1,colorgreen);
 stickline(close>=open,close,open,10,1,colorgreen);
 stickline(close>=open,open,low,1,1,colorgreen);
 stickline(close<open,high,open,1,0,colorgreen);
 stickline(close<open,open,close,10,0,colorgreen);
 stickline(close<open,close,low,1,0,colorgreen);   
end

drawicon(trend=1,stopprice,10);
drawicon(trend=-1,stopprice,11);

[此贴子已经被作者于2011-11-22 18:03:44编辑过]

 回到顶部
总数 12 1 2 下一页