相关简介:通达信超准乖离率(背离)指标公式源码分享
通达信指标公式源码概况:
指标类别:通达信指标公式
授权方式:免费版
指标评级:★★★★★
指标分类:策略
画线方法:副图
通过短期、中期、长期乖离率判断股票乖离率目前状态,可用于股票入场或离场的指标,若短期乖离率过大,可能会有回归的意图;若短期乖离率过大,可能会有回调的意愿。
通达信指标公式源码:
底:-50;
顶:50;
TR:=SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),14);
HD:=HIGH-REF(HIGH,1);
LD:=REF(LOW,1)-LOW;
PDM:=SUM(IF(HD>0ANDHD>LD,HD,0),14);
MDM:=SUM(IF(LD>0ANDLD>HD,LD,0),14);
PDI:=PDM*100/TR;
MDI:=MDM*100/TR;
A1:=BARSLAST(REF(CROSS(“macd.diff”(12,26,9),”macd.dea”(12,26,9)),1));
B1:=REF(C,A1+1)>CANDREF(“macd.diff”(12,26,9),A1+1)<“macd.diff”(12,26,9)ANDCROSS(“macd.diff”(12,26,9),”macd.dea”(12,26,9));
A2:=BARSLAST(REF(CROSS(“kdj.k”(9,3,3),”kdj.d”(9,3,3)),1));
B2:=REF(C,A2+1)>CANDREF(“kdj.k”(9,3,3),A2+1)<“kdj.k”(9,3,3)ANDCROSS(“kdj.k”(9,3,3),”kdj.d”(9,3,3));
A3:=BARSLAST(REF(CROSS(“RSI.RSI1″(6,12,24),”RSI.RSI2″(6,12,24)),1));
B3:=REF(C,A3+1)>CANDREF(“RSI.RSI1″(6,12,24),A3+1)<“RSI.RSI1″(6,12,24)ANDCROSS(“RSI.RSI1″(6,12,24),”RSI.RSI2″(6,12,24));
C1:=BARSLAST(REF(CROSS(“macd.dea”(12,26,9),”macd.diff”(12,26,9)),1));
D1:=REF(C,C1+1)<CANDREF(“macd.diff”(12,26,9),C1+1)>”macd.diff”(12,26,9)ANDCROSS(“macd.dea”(12,26,9),”macd.diff”(12,26,9));
C2:=BARSLAST(REF(CROSS(“kdj.d”(9,3,3),”kdj.k”(9,3,3)),1));
D2:=REF(C,C2+1)<CANDREF(“kdj.k”(9,3,3),C2+1)>”kdj.k”(9,3,3)ANDCROSS(“kdj.d”(9,3,3),”kdj.k”(9,3,3));
C3:=BARSLAST(REF(CROSS(“RSI.RSI2″(6,12,24),”RSI.RSI1″(6,12,24)),1));
D3:=REF(C,C3+1)<CANDREF(“RSI.RSI1″(6,12,24),C3+1)>”RSI.RSI1″(6,12,24)ANDCROSS(“RSI.RSI2″(6,12,24),”RSI.RSI1″(6,12,24));
C4:=BARSLAST(REF(CROSS(mdi,pdi),1));
D4:=REF(C,C+1)<CANDREF(mdi,C4+1)>mdiANDCROSS(mdi,pdi);
A4:=BARSLAST(REF(CROSS(PDI,MDI),1));
B4:=REF(C,A4+1)>CANDREF(pdi,A4+1)<pdiANDCROSS(pdi,mdi);
DMI底背:IF(B4>0,-50,0),COLOR0099FF,POINTDOT;
DRAWTEXT(DMI底背,-5,’DMI底背’),color0099FF;
DMI顶背:IF(D4>0,50,0),colorblue,POINTDOT;
DRAWTEXT(DMI顶背,15,’DMI顶背’),colorblue;
MACD底背:IF(B1>0,-50,0),colorred,POINTDOT;
DRAWTEXT(MACD底背,-15,’MACD底背’),colorred;
KDJ底背:IF(B2>0,-50,0),colorff00ff,POINTDOT;
DRAWTEXT(KDJ底背,-25,’KDJ底背’),COLORff00ff;
RSI底背:IF(B3>0,-50,0),coloryellow,POINTDOT;
DRAWTEXT(RSI底背,-35,’RSI底背’),coloryellow;
MACD顶背:IF(D1>0,50,0),color00ff00,POINTDOT;
DRAWTEXT(MACD顶背,25,’MACD顶背’),COLOR00ff00;
KDJ顶背:IF(D2>0,50,0),colorffcc66,POINTDOT;
DRAWTEXT(KDJ顶背,35,’KDJ顶背’),COLORffcc66;
RSI顶背:IF(D3>0,50,0),colorffffff,POINTDOT;
DRAWTEXT(RSI顶背,45,’RSI顶背’),COLORffffff;
STICKLINE(B1>0,-50,0,2,0),colorred;
STICKLINE(B2>0,-50,0,2,0),colorff00ff;
STICKLINE(B3>0,-50,0,2,0),coloryellow;
STICKLINE(d1>0,50,0,2,0),color00ff00;
STICKLINE(d2>0,50,0,2,0),colorffcc66;
STICKLINE(d3>0,50,0,2,0),colorwhite;
STICKLINE(B4>0,-50,0,2,0),color0099ff;
STICKLINE(D4>0,50,0,2,0),colorblue;
乖离率:=((((C-MA(C,6))/MA(C,6)+(C-MA(C,24))/MA(C,24)+(C-MA(C,32))/MA(C,32))*100)/3);
STICKLINE(乖离率>0,REFDATE(HHV(乖离率,130),DATE),REFDATE(LLV(乖离率,130),DATE),10,0),
COLOR660066;
STICKLINE(乖离率<0,REFDATE(HHV(乖离率,130),DATE),REFDATE(LLV(乖离率,130),DATE),10,0),
COLOR553300;
STICKLINE(乖离率>0,乖离率,0,2,1),COLOR0000FF;
STICKLINE(乖离率<0,乖离率,0,2,1),COLORCCCC00;
DRAWICON(乖离率<-20AND乖离率>REF(乖离率,1),10,5);
DRAWICON(乖离率<-10ANDC=LLV(C,10)ANDC>REF(C,1)*0.9015,6,1);
STICKLINE(乖离率<-20AND乖离率>REF(乖离率,1),0,乖离率,2,0),COLOR00FFFF;
DRAWICON(乖离率>20AND乖离率<REF(乖离率,1),-10,6);
STICKLINE(乖离率>20AND乖离率<REF(乖离率,1),0,乖离率,2,0),COLOR00CC00;
DRAWICON(V>9ANDFILTER(乖离率<REF(乖离率,1),5),-6,2);
DRAWICON(HHV(乖离率>20,10)ANDCROSS((REF(H,1)+REF(L,1))/2,MA(C,20)+2*STD(C,20)),-10,8);
止损:IF(HHV(乖离率>20,10)ANDFILTER(乖离率<REF(乖离率,1),6)ANDCROSS(MA(C,5),MA(C,2)),-10,0),
,LINETHICK2,COLOR00CC00;
[源码注释]通达信公式动态翻译结果
输出XG:1日前的收盘价/1日前的收盘价>1.08并且收盘价<1日前的收盘价并且平盘并且最高价不等于收盘价并且最低价不等于收盘价并且成交量(手)<1日前的成交量(手)
评论(0)