RA:=maX(O,C);
RB:=MIN(O,C);
RC:=REF(HHV(H,2),1);
RD:=REF(LLV(L,2),1);
T1:=IF(RA RC,1,IF(RB RD,-1,0));
T2:=BArslAst(T1=0);
TH:=REF(REF(H,BARSLAST(T1=1)),T2);
TL:=REF(REF(L,BARSLAST(T1=-1)),T2);
TA:=IF(T1=1,IF(RA TH,1,0),IF(T1=-1,IF(RB TL,-1,0),0));
T3:=BARSLAST(TA=-1);
T4:=BARSLAST(TA=1);
RE:=REF(COUNT(crOSS(TA,-0.5),T4),T3);
RF:=COUNT(CROSS(TA,0.5),T3);
TB:=IF(TA=1,IF(RF=1,IF(RE 0,1,0),0),0);
NOTEXT1:=VALUEWHEN(TB,REF(REF(H,T4),T3)),COLORGREEN,LINETHICK2;{水平线};
乖离:=100*Abs(C-NOTEXT1)/NOTEXT1
DIF:=EMA(CLOSE,18)-EMA(CLOSE,40);
DEA:=EMA(DIF,3);
macd:=(DIF-DEA)*2;
MD:=MacD#DAY;
MW:=MACD#WEEK;
MM:=MACD#MONTH;
MS:=MACD#SEASON;
NOTEXTMACD1:EMA((MD+MW*7+MM*31+MS*94)/133,5) LINETHICK2 COLORYELLOW NODRAW;
STICKLINE(NOTEXTMACD1 0,NOTEXTMACD1,0,3,1),COLORRED;
STICKLINE(NOTEXTMACD1 0,NOTEXTMACD1,0,3,1),COLORCYAN;
NOTEXTMACD120:REF(NOTEXTMACD1/2,BARSLAST(NOTEXTMACD1=HHV(NOTEXTMACD1,120))),COLORRED,LINETHICK1;
NOTEXTMACD250:REF(NOTEXTMACD1/2,BARSLAST(NOTEXTMACD1=HHV(NOTEXTMACD1,250))),COLORWHITE,LINETHICK1;
XG:=NOT(REF(NOTEXTMACD120,1)=NOTEXTMACD120);
STICKLINE(XG,0,NOTEXTMACD1,2,0),COLORYELLOW;{画金柱 120}
STICKLINE(NOTEXTMACD1 =NOTEXTMACD250,NOTEXTMACD250,NOTEXTMACD1,2,0),COLORMAGENTA; {画粉柱 250}
大行情:=NOT(REF(NOTEXTMACD120,1)=REF(NOTEXTMACD250,1)) AND NOTEXTMACD120=NOTEXTMACD250 AND C NOTEXT1 AND 乖离;
NOTEXT前高:IF(HHVBARS(MACD ,90) ,REF(MACD ,HHVBARS(MACD,90) ),MACD )COLORYELLOW,LINETHICK2;
NOTEXT3:IF(NOTEXT前高 REF(NOTEXT前高,1),NOTEXT前高,DRAWNULL),COLORMAGENTA,LINETHICK4;
NOTEXT4:IF(NOTEXT前高 REF(NOTEXT前高,1),NOTEXT前高,DRAWNULL),COLORGREEN,LINETHICK4;
DRAWTEXT(大行情 AND NOTEXT前高 NOTEXTMACD250,-0.01,'↖大牛启动'),COLORMAGENTA;