n:=20;
B5:=(CLOSE-MA(CLOSE,5))/MA(CLOSE,5)*100;
B10:=(CLOSE-MA(CLOSE,10))/MA(CLOSE,10)*100;
MB10:=MA((CLOSE-MA(CLOSE,10))/MA(CLOSE,10)*100,3);
BN:=(CLOSE-MA(CLOSE,N))/MA(CLOSE,N)*100;
MBN:= MA(((CLOSE-MA(CLOSE,N))/MA(CLOSE,N)*100),8);
股价偏离均线:0;
STICKLINE(MBN>0 AND MBN>REF(MBN,1),MBN,0,0,0),COLORRED;
STICKLINE(MBN<0 AND MBN<REF(MBN,1),MBN,0,0,0),COLORBLUE;
STICKLINE(MBN>0 AND MBN<REF(MBN,1),MBN,0,0,0),COLORGREEN;
STICKLINE(MBN<0 AND MBN>REF(MBN,1),MBN,0,0,0),COLORYELLOW;
A1:=BArslAST(REF(crOSS(BN,MBN),1));
{股旁网-股票公式网站 www.GUpang.com}
底背离:=REF(CLOSE,A1+1)>CLOSE AND BN>REF(BN,A1+1) AND CROSS(BN,MBN);
STICKLINE(底背离,0,0.008,8,0),COLORRED,LINETHICK3;
DRAWLINE(A1=0,MBN,底背离,MBN,0),COLORRED,LINETHICK5;
A2:=BARSLAST(REF(CROSS(MBN,BN),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(MBN,A2+1)>BN AND CROSS(MBN,BN);
DRAWLINE(A2=0,MBN,顶背离,MBN,0),COLORGREEN,LINETHICK5;
DRAWTEXT(ISLASTBAR,股价偏离均线,’太远必回归’),COLORYELLOW;

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。