通达信SKD背离指标公式源码
LOWV:=LLV(LOW,9);
HIGHV:=HHV(HIGH,9);
RSV:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,3);
K:EMA(RSV,3)COLOR00FFFF;
D:MA(K,3)COLORFF00FF;
STICKLINE(K>D,K,D,2.5,0),COLORRED,LINETHICK1,NODRAW;
STICKLINE(D>K,K,D,2.5,0),COLORGREEN,LINETHICK1,NODRAW;
NOTEXT1:IF(K>REF(K,1),K,DRAWNULL) CIRCLEDOT,COLORRED;
NOTEXT2:IF(K<REF(K,1),K,DRAWNULL) CIRCLEDOT,COLORGREEN;
清仓:90 COLORWHITE;
卖出:80 COLORGREEN;
关注:15 COLORD9D919;
底部:10 COLORWHITE;
分界线:=50,POINTDOT,LINETHICK2,COLORGREEN;
{DRAWICON(CROSS(K,90),K,4);
DRAWICON(CROSS(K,80),K,12);
DRAWICON(CROSS(15,K),K,11);
DRAWICON(CROSS(10,K),K,5);}
{盘整天:BARSLASTCOUNT(K<30)COLORYELLOW NODRAW;
跌幅:IF(盘整天,(C-REF(C,盘整天))/REF(C,盘整天),0)*100 COLORGREEN NODRAW;
现金流:FINANCE(25)/FINANCE(1),COLORYELLOW NODRAW;}
{N1:=7;
LC:=REF(CLOSE,1);
X:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100,COLORYELLOW,LINETHICK1;
魔鬼:=DRAWLINE(X>=HHV(X,N1),X,X<=LLV(X,N1),X,1),COLOR00FF00;
魔王:=DRAWLINE(X>=HHV(X,N1),X,X<=LLV(X,N1),1,X),COLOR00FF00;
TJ0:=X=魔王;
TJ1:=X=魔鬼;
TJ2:=X<REF(X,1);
TJ3:=X>REF(1,X);
JRS1:=DRAWICON(TJ1 AND TJ2,X,1);
JRS2:=DRAWICON(TJ0 AND TJ3,X,2);
DRAWICON(FILTER(JRS1>0,1),K*0.97,5);
DRAWICON(FILTER(JRS2>0,1),K*1.02,15);}
{以下为买入卖出的源码}
{收大于买:=(REF(H-L,1)/2+REF(L,1))*0.997,COLORYELLOW;
低移:=SMA(XMA((C+L+H)/3,15),2,1),NODRAW;
低:=REF(低移,1)*REF(低移,1)/REF(低移,2),COLORWHITE,NODRAW;};
{卖出}
{卖价:=低*1.04,COLORWHITE;
价A:=卖价,COLORWHITE,NODRAW;
价B:=MAX(REF(C,1)*0.99,H*0.97),COLORWHITE,NODRAW;
冲高卖:=MAX(价A,价B),COLORWHITE,NODRAW;
卖点:=H>冲高卖 ;
DRAWICON(BARSLASTCOUNT(卖点)=1 ,K*1.01,17);};
{买入}
{低1:=低*0.97,COLORWHITE;
低2:=低*0.94,COLORWHITE;
低3:=低*0.89,COLORCYAN;
低4:=低*0.84,COLORBLUE;
W1:=低移>REF(低移,1);
W2:=低移<REF(低移,1);
低买线:=IF(W1 AND REF(L>低1,1)AND L<低1,低1,IF(W2 AND REF(L>低2,1)AND L<低2,低2,IF(W1 AND REF(L>低2,1)AND L<低2,低2,
IF(W2 AND REF(L>低3,1)AND L<低3,低3,IF(W1 AND L<低3,低3,IF( L<低4,低4,DRAWNULL))))));}
{STICKLINE(L<低买线 ,L,MIN(H,低买线),1.1,0),COLORWHITE;}
{买点:=L<低买线;
DRAWICON(FILTER(买点>0,1),K*0.97,5);}
{VAR2:=LLV(LOW,10);
VAR3:=HHV(HIGH,25);
动力线:= EMA((CLOSE-VAR2)/(VAR3-VAR2)*4,4);
趋势:=MA(动力线,3);
出击:IF((趋势>REF(趋势,1)) AND (REF(趋势,1)<REF(趋势,2)) AND (趋势<0.6),20,0)COLOR00FF00;}
{P:=((2)*(CLOSE) + HIGH + LOW + OPEN)/(5);
CCI:=((P - MA(P,14))*(100))/((1.5)*(AVEDEV(P,14)));
RSI1:=((SMA(MAX(CLOSE - REF(CLOSE,1),0),6,1))/(SMA(ABS(CLOSE - REF(CLOSE,1)),6,1)))*(100);
STICKLINE((RSI1 > 80),100,95,3,0),COLOR3333DD;
STICKLINE((CCI < (-100)),(18),14,3,0),COLORYELLOW;}
MA5:=MA(CLOSE,5);
MA10:=MA(CLOSE,10);
MA20:=MA(CLOSE,20);
MA30:=MA(CLOSE,30);
MA60:=MA(CLOSE,60);
MA120:=MA(CLOSE,120);
MA250:=MA(CLOSE,250);
角度5:ATAN((MA5/REF(MA5,1)-1)*100)*180/3.1416 COLORFFFF00 NODRAW;
角度10:ATAN((MA10/REF(MA10,1)-1)*100)*180/3.1416 COLORGREEN NODRAW;
角度20:ATAN((MA20/REF(MA20,1)-1)*100)*180/3.1416 COLORYELLOW NODRAW;
角度30:ATAN((MA30/REF(MA30,1)-1)*100)*180/3.1416 COLORWHITE NODRAW;
角度60:ATAN((MA60/REF(MA60,1)-1)*100)*180/3.1416 COLORGREEN NODRAW;
角度120:ATAN((MA120/REF(MA120,1)-1)*100)*180/3.1416 COLORWHITE NODRAW;
角度250:ATAN((MA250/REF(MA250,1)-1)*100)*180/3.1416 COLORD9D919 NODRAW;
{A1:=BARSLAST(REF(CROSS(K,D),1));
底背离:REF(CLOSE,A1+1)>CLOSE AND K>REF(K,A1+1) AND CROSS(K,D) COLORRED;
DRAWLINE(A1=0,D,底背离,D,0),COLORRED,LINETHICK1;
A2:=BARSLAST(REF(CROSS(D,K),1));
顶背离:REF(CLOSE,A2+1)<CLOSE AND REF(D,A2+1)>D AND CROSS(D,K)COLORGREEN;
DRAWLINE(A2=0,D,顶背离,D,0),COLORGREEN,LINETHICK1;
DRAWTEXT(底背离>0,D-5,'底背离'),COLORRED;
DRAWTEXT(顶背离>0,D-5,'顶背离'),COLORGREEN;};