N:=5;
M1:=7;
M2:=8;
VAR1:=REF(LOW,1);
VAR2:=SMA(Abs(LOW-VAR1),3,1)/SMA(MAX(LOW-VAR1,0),3,1)*100;
VAR3:=EMA(IF(CLOSE*1.2,VAR2*10,VAR2/10),3);
VAR4:=LLV(LOW,38);
VAR5:=HHV(VAR3,38);
VAR6:=IF(LLV(LOW,90),1,0);
VAR7:=EMA(IF(LOW<=VAR4,(VAR3+VAR5*2)/2,0),3)/618*VAR6;
底部吸筹: STICKLINE(VAR7,0,VAR7,6,1),COLORRED ;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
趋势线:SMA(SMA(RSV,M1,1),M2,1),COLORMAGENTA,LINETHICK2;
{顶底背离}
LC:=REF(CLOSE,1);
rsi:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);
FF:=EMA(CLOSE,3);
MA15:=EMA(CLOSE,21);
DRAWTEXT(crOSS(FF,MA15),(LOW * 0.5),'底背离'),COLORRED;
{DRAWICON(CROSS(FF,MA15),(LOW * 0.5),3); }
{顶背离}
RSI1:=((SMA(MAX((CLOSE - (REF(CLOSE,1))),0),3,1) / SMA(ABS((CLOSE - (REF(CLOSE,1)))),3,1))* 100);
DRAWTEXT(CROSS(88,RSI1) AND (MA(C,3))>(EMA(C,3)) ,(HIGH + 0.3),'顶背离'),COLORGREEN;
{DRAWICON(CROSS(88,RSI1) AND (MA(C,3))>(EMA(C,3)) ,(HIGH + 0.3),15); };