源碼如下:
n 1 100 20
n1 1 250 6
MID := MA(CLOSE,N);
HH:=MID + 2*STDP(CLOSE,N);
LL:=MID - 2*STDP(CLOSE,N);
RSV:= (close-MID)/STDP(close,N)*100;
k:SMA(RSV,3,1),colorwhite;
D:SMA(K,3,1),coloryellow;
J:3*K-2*D,pointdot;
stickline(k>d,k,d,4,0),colorred;
stickline(k<d,k,d,4,0),color00ff00;
m:=j-k;
stickline(k>d and
m>ref(m,1),k,j,4,0),colorred;
stickline(k>d and
m<ref(m,1),k,j,4,0),coloryellow;
stickline(k<d and
m>ref(m,1),k,j,4,0),colorbb0000;
stickline(k<d and
m<ref(m,1),k,j,4,0),colorgreen;
-170,colorgreen;
0,pointdot,colorff9000;
170,colorred;
drawtext(cross(ref(m,1),m) and
j>170,j*1.2,'S'),colorwhite;
drawtext(cross(m,ref(m,1)) and
j<-170,j,'B'),colorred;
乖離率
:(CLOSE-MA(CLOSE,N1))/MA(CLOSE,N1)*1000,COLORwhite,LINETHICK2;
預(yù)警用的交易公式
MID := MA(CLOSE,N);
HH:=MID + 2*STDP(CLOSE,N);
LL:=MID - 2*STDP(CLOSE,N);
RSV:= (CLOSE-MID)/STDP(CLOSE,N)*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
M:=J-K;
{多頭買入} ENTERLONG:CROSS(M,REF(M,1)) AND J<-170
;
{多頭賣出} EXITLONG:CROSS(REF(M,1),M) AND J>170
;此公式請(qǐng)謹(jǐn)慎使用
|