通达信非常好用的黄金分割指标公式分享给大家
通达信函数关系,需调节高低参数定点。
左边的绿竖线是从高点至下的跌幅百分比 右边是黄金分割位和红竖线是上升幅度尺
input:K(1,1,3);
A:=BARSLAST(DISPSTATUS=1)+1;
HH:=HHV(H,A);
LL:=LLV(L,A);
上涨:BARSSINCE(BACKSET(DISPSTATUS=2,BARSLAST(L=LL)+1)),COLOR0000FF,linethick0;
空间%:(C/REF(L,上涨)-1)*100,COLOR00FFFF,linethick0;
最高%:(HHVALL(HH)/REF(L,上涨)-1)*100,COLORFF00FF,linethick0;
下跌:BARSSINCE(BACKSET(DISPSTATUS=2,BARSLAST(H=HH)+1)),COLOR00FF00,linethick0;
空间%:(C/REF(H,下跌)-1)*100,COLOR998888,linethick0;
最低%:(LLVALL(LL)/REF(H,下跌)-1)*100,COLORFF0000,linethick0;
高:REF(H,下跌),COLOR0000FF,DOTLINE;
低:REF(L,上涨),COLOR00FF00,DOTLINE;
VERTLINE(上涨=0,4),COLOR0000FF;
VERTLINE(下跌=0,3),COLOR00FF00;
{DRAWTEXT(上涨=0,HHVALL(HH)*0.99,'-最高'),COLOR0000FF;
DRAWTEXT(下跌=0,LLVALL(LL)*1.01,'-最低'),COLOR00FF00;}
DRAWTEXT(上涨=0 AND 最高% 10,LL*1.1,'-10%'),COLORYELLOW;
DRAWTEXT(上涨=0 AND 最高% 10,LL*1.15,'-15%'),COLORFFFFFF;
DRAWTEXT(上涨=0 AND 最高% 20,LL*1.2,'-20%'),COLOR00FF00;
DRAWTEXT(上涨=0 AND 最高% 25,LL*1.25,'-25%'),COLORFF00FF;
DRAWTEXT(上涨=0 AND 最高% 30,LL*1.3,'-30%'),COLOR0000FF;
DRAWTEXT(上涨=0 AND 最高% 40,LL*1.4,'-40%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 50,LL*1.5,'-50%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 60,LL*1.6,'-60%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 70,LL*1.7,'-70%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 80,LL*1.8,'-80%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 90,LL*1.9,'-90%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 100,LL*2,'-100%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 125,LL*2.25,'-125%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 150,LL*2.5,'-150%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 180,LL*2.8,'-180%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 200,LL*3,'-200%'),COLOR00FFFF;
DRAWTEXT(上涨=0 AND 最高% 250,LL*3.5,'-250%'),COLOR00FFFF;
DRAWTEXT(下跌=0 AND 最低% -10,HH*0.9,'-10%'),COLORYELLOW;
DRAWTEXT(下跌=0 AND 最低% -15,HH*0.85,'-15%'),COLORFFFFFF;
DRAWTEXT(下跌=0 AND 最低% -20,HH*0.8,'-20%'),COLOR00FF00;
DRAWTEXT(下跌=0 AND 最低% -25,HH*0.75,'-25%'),COLORFF00FF;
DRAWTEXT(下跌=0 AND 最低% -30,HH*0.7,'-30%'),COLORFF0000;
DRAWTEXT(下跌=0 AND 最低% -40,HH*0.6,'-40%'),COLORFFFFFF;
DRAWTEXT(下跌=0 AND 最低% -50,HH*0.5,'-50%'),COLORFFFFFF;
DRAWTEXT(下跌=0 AND 最低% -60,HH*0.4,'-60%'),COLORFFFFFF;
DRAWTEXT(下跌=0 AND 最低% -70,HH*0.3,'-70%'),COLORFFFFFF;
DRAWTEXT(下跌=0 AND 最低% -80,HH*0.2,'-80%'),COLORFFFFFF;
DRAWTEXT(下跌=0 AND 最低% -90,HH*0.1,'-90%'),COLORFFFFFF;
DRAWTEXT(上涨=2,L,'3天'),COLOR00FFFF;
DRAWTEXT(上涨=4,L,'5天'),COLOR00FFFF;
DRAWTEXT(上涨=7,L,'8天'),COLOR00FFFF;
DRAWTEXT(上涨=12,L,'13天'),COLOR00FFFF;
DRAWTEXT(上涨=20,L,'21天'),COLOR00FFFF;
DRAWTEXT(上涨=33,L,'34天'),COLOR00FFFF;
DRAWTEXT(上涨=54,L,'55天'),COLOR00FFFF;
DRAWTEXT(上涨=88,L,'89天'),COLOR00FFFF;
DRAWTEXT(上涨=143,L,'144天'),COLOR00FFFF;
DRAWTEXT(上涨=179,L,'180天'),COLOR00FFFF;
DRAWTEXT(上涨=249,L,'250天'),COLOR00FFFF;
DRAWTEXT(下跌=2,L,'-3天'),COLOR00FF00;
DRAWTEXT(下跌=4,L,'-5天'),COLOR00FF00;
DRAWTEXT(下跌=7,L,'-8天'),COLOR00FF00;
DRAWTEXT(下跌=12,L,'-13天'),COLOR00FF00;
DRAWTEXT(下跌=20,L,'-21天'),COLOR00FF00;
DRAWTEXT(下跌=33,L,'-34天'),COLOR00FF00;
DRAWTEXT(下跌=54,L,'-55天'),COLOR00FF00;
DRAWTEXT(下跌=88,L,'-89天'),COLOR00FF00;
DRAWTEXT(下跌=143,L,'-144天'),COLOR00FF00;
DRAWTEXT(下跌=179,L,'-180天'),COLOR00FF00;
DRAWTEXT(下跌=249,L,'-250天'),COLOR00FF00;
T := BARSLAST(DISPSTATUS=1)+1;
Aa:= DISPSTATUS=2;
HH1 := HHV(H, T);
LL1 := LLV(L, T);
HL := HH1-LL1;
wH := HHVBARS(H, T);
wL := LLVBARS(L, T);
KK := wH-wL;
mHL := HH-HL*0.5;
if K=1 then begin
HL191 := (HH1-LL1)*0.191;
HL382 := (HH1-LL1)*0.382;
HL618 := (HH1-LL1)*0.618;
HL809 := (HH1-LL1)*0.809;
if KK 0 then begin
a1 := HH1-HL191;
a2 := HH1-HL382;
a3 := HH1-HL618;
a4 := HH1-HL809;
end else begin
a1 := LL1+HL191;
a2 := LL1+HL382;
a3 := LL1+HL618;
a4 := LL1+HL809;
end
end
if k=1 then begin
HL125 := (HH1-LL1)*0.125;
HL250 := (HH1-LL1)*0.25;
HL375 := (HH1-LL1)*0.375;
HL625 := (HH1-LL1)*0.625;
HL750 := (HH1-LL1)*0.75;
HL875 := (HH1-LL1)*0.875;
if kk 0 then begin
b1 := HH1-HL125;
b2 := HH1-HL250;
b3 := HH1-HL375;
b4 := HH1-HL625;
b5 := HH1-HL750;
b6 := HH1-HL875;
end else begin
b1 := LL1+HL125;
b2 := LL1+HL250;
b3 := LL1+HL375;
b4 := LL1+HL625;
b5 := LL1+HL750;
b6 := LL1+HL875;
end
end
DRAWTEXT(Aa and K 3,HH1, ' 最高价:'+HH1),ALIGN2,colorgreen;
DRAWTEXT(Aa and K 3,LL1, ' 最低价:'+ll1),ALIGN2,VALIGN2,colorgreen;
DRAWTEXT(Aa and K 3,mHL,' 50%:'+mHL),ALIGN2,ColorC0C0C0;
DRAWTEXT(Aa and K=1, a1, ' 0.191:'+NUMTOSTRN(a1,2)),ALIGN2,ColorC0C0C0;
DRAWTEXT(Aa and K=1, a2, ' 0.382:'+NUMTOSTRN(a2,2)),ALIGN2,ColorC0C0C0;
DRAWTEXT(Aa and K=1, a3, ' 0.618:'+NUMTOSTRN(a3,2)),ALIGN2,ColorC0C0C0;
DRAWTEXT(Aa and K=1, a4, ' 0.809:'+NUMTOSTRN(a4,2)),ALIGN2,ColorC0C0C0;
DRAWTEXT(Aa and K 3,HH1, ' ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄'),ALIGN2,colorred,linethick7;
DRAWTEXT(Aa and K 3,LL1, ' ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄'),ALIGN2,colorred,linethick7;
DRAWTEXT(Aa and K 3,mHL,' ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄'),ALIGN2,colorff0000,linethick7;
DRAWTEXT(Aa and K=1, a1, '﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ '),ALIGN2,color208FFF,linethick0;
DRAWTEXT(Aa and K=1, a2, '﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ '),ALIGN2,color208FFF,linethick0;
DRAWTEXT(Aa and K=1, a3, '﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ '),ALIGN2,color208FFF,linethick0;
DRAWTEXT(Aa and K=1, a4, '﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ ﹊ '),ALIGN2,color208FFF,linethick0;