MA20:=MA(C,20),COLORMAGENTA,LINETHICK2;
AA:MA(C,20),COLORGREEN,LINETHICK2;
MM:MA(C,20),COLORGREEN,LINETHICK2;
IF(C>AA,MM,DRAWNULL),COLORRED,LINETHICK2;
IF(C<AA,MM,DRAWNULL),COLORGREEN,LINETHICK2;
BTMA20:=(CLOSE>MA20) AND (REF(CLOSE,1)>REF(MA20,1)) AND (REF(CLOSE,2)>REF(MA20,2)) AND (REF(CLOSE,3)>REF(MA20,3));
JXX:=BARSLASTCOUNT(C<MA20);
JXX1:=BACKSET((JXX>=4)*JXX,JXX);
JXS:=BARSLASTCOUNT(C>MA20);
JXS1:=BACKSET((JXS>=4)*JXS,JXS);
KGC:=BARSLASTCOUNT(NOT(JXX1 OR JXS1));
JXL:=BARSLASTCOUNT(REF(JXX1>0,KGC));
JXH:=BARSLASTCOUNT(REF(JXS1>0,KGC));
XWZ:=FILTERX(LLV(L,JXL)=L,JXL);
SWZ:=FILTERX(HHV(H,JXH)=H,JXH);
{DRAWLINE(XWZ,L,SWZ,H,0),COLOR00FFFF;在高低点连斜线}
高:=REF(H,BARSLAST(SWZ));
低:=REF(L,BARSLAST(XWZ));
BB:=BARSLAST(JXL=1);{上次JXL等于1距今天数}
顶点2:=REF(高,BARSLAST(JXL)),COLORGREEN;
低点2:=REF(低,BB),COLORGREEN;{上次等于1对应的低价。或用AA:REF(低,BB);}
H23:=((顶点2-低点2)*0.236+低点2);
H38:=((顶点2-低点2)*0.382+低点2);
H中:=((顶点2-低点2)*0.5+低点2);
H61:=((顶点2-低点2)*0.618+低点2);
H80:=((顶点2-低点2)*0.809+低点2);
H138:=((顶点2-低点2)*1.382+低点2);
H161:=((顶点2-低点2)*1.618+低点2);
H261:=((顶点2-低点2)*2.618+低点2);
顶点A:REFDATE(顶点2,DATE),COLORGREEN,LINETHICK2;
低点A:REFDATE(低点2,DATE),COLORGREEN,LINETHICK2;
B38:REFDATE(H38,DATE),COLORGREEN,DOTLINE;
C50:REFDATE(H中,DATE),COLORGREEN,DOTLINE;
D61:REFDATE(H61,DATE),COLORGREEN,DOTLINE;
DRAWTEXT(ISLASTBAR,顶点A,'1.000'),COLORGREEN;
DRAWTEXT(ISLASTBAR,B38,'0.382'),COLORGREEN;
DRAWTEXT(ISLASTBAR,C50,'0.50'),COLORGREEN;
DRAWTEXT(ISLASTBAR,D61,'0.618'),COLORGREEN;
DRAWTEXT(ISLASTBAR,低点A,'0.000'),COLORGREEN;
STICKLINE(CLOSE>=OPEN,CLOSE,OPEN,2.5,0),COLORRED;
STICKLINE(CLOSE>=OPEN,CLOSE,OPEN,0.1,0),COLORCC66FF;
STICKLINE(CLOSE<OPEN,CLOSE,OPEN,2.5,0),COLORFF9900;
STICKLINE(CLOSE<OPEN,CLOSE,OPEN,0.1,0),COLORFFCC00;