网友求助:

请编写50日内KDJ背离出现两次。在第二次底背离选股.(时间参数,和底背离次数可以修改)

 

解答如下:

N:=9; M1:=3; M2:=3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,M1,1);
D:=SMA(K,M2,1);
J:=3*K-2*D;
T1:=BARSLAST(REF(CROSS(K,D),1));
底背离:=REF(C,T1+1)>C AND REF(K,T1+1)<K AND CROSS(K,D)AND D<50;
COUNT(底背离,50)=2;