金字塔趋势跟踪指标源码[金字塔模型]
指标功能:[B]国产软件[/B]
指标类型:简体中文
所需积分:0
推荐星级:
授权方式:共享版
公式大小:0 Bytes
更新时间:2013-03-04 08:22:00
公式简介:
金字塔公式 金字塔模型策略源码: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);
复制上述代码粘贴到到公式管理器
输出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
STOPPRICE赋值:PREBARLOW-TRAILINGSTOP
当满足条件1时,在PREBARLOW-TRAILINGSTOP位置画8号图标
当满足条件1时,在PREBARLOW-TRAILINGSTOP位置书写文字
STOPPRICE赋值:PREBARLOW-TRAILINGSTOP
TREND赋值:-1
STOPPRICE赋值:PREBARHIGH+TRAILINGSTOP
当满足条件1时,在PREBARHIGH+TRAILINGSTOP位置画9号图标
当满足条件1时,在PREBARHIGH+TRAILINGSTOP位置书写文字
END 当满足条件收盘价>=开盘价时,在最高价和收盘价位置之间画柱状线,宽度为1,1不为0则画空心柱.
当满足条件收盘价>=开盘价时,在收盘价和开盘价位置之间画柱状线,宽度为10,1不为0则画空心柱.
当满足条件收盘价>=开盘价时,在开盘价和最低价位置之间画柱状线,宽度为1,1不为0则画空心柱.
当满足条件收阴线时,在最高价和开盘价位置之间画柱状线,宽度为1,0不为0则画空心柱.
当满足条件收阴线时,在开盘价和收盘价位置之间画柱状线,宽度为10,0不为0则画空心柱.
当满足条件收阴线时,在收盘价和最低价位置之间画柱状线,宽度为1,0不为0则画空心柱.
STOPPRICE赋值:PREBARHIGH+TRAILINGSTOP
TREND赋值:1
STOPPRICE赋值:PREBARLOW-TRAILINGSTOP
当满足条件1时,在PREBARLOW-TRAILINGSTOP位置画8号图标
当满足条件1时,在PREBARLOW-TRAILINGSTOP位置书写文字
END 当满足条件收盘价>=开盘价时,在最高价和收盘价位置之间画柱状线,宽度为1,1不为0则画空心柱.
当满足条件收盘价>=开盘价时,在收盘价和开盘价位置之间画柱状线,宽度为10,1不为0则画空心柱.
当满足条件收盘价>=开盘价时,在开盘价和最低价位置之间画柱状线,宽度为1,1不为0则画空心柱.
当满足条件收阴线时,在最高价和开盘价位置之间画柱状线,宽度为1,0不为0则画空心柱.
当满足条件收阴线时,在开盘价和收盘价位置之间画柱状线,宽度为10,0不为0则画空心柱.
当满足条件收阴线时,在收盘价和最低价位置之间画柱状线,宽度为1,0不为0则画空心柱.
ENDDRAWICON(TREND=1,STOPPRICE,10)
当满足条件TREND=-1时,在STOPPRICE位置画11号图标
[url=http://www.goodgupiao.com/gupiaogongshi/26396.html][B]金字塔趋势跟踪指标源码[金字塔模型][/B][/url]