- UID
- 2
- 积分
- 2892857
- 威望
- 1396460 布
- 龙e币
- 1496397 刀
- 在线时间
- 13326 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-26
|
- 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
- stickline(close
- stickline(close
- end
- if trend=-1 then begin
- if prebarhigh+trailingstop
- 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
- stickline(close
- stickline(close
- end
- drawicon(trend=1,stopprice,10);
- drawicon(trend=-1,stopprice,11);
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|