金字塔趋势跟踪指标源码
-
相关简介: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 barposlength and trend=0 then b
-
文章来源:公式网 发布时间:2015-10-25浏览次数:
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
if trend=-1 then begin
if 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
drawicon(trend=1,stopprice,10);
drawicon(trend=-1,stopprice,11);
复制上述代码粘贴到到公式管理器
输出RUNMODE:0
输出INPUT:LENGTH(20,5,60,5)
输出INPUT:RATIO(4,1,5,1)
输出VARIABLE:TREND=0
输出VARIABLE:STOPPRICE=0
PREBARHIGH赋值:昨日最高价
PREBARLOW赋值:昨日最低价
ATR赋值:TRIMPRICE(昨日最高价-最低价的LENGTH日指数移动平均)
TRAILINGSTOP赋值:RATIO*ATR
TREND赋值:1
STOPPRI


现在就去充值积分
加入VIP可下载100以下的所有资源