通达信DMA背离指标公式
N:=10;
DIF:MA(CLOSE,10)-MA(CLOSE,50);
AMA:MA(DIF,10);
B:=DIF-REF(DIF,1);
IF(B>=0,DIF,DRAWNULL),COLORRED,LINETHICK2;
IF(B<=0,DIF,DRAWNULL),COLORFF9900,LINETHICK2;
RSI1:=DIF;
AA:=REF(RSI1,N)=HHV(RSI1,2*N+1);
BB:=BACKSET(AA,N+1);
CC:=FILTER(BB,N) AND RSI1=HHV(RSI1,N+1);
A1:=BARSLAST(REF(CC,1));
顶背离:=REF(CLOSE,A1+1)<CLOSE AND REF(RSI1,A1+1)>RSI1 AND CC;
DRAWLINE(CC,RSI1,FILTER(顶背离>0,5),RSI1,0),COLORGREEN;
AA2:=REF(RSI1,N)=LLV(RSI1,2*N+1);
BB2:=BACKSET(AA2,N+1);
CC2:=FILTER(BB2,N) AND RSI1=LLV(RSI1,N+1);
A2:=BARSLAST(REF(CC2,1));
底背离:=REF(CLOSE,A2+1)>CLOSE AND REF(RSI1,A2+1)<RSI1 AND CC2;
DRAWLINE(CC2,RSI1,FILTER(底背离>0,5),RSI1,0),COLORRED,LINETHICK2;