N:=14;
MM:=6;
RSV:=(CLOSE-LLV(LOW,10))/(HHV(HIGH,10)-LLV(LOW,10))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA), COLORSTICK;
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
RSI3:=SMA(MAX(CLOSE-LC,0),24,1)/SMA(ABS(CLOSE-LC),24,1)*100;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(CLOSE,A1+1)>CLOSE AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
MACD底背离:FILTER(B1>0,5);
STICKLINE(FILTER(B1>0,5),0,10,1,0),COLOR00FF00;
DRAWTEXT(FILTER(B1>0,5),10,'MACD底背'),COLOR00FF00;
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(CLOSE,A3+1)>CLOSE AND REF(RSI1,A3+1)<RSI1 AND CROSS(RSI1,RSI2);
RSI底背离:FILTER(B3>0,5),LINETHICK0;
STICKLINE(FILTER(B3>0,5),0,30,1,0),COLORFFFF00;
DRAWTEXT(FILTER(B3>0,5),30,'RSI底背'),COLORFFFF00;