通达信整合黄金分割主图指标公式
2020/12/29 17:54:16
高点:=22;
低点:=10;
T1:=10;
T:=180;
M5:=MA(C,5);
M10:=MA(C,10);
M20:=MA(C,20);
M60:=MA(C,60);
AX:=M5>=M60 AND M10>=M60 AND M20>=M60;
TX:=BARSLAST(CROSS(AX,0.5));
HT:=HHVBARS(H,TX+1);
LT0:=FINDLOWBARS(L,0,30,1);
HT0:=FINDHIGHBARS(H,LT0=0,60,1);
LLX:=REF(L,LT0);
HHX:=REF(H,HT0);
NOTEXT01:DRAWLINE(HT0=0,HHX,LT0=0,HHX,1),COLORYELLOW,NODRAW;
NOTEXT02:DRAWLINE(HT0=0,HHX,LT0=0,LLX,1),COLORYELLOW;
NOTEXT03:DRAWLINE(HT0=0,HHX,LT0=0,(HHX-LLX)*0.382+LLX,1){,DOTLINE},COLORLIMAGENTA;
NOTEXT04:DRAWLINE(HT0=0,HHX,LT0=0,(HHX-LLX)*0.618+LLX,1){,DOTLINE},COLORLIBLUE;
TA:=BARSLAST(REF(NOTEXT01,1)=DRAWNULL AND HT=0);
X支撑线:REF(L,LT0),COLORYELLOW,NODRAW;
X阻力1:(HHX-LLX)*0.382+LLX,COLORLIMAGENTA,NODRAW;
X阻力2:(HHX-LLX)*0.618+LLX,COLORLIBLUE, NODRAW;
{黄金分割}
HH:=REF(HHV(H,T),T1);
LL:=REF(LLV(L,T),T1);
H1:=HH-(HH-LL)*0.191;
H2:=HH-(HH-LL)*0.382;
H3:=HH-(HH-LL)*0.5;
H4:=HH-(HH-LL)*0.618;
H5:=HH-(HH-LL)*0.764;
H6:=HH-(HH-LL)*0.809;
H7:=HH-(HH-LL)*0.236;
顶1:=HH+(HH-LL)*0.191;
顶2:=HH+(HH-LL)*0.382;
顶3:=HH+(HH-LL)*0.618;
底1:=IF((HH-LL)<LL,LL-(HH-LL)*0.191,LL-LL*0.191);
底2:=IF((HH-LL)<LL,LL-(HH-LL)*0.382,LL-LL*0.382);
底3:=IF((HH-LL)<LL,LL-(HH-LL)*0.618,LL-LL*0.618);
高:=IF(CURRBARSCOUNT<=T+T1 AND CURRBARSCOUNT>T1,REFDATE(HH,DATE),DRAWNULL);
一:=IF(CURRBARSCOUNT<=T+T1,REFDATE(H1,DATE),DRAWNULL);
二:=IF(CURRBARSCOUNT<=T+T1,REFDATE(H2,DATE),DRAWNULL);
三:=IF(CURRBARSCOUNT<=T+T1,REFDATE(H3,DATE),DRAWNULL);
四:=IF(CURRBARSCOUNT<=T+T1,REFDATE(H4,DATE),DRAWNULL);
五:=IF(CURRBARSCOUNT<=T+T1,REFDATE(H5,DATE),DRAWNULL);
六:=IF(CURRBARSCOUNT<=T+T1,REFDATE(H6,DATE),DRAWNULL);
七:=IF(CURRBARSCOUNT<=T+T1,REFDATE(H7,DATE),DRAWNULL);
低:=IF(CURRBARSCOUNT<=T+T1 AND CURRBARSCOUNT>T1,REFDATE(LL,DATE),DRAWNULL);
NOTEXT1:高,COLOR007799;
{NOTEXT2:IF(GOQI,DRAWNULL,一),DOTLINE,COLOR777777;
NOTEXT3:IF(GOQI,DRAWNULL,二),DOTLINE,COLOR777777;
NOTEXT4:IF(GOQI,DRAWNULL,三),DOTLINE,COLOR777777;
NOTEXT5:IF(GOQI,DRAWNULL,四),DOTLINE,COLOR777777;
NOTEXT6:IF(GOQI,DRAWNULL,五),DOTLINE,COLOR777777;
NOTEXT7:IF(GOQI,DRAWNULL,六),DOTLINE,COLOR777777;}
AA:REFDATE(一,DATE),DOTLINE,COLOR555555;
BB:REFDATE(二,DATE),DOTLINE,COLOR005858;
CCA:REFDATE(三,DATE),DOTLINE,COLOR777777;
DDA:REFDATE(四,DATE),DOTLINE,COLOR005858;
EE:REFDATE(五,DATE),DOTLINE,COLOR555555;
FF:REFDATE(六,DATE),DOTLINE,COLOR555555;
GG:REFDATE(七,DATE),DOTLINE,COLOR555555;
NOTEXT8:低,COLOR668800;
TT:=INTPART(T*0.5)+T1;
TT1:=(CURRBARSCOUNT=TT);
TT2:=(CURRBARSCOUNT=TT-32);
TT3:=(CURRBARSCOUNT=TT-40);
DRAWTEXT(TT1 AND 高,高-(高-低)*0.025,STRCAT(' 【高点】: ',CON2STR(HH,2))),COLOR007799;
DRAWTEXT(TT1 AND 一,一+(高-低)*0.020,STRCAT('191 (809): ',CON2STR(H1,2))),COLOR888888;
DRAWTEXT(TT1 AND 二,二+(高-低)*0.020,STRCAT('382 (618): ',CON2STR(H2,2))),COLOR008888;
DRAWTEXT(TT1 AND 三,三+(高-低)*0.020,STRCAT(' 【中点】: ',CON2STR(H3,2))),COLOR000088;
DRAWTEXT(TT1 AND 四,四+(高-低)*0.020,STRCAT('618 (382): ',CON2STR(H4,2))),COLOR008888;
DRAWTEXT(TT1 AND 五,五+(高-低)*0.020,STRCAT('764 (236): ',CON2STR(H5,2))),COLOR888888;
DRAWTEXT(TT1 AND 六,六+(高-低)*0.020,STRCAT('809 (191): ',CON2STR(H6,2))),COLOR888888;
DRAWTEXT(TT1 AND 七,七+(高-低)*0.020,STRCAT('236 (764): ',CON2STR(H7,2))),COLOR888888;
DRAWTEXT(TT1 AND 低,低+(高-低)*0.020,STRCAT(' 【低点】: ',CON2STR(LL,2))),COLOR668800;
DRAWTEXT(TT3 AND 高,高+(高-低)*0.040,''),COLOR007799;{顶距};
GD:=CONST(FINDHIGH(H,0,高点*10,1));
DD:=CONST(FINDLOW(L,0,低点*10,1));
GT:=CONST(BARSLAST(GD=H))+1;
DT:=CONST(BARSLAST(DD=L))+1;
SH:=CONST(IF(GT=1,H,REF(H,GT-1)));
SL:=CONST(IF(DT=1,L,REF(L,DT-1)));
CC:=IF(DT>GT,DT,GT);
CD:=INTPART(CC-(DT+GT)/2);
CG:=IF(高点>CD,DT,GT);
{CG:=IF(高点>CD,CD/2,高点);}
{黄金分割}
ZG:=IF(CURRBARSCOUNT<=CD,SH,DRAWNULL);
DRAWBAND(ZG,RGB(0,0,0),ZG,RGB(0,0,0)),DOTLINE,COLORLIRED;
ZD:=IF(CURRBARSCOUNT<=CD,SL,DRAWNULL);
DRAWBAND(ZD,RGB(0,0,0),ZD,RGB(0,0,0)),DOTLINE,COLORLIRED;
X191:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.191,DRAWNULL);
DRAWBAND(X191,RGB(0,0,0),X191,RGB(0,0,0)),DOTLINE,COLORLIRED;
X382:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.382,DRAWNULL);
DRAWBAND(X382,RGB(0,0,0),X382,RGB(0,0,0)),DOTLINE,COLORLIRED;
X500:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.500,DRAWNULL);
DRAWBAND(X500,RGB(0,0,0),X500,RGB(0,0,0)),DOTLINE,COLORRED;
X618:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.618,DRAWNULL);
DRAWBAND(X618,RGB(0,0,0),X618,RGB(0,0,0)),DOTLINE,COLORLIRED;
X809:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.809,DRAWNULL);
DRAWBAND(X809,RGB(0,0,0),X809,RGB(0,0,0)),DOTLINE,COLORLIRED;
DRAWTEXT(CURRBARSCOUNT=CG,(ZD)*1.02,STRCAT('起点: ',CON2STR(ZD,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X191)*0.986,STRCAT('80.9% ',CON2STR(X191,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X382)*0.985,STRCAT('61.8% ',CON2STR(X382,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X500)*0.984,STRCAT('50% ',CON2STR(X500,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X618)*0.982,STRCAT('38.2% ',CON2STR(X618,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X809)*0.98,STRCAT('19.1% ',CON2STR(X809,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(ZG)*0.98,STRCAT('100% ',CON2STR(ZG,2))),COLORLIGRAY;
看 股吧公式 www.k anguba.com
其它股票公式列表