HJ1:=1;
DIF:=IF(HJ1=1,MACD.DIF,0);
DEA:=IF(HJ1=1,MACD.DEA,0);
MACD:=(DIF-DEA)*2;
HJ2:=BARSLAST(REF(MACD,1)<0 AND MACD>0);
HJ3:=LLVBARS(MACD,HJ2+20);
HJ4:=IF(HJ3>HJ2,REF(MACD,HJ3),0);
HJ5:=MACD<0 AND MACD>HJ4 AND LOW=LLV(LOW,HJ2+20) AND HJ4<0;
HJ6:=REF(HJ5,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,HJ3)<0 AND MACD<0;
低柱背:=DRAWLINE(HJ4=HJ3,MACD,HJ6,MACD,0),COLORRED,LINETHICK2;
DRAWICON(HJ6,MACD*1.2,25);
{柱状背离}
DIF:=IF(HJ1=1,MACD.DIF,0);
DEA:=IF(HJ1=1,MACD.DEA,0);
MACD:=(DIF-DEA)*2;
HJ2:=BARSLAST(REF(MACD,1)<0 AND MACD>0);
HJ3:=LLVBARS(MACD,HJ2+20);
HJ4:=IF(HJ3>HJ2,REF(MACD,HJ3),0);
HJ5:=MACD<0 AND MACD>HJ4 AND LOW=LLV(LOW,HJ2+20) AND HJ4<0;
HJ6:REF(HJ5,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,HJ3)<0 AND MACD<0;
{柱状背离选股}
HJ1:=1;
DIF:=IF(HJ1=1,MACD.DIF,0);
DEA:=IF(HJ1=1,MACD.DEA,0);
MACD:=(DIF-DEA)*2;
HJ2:=BARSLAST(REF(MACD,1)<0 AND MACD>0);
HJ3:=LLVBARS(MACD,HJ2+20);
HJ4:=IF(HJ3>HJ2,REF(MACD,HJ3),0);
HJ5:=MACD<0 AND MACD>HJ4 AND LOW=LLV(LOW,HJ2+20) AND HJ4<0;
HJ6:REF(HJ5,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,HJ3)<0 AND MACD<0;