常用到的背离指标通达信指标公式源码
根据KDJ背离指标通达信指标公式源码
根据KDJ背离指标通达信指标公式源码
KDJ背离指标是一种技术分析工具,常用于股票和期货市场。
下面是通达信指标公式源码,可以用于计算KDJ背离指标。
公式源码:
J1:(C - LOWEST(LOW,N))/(HIGHEST(HIGH,N) -
LOWEST(LOW,N)) * 100
KDJ背离:interval=1;
KDJ背离支撑线:J2<=SUPPORTLINEDowncrossNum;
KDJ背离阻力线:J2>=RESISTLINEDowncrossNum;
背离K线买入信号:CROSS(K,J);
背离K线卖出信号:CROSS(J,K);
背离J线买入信号:CROSS(J,J2);
背离J线卖出信号:CROSS(J2,J);
上述源码中的K、N、M1、M2、SUPPORTLINEDowncrossNum和RESISTLINEDowncrossNum都是用户可以自定义的参数。
在使用该指标时,可以根据具体需求进行调整。
KDJ背离指标的计算方法主要是通过计算价格与KDJ指标之间的背离程度来判断市场的买卖信号。
背离是指价格与指标之间的不一致,当价格创新高而指标没有创新高时,被认为是背离。
KDJ背离指标可以作为辅助分析工具,帮助投资者判断买卖时机。
但需要注意,技术指标并不能保证100%的准确性,投资决策还需要结合其他因素进行综合考虑。
总结来说,根据KDJ背离指标通达信指标公式源码可以帮助投资者计算KDJ背离指标,辅助投资决策。
但在实际使用中,需要根据个人需求和市场情况进行参数调整和综合分析。
参考资料:。
通达信精准的背离主图指标公式
通达信精准的背离主图指标公式高:=CONST(REF(HHV(H,150),3));低:=CONST(REF(LLV(L,150),3));NN:=100;N:=9;LC:=REF(C,1);QC:=REF(C,2);AA:=REF(H,N)=HHV(H,2*N+1);AA1:=REF(L,N)=LLV(L,2*N+1);QY:=BACKSET(AA,N+1);QY1:=BACKSET(AA1,N+1);CC:=FILTER(QY,N) AND H=HHV(H,N+1);CC1:=FILTER(QY1,N) AND L=LLV(L,N+1); DDD:=BARSLAST(CC); DD1:=BARSLAST(CC1); GDTS:=IF(CC,CURRBARSCOUNT,0);DDTS:=IF(CC1,CURRBARSCOUNT,0);UTS:=IF(DDD,REF(GDTS,DDD),GDTS);DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS); GDCS1:=CONST(UTS);DDCS1:=CONST(DDTS1);GDCS13:=CONST(REF(H,GDCS1-1));DDCS13:=CONST(REF(L,DDCS1-1));SS1:=REF(UTS,DDD+1);TS2:=REF(DDTS1,DD1+1);GDCS2:=CONST(SS1);DDCS2:=CONST(TS2);M:=INTPART(3*N/5);AAA:=REF(H,M)=HHV(H,2*M+1);QYY:=BACKSET(AAA,M+1);CCC:=FILTER(QYY,M) AND H=HHV(H,M+1); DDDD:=BARSLAST(CCC),NODRAW; GDTSS:=IF(CCC,CURRBARSCOUNT,0); TSS:=IF(DDDD,REF(GDTSS,DDDD),GDTSS); GDCS11:=CONST(TSS);TS11:=REF(TSS,DDDD+1);GDCS22:=CONST(TS11);AA11:=REF(L,M)=LLV(L,2*M+1);QY11:=BACKSET(AA11,M+1);CC11:=FILTER(QY11,M) AND L=LLV(L,M+1); DD11:=BARSLAST(CC11);DDTSS:=IF(CC11,CURRBARSCOUNT,0); DDTS11:=IF(DD11,REF(DDTSS,DD11),DDTSS); DDCS11:=CONST(DDTS11);DDTS22:=REF(DDTS11,DD11+1);DDCS22:=CONST(DDTS22);ZGD:=HHV(H,60)*1.01.00;ZGD2:=CONST(ZGD);高压M:=DRAWLINE(CURRBARSCOUNT=GDCS22,H,CURRBA RSCOUNT=GDCS11,H,1),COLORRED,LINETHICK1;低撑M:=DRAWLINE(CURRBARSCOUNT=DDCS22,L,CURRBA RSCOUNT=DDCS11,L,1) COLORRED,LINETHICK1;高压1:=DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBAR SCOUNT=GDCS1,H,1) ,COLORBLUE,LINETHICK1;低撑1:=DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARS COUNT=DDCS1,L,1),COLORBLUE,LINETHICK1;高点:=CONST(HHV(H,NN));低点:=CONST(LLV(L,NN));{背景变色}R1:=C>LC AND C>QC;R2:=REF(R1,1) AND C=QC;R3:=REF(R2,1) AND C>=LC AND CR4:=REF(R3,1) AND C=QC;R5:=REF(R4,1) AND C>=LC AND CR6:=REF(R5,1) AND C=QC;R7:=REF(R6,1) AND C>=LC AND CR8:=REF(R7,1) AND C=QC;R9:=REF(R8,1) AND C>=LC AND CRA:=REF(R9,1) AND C=QC;RB:=REF(RA,1) AND C>=LC AND CRC:=REF(RB,1) AND C=QC;RD:=CRE:=REF(RD,1) AND C>=LC AND CRF:=REF(RE,1) AND C=QC;R10:=REF(RF,1) AND C>=LC AND CR11:=REF(R10,1) AND C=QC;R12:=REF(R11,1) AND C>=LC AND CR13:=REF(R12,1) AND C=QC;R14:=REF(R13,1) AND C>=LC AND CR15:=REF(R14,1) AND C=QC;R16:=REF(R15,1) AND C>=LC AND CR17:=REF(R16,1) AND C=QC;R18:=REF(R17,1) AND C>=LC AND CR19:=REF(RD OR RE OR RF OR R10 OR R11 OR R12 ORR13 OR R14 OR R15 OR R16 OR R17 OR R18,1) AND R1;R1A:=((REF(R1 OR R2 OR R3 OR R4 OR R5 OR R6 OR R7 OR R8 OR R9 OR RA OR RB OR RC,1)) AND RD);VAR3:=IF(CVAR4:=(H+LC)/3;VAR5:=EMA((O+H+L+C)/4,2330);VAR6:=(V AR5 + ((V AR5 * 6) / 100));短买:R19,NODRAW,COLOR00AAAA;离场:R1A,NODRAW,COLORFF7700;持股:R1 OR R2 OR R3 OR R4 OR R5 OR R6 OR R7 OR R8 OR R9 OR RA OR RB OR RC,NODRAW,COLOR8000FF;观望:RD OR RE OR RF OR R10 OR R11 OR R12 OR R13 OR R14 OR R15 OR R16 OR R17 ORR18,NODRAW,COLOR767628;超跌:=(C-MA(C,34))/MA(C,34)*100Q1:=CONST(IF(短买,100,IF(离场,0,IF(持股,100,IF(超跌,150,40))))),NODRAW;Q2:=CONST(IF(短买,100,IF(离场,66,IF(持股,0,IF(超跌,150,118))))),NODRAW;Q3:=CONST(IF(短买,0,IF(离场,132,IF(持股,50,IF(超跌,150,118))))),NODRAW;DRAWBAND(高点,RGB(Q1,Q2,Q3),低点,DRAWNULL);C1:=IF(短买,短买,DRAWNULL),;C2:=IF(离场,离场,DRAWNULL),;{DDE金指N: 1, 999, 13;}JH:=SMA(MAX(C-REF(C,1),0),6,1)/SMA(ABS(C-REF(C,1)), 6,1)*100;SZ:=FILTER(CROSS(JH,35),13);SX:=FILTER(CROSS(JH,30),7);SQ:=FILTER(CROSS(71,JH),74);SD:=FILTER(CROSS(80,JH),74);CCL:=REF(HHV(C,120),1);DD:=REF(LLV(C,120),1);WW:=100*(C-DD)/(CCL-DD);EE:=AMOUNT;FF:=(EMA(EE,5)/REF(EMA(EE,5),5));低买:IF(CAPITAL变盘:FILTER(OO ANDV>REF(V,1),13),COLORFF88FF,NODRAW;霸占:=FILTER((FF>=2 AND WW30 OR (FF>=2 AND WW 顶部:=IF(CAPITAL持股K:C>REF(C,1),COLOR0099FF,NODRAW;持币K:C平盘:=C=REF(C,1),COLOR999999,NODRAW;STICKLINE(持股K,H,L,3,1),COLOR0099FF; STICKLINE(持股K,C,O,1.5,0),COLOR0099FF; STICKLINE(持币K,H,L,3,1),COLORFF9900; STICKLINE(持币K,C,O,1.5,0),COLORFF9900; STICKLINE(平盘,H,L,3,1),COLOR999999;STICKLINE(平盘,C,O,1.5,0),COLOR999999; STICKLINE(霸占,H,L,3,1),COLOR0000CC;STICKLINE(霸占,C,O,1.5,0),COLOR0000CC; STICKLINE(变盘,H,L,3,1), COLORFF88FF; STICKLINE(变盘,C,O,1.5,0),COLORFF88FF; STICKLINE(低买,H,L,3,1),COLOR22FFFF;STICKLINE(低买,C,O,1.5,0),COLOR22FFFF; STICKLINE(顶部,H,L,3,1),COLOR00CC00;STICKLINE(顶部,C,O,1.5,0),COLOR00CC00;趋势线:=3*SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))*100,5,1) -2*SMA(SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))*100,5,1),3,1),COLORBCBC00,NOD RAW;ZZ:=趋势线>REF(趋势线,1);{阻力支撑}QWX1:=HHV(C,30);QWX2:=LLV(C,30);QWX3:=CONST((QWX1+QWX2)/2);QWX4:=ABS((2*C+H+L)/4-MA(C,20))/MA(C,20);QWX5:=CONST((1-7/100)*(DMA(C,QWX4)));QWX6:=CONST((1+7/100)*(DMA(C,QWX4)));阻力:IF(BARSLAST(CURRBARSCOUNT=12),QWX6,DRAWN ULL),COLORFF9D3C,LINETHICK1,CIRCLEDOT;支撑:IF(BARSLAST(CURRBARSCOUNT=12),QWX5,DRAWN ULL),COLORFF00FF,LINETHICK1,CIRCLEDOT;{最佳买入选股}RSI5:=(SMA(MAX((C-LC),0),5,1)/SMA(ABS((C-LC)),5,1))*1 00;TR1:=SUM(MAX(MAX((H-L),ABS(H-REF(C,1))),ABS(L-RE F(C,1))),10);HD:=H-REF(H,1);LD:=REF(L,1)-L;DMP:=SUM(IF((HD>0 AND HD>LD),HD,0),10);DMM:=SUM(IF((LD>0 AND LD>HD),LD,0),10);PDI:=DMP*100/TR1;MDI:=DMM*100/TR1;ADX:=MA((ABS((MDI-PDI)/(MDI+PDI))*100),5);AV:=RSI5+ADX;DXR:=(ADX+REF(ADX,5)/2)+RSI5;WR10:=(100*(HHV(H,10)-C))/(HHV(H,10)-LLV(L,10)); NEWVOL:=RSI5-WR10;最佳买入:=A V+NEWVOL;J:="KDJ.J";X:=LLV(J,2)=LLV(J,8);买入时机:=(CROSS(J,3));佳选A:=CROSS(最佳买入,0);{DIF综合抓牛}RSIA:=(SMA(MAX(C-LC,0),6,1)/SMA(ABS(C-LC),6,1)*100)/ 100;WR:=-100*(HHV(H,14)-C)/(HHV(H,14)-LLV(L,14));反向:=((0-WR)-100)/100,;角度差:=1-(反向/RSI);角度2:=MA(角度差,2);角度4:=MA(角度差,4);角度差A:=角度差>MA(角度差,3)*1.3;转向:=REF(角度差,1)REF(角度差,1) AND REF(角度差,1) SS:=COUNT(转向,4)>0 OR COUNT(角度差A,4)>0;DIF买:=CROSS(角度2,角度4) AND SS,COLOR0088FF;{精准买点}CYC13:=0.01*EXPMA(AMOUNT,13)/EXPMA(V,13);CYS:=(C-CYC13)/CYC13*100;逢低买入:=IF("ZXNH.ZXNH"=1 AND CYS抓牛A:=DIF买&&逢低买入;到:=(HHV(H,21)-C)/(HHV(H,21)-LLV(L,21))*100-10;底:=(C-LLV(L,21))/(HHV(H,21)-LLV(L,21))*100;啦:=SMA(底,13,8);哈:=CEILING(SMA(啦,13,8));哈哈:=SMA(到,21,8);差:=哈-哈哈,COLORFFFFFF;RC1:=REF((L+O+C+H)/4,1);RC2:=SMA(ABS(L-RC1),13,1)/SMA(MAX(LOW-RC1,0),10,1);RC3:=EMA(RC2,10);RC4:=LLV(L,33);RC5:=EMA(IF(L建仓:=IF(RC5>REF(RC5,1),RC5,0);洗:=IF(RC5启动A:=FILTER(REF(差,1)REF(差,1) AND (建仓OR 洗),3); {乖离破底}X3:=(2*C+L+H)/4;地:=EMA(X3,55)*0.84,;乖离5:=(C-MA(C,5))/MA(C,5)*100,NODRAW;乖离A:=FILTER(LREF(乖离5,1),3);趋势:=7*SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))*30,4,1) -3*SMA(SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))*30,4,1 ),3,1)-SMA(SMA(SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))*30 ,4,1),3,1),2,1);天线:=78.89;逃顶:=CROSS(天线,趋势);低吸A:=CROSS(趋势,5);{内能线}ZF:=((C-REF(C,1))/REF(C,1))*100;HSL:=(V/CAPITAL)*100;KK:=ZF/HSL,COLOR6000FF;KK5:=MA(KK,5),COLORFFAA00;LL:=LLV(KK,34);内能买A:=CROSS(KK,KK5)&&REF(KK,1){包赚不赔}止跌:=(REF(EVERY(CO);VAR1N:=MA(C,5),;VAR2N:=MA(C,10);VAR3N:=(V AR1N-C)/C>3/100;VAR4N:=(V AR2N-V AR1N)/V AR1N>0.03;VAR5N:=LLV(C,30)=LLV(C,120);底部:=VAR3N AND V AR4N AND V AR5N;包赚A:=BARSLAST(底部){深坑挖金}A:=REF(C,1);RSIK:=SMA(MAX(C-A,0),6,1)/SMA(ABS(C-A),6,1)*100;A4:=RSIAZZF:=(C/REF(C,1)-1)*100;深坑1:=IF(BETWEEN(A4,0,5) AND LCD:= C>=O AND REF(深坑1 ,1)=20 AND REF(RSI,1) 深坑A:=C>O AND REF(深坑1 ,1)=20 AND REF(RSI,1) 深坑★:IF(深坑A,L*1.005,DRAWNULL)COLOR55FF55,CIRCLEDOT,LINE THICK5;佳选★:IF(佳选A,L*0.995,DRAWNULL)COLORFF88FF,CIRCLEDOT,LINE THICK4;启动★:IF(启动A,L*0.99,DRAWNULL)COLORFFFF00,CIRCLEDOT,LINETHICK4;抓牛★:IF(抓牛A,L*0.985,DRAWNULL)COLOR0088FF,CIRCLEDOT,LINET HICK4;乖离底★:IF(乖离A,L*0.98,DRAWNULL)COLORFFFFFF,CIRCLEDOT,LINET HICK4;内能买★:IF(内能买A,L*0.975,DRAWNULL)COLOR0000FF,CIRCLEDOT,LINET HICK4;低吸★:IF(低吸A,L*0.97,DRAWNULL)COLOR00FFFF,CIRCLEDOT,LINET HICK4;包赚★:IF(包赚A,L*0.965,DRAWNULL)COLORFF00FF,CIRCLEDOT,LINE THICK4;B01:=IF(佳选A,1,0);B02:=IF(启动A,1,0);B03:=IF(抓牛A,1,0);B04:=IF(乖离A,1,0);B05:=IF(内能买A,1,0);B06:=IF(低吸A,1,0);B07:=IF(包赚A,1,0);B08:=IF(深坑A,1,0);【共振】:B01+B02+B03+B04+B05+B06+B07+B08,COLOR00FFF F,NODRAW;DRAWICON(【共振】>=4,H*1.008,34);持币线:EMA(C,13),COLOR32E01F,LINETHICK3;持股线:IF(持币线>REF(持币线,1),持币线,DRAWNULL),COLOR460CF3,LINETHICK3;{画线}IF(BETWEEN(高压M,高点,低点),高压M,DRAWNULL),COLOR00CCFF,LINETHICK1;IF(BETWEEN(低撑M,高点,低点),低撑M,DRAWNULL),COLOR00CCFF,LINETHICK1;IF(BETWEEN(高压1,高点,低点),高压1,DRAWNULL),COLORCCCCCC,LINETHICK1;IF(BETWEEN(低撑1,高点,低点),低撑1,DRAWNULL),COLORCCCCCC,LINETHICK1;中:=(MA(C,3)+MA(C,6)+MA(C,12)+MA(C,24))/4,COLORFF FFFF;VAR326:=IF(C AND MA(VOL,5)/240 AND C>LC*1.0 AND C,88,0);VAR327:=IF(C/LC>1.050 AND VOL/CAPITAL*1000, 91, 0); DRAWTEXT(V AR327>90,L*0.993,'↖杀庄'),COLOR00FFFF; {背离}RSI:=(SMA(MAX((C-LC),0),3,1)/SMA(ABS((C-LC)),3,1))*100;FFF:=EMA(C,3);MA15:=EMA(C,21);顶背:=CROSS(88,RSI);DRAWTEXT(CROSS(FFF,MA15),L,'←底背'),COLORFF88FF;CCI:="CCI";CCI3:=MA(CCI,3);CCI7:=MA(CCI,7);头:=CROSS(CCI3,CCI) AND (CCI>130);STICKLINE(头,H*1.005,H*1.01,4,0),COLOR00CC00; DRAWTEXT(头,H*1.01,'头'),COLORFFFFFF;STICKLINE(逃顶,H*1.01,H*1.015,4,0),COLORFFFFFF;卖出警报:=(头AND 顶背),COLOR0000FF;STICKLINE(卖出警报,H*1.016,H*1.025,4,0),COLOR0000FF; DRAWTEXT(卖出警报,H*1.028,'空仓'),COLORFFFFFF; DRAWICON(顶背,H*1.016,8);DRAWTEXT(顶背,H*1.02,'←顶背'),COLOR98FF75;DRAWTEXT_FIX(1,0.92,0.01,0,STRCAT(STRCAT('【共振】',CON2STR(【共振】,1)),' ')),COLOR00FFFF;。
根据趋势指标背离指标通达信指标公式源码
根据趋势指标背离指标通达信指标公式源
码
引言
趋势指标背离指标是投资者在股票市场中用来判断股票价格走势是否背离趋势的一种技术分析工具。
本文将介绍通达信软件中使用的趋势指标背离指标的公式源码。
公式源码解析
以下是通达信软件中趋势指标背离指标的公式源码:
公式1:
SAR=[前一周期SAR]+[前一周期AF*(前一周期EP-前一周期SAR)]
其中,SAR代表后续发展停轨,AF代表加速因子,EP代表极点价格。
公式2:
VR=(AVS-BVS)/(AVS+BVS)
其中,VR代表成交量比率,AVS代表上升成交量,BVS代表
下降成交量。
公式3:
DMI:=(HHV(HIGH,N)-LLV(LOW,N))/N
其中,DMI代表指标值,HHV代表最高价的最高值,LLV代
表最低价的最低值,N代表周期。
公式4:
MACD:=EMA(CLOSE,SHORT)-EMA(CLOSE,LONG)
其中,MACD代表指标值,EMA代表指数平均值,CLOSE代
表收盘价,SHORT代表短期周期,LONG代表长期周期。
结论
趋势指标背离指标是通达信软件中常用的技术分析工具之一。
通过分析股票价格和成交量的走势,投资者可以使用这些公式来判
断市场的趋势是否背离实际情况,从而作出相应的投资决策。
然而,投资者在使用这些指标时应注意市场环境的变化和其他重要信息的
综合分析,以取得更准确的结果。
以上是根据趋势指标背离指标通达信指标公式源码的文档。
希望对您有所帮助。
精准的背离通达信指标公式源码.doc
高:=CONST(REF(HHV(H, 150),3));低:=CONST(REF(LLV(L, 150),3));NN: = 100;N:=9;LC: = REF(C,1);QC:=REF(C,2);AA:=REF(H,N)=HHV(H,2*N+1);AA1: = REF(L,N)=LLV(L,2*N+1);QY:=BACKSET(AA,N+1);QY1:=BACKSET(AA1Z N+1);CC:=FILTER(QY,N) AND H=HHV(H,N+1);CC1:=FILTER(QY1,N) AND L=LLV(L,N+1); DDD: = BARSLAST(CC); DD1:=BARSLAST(CC1);GDTS:=IF(CC,CURRBARSCOUNTO);DDTS:=IF(CC1,CURRBARSCOUNTO);UTS:=IF(DDD,REF(GDTS,DDD)Z GDTS);DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS); GDCS1:=CONST(UTS);DDCS1:=CONST(DDTS1);GDCS13:=CONST(REF(H Z GDCS1-1));DDCS13:=CONST(REF(L Z DDCS1-1));SS1:=REF(UTS,DDD+1);TS2:=REF(DDTS1,DD1+1);GDCS2:=CONST(SS1);DDCS2:=CONST(TS2);M:=INTPART(3*N/5);AAA:=REF(H,M)=HHV(H,2*M+1);QYY:=BACKS ET(AAA, M+l);CCC:=FILTER(QYY,M) AND H=HHV(H,M+1);DDDD:=BARSLAST(CCC),NODRAW;GDTSS:=IF(CCC,CURRBARSCOUN1;0);TSS:=IF(DDDD,REF(GDTSS,DDDD),GDTSS);GDCSU:=CONST(TSS);TS11: = REF(TSS,DDDD+1);GDCS22:=CONST(TS11);AA11:=REF(L,M)=LLV(L,2*M+1);QY11:=BACKSET(AA11,M+1);CC11:=FILTER(QY11Z M) AND L=LLV(L,M+1);DDU:=BARSLAST(CC11);DDTSS:=IF(CC11,CURRBARSCOUNTO);DDTS11:=IF(DD11,REF(DDTSS,DD11)Z DDTSS);DDCS11:=CONST(DDTS11);DDTS22: = REF(DDTS11Z DD11+1);DDCS22:=CONST(DDTS22);ZGD:=HHV(H,60)*1.01.00;ZGD2:=CONST(ZGD);高压M:=DRAWLINE(CURRBARSCOUNT=GDCS22,H/CURRBARSCOUNT=GDCS11,H Z1),COLORR ED,LINETHICK1;低撑M: = DRAWLINE(CURRBARSCOUNT=DDCS22Z L,CURRBARSCOUNT=DDCS11,L,1) COLORRED,LINETHICK1;高压1:=DRAWLINE(CURRBARSCOUNT=GDCS2Z H Z CURRBARSCOUNT=GDCS1,H,1) ,COLORBLU E,LINETHICK1;低撑1:=DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L Z1),COLORBLUE LINETHICK1;Z高点:=CONST(HHV(H,NN));低点:=CONST(LLV(L,NN));{背景变色}R1:=C>LC AND C>QC;R2:=REF(R1,1) AND C< = LC AND C>=QC;R3:=REF(R2,1) AND C> = LC AND C<=QC;R4:=REF(R3,1) AND C< = LC AND C>=QC;R5:=REF(R4,1) AND C> = LC AND C<=QC;R6:=REF(R5,1) AND C< = LC AND C>=QC;R7:=REF(R6,1) AND C>=LC AND C<=QC;R8:=REF(R7,1) AND C<=LC AND C>=QC;R9:=REF(R8,1) AND C> = LC AND C<=QC;RA: = REF(R9,1) AND C<=LC AND C>=QC;RB:=REF(RA,1) AND C> = LC AND C<=QC;RC: = REF(RB,1) AND C< = LC AND C>=QC;RD:=C<LC AND C<QC;RE: = REF(RD,1) AND C>=LC AND C<=QC;RF:=REF(RE,1) AND C<=LC AND C>=QC;R10:=REF(R51) AND C> = LC AND C<=QC;R11:=REF(R1O,1) AND C<=LC AND C>=QC;R12:=REF(R11,1) AND C>=LC AND C<=QC;R13:=REF(R12,1) AND C<=LC AND C>=QC;R14:=REF(R13,1) AND C>=LC AND C<=QC;R15:=REF(R14,1) AND C<=LC AND C>=QC;R16:=REF(R15,1) AND C>=LC AND C<=QC;R17:=REF(R16,1) AND C<=LC AND C>=QC;R18:=REF(R17,1) AND C>=LC AND C<=QC;R19:=REF(RD OR RE OR RF OR RIO OR Rll OR R12 OR R13 OR R14 OR R15 OR R16 OR R17 OR R18,l) AND Rl;R1A:=((REF(R1 OR R2 OR R3 OR R4 OR R5 OR R6 OR R7 OR R8 OR R9 OR RA OR RB OR RC,1)) AND RD);VAR3:=IF(Cv200 ,MA(COST(80),3),2500),NODRAW;VAR4:=(H+LC)/3;VAR5:=EMA((O+H+L+C)/4,2330);VAR6:=(VAR5 + ((VAR5 * 6) / 100));短买:R19,NODRAW,COLOROOAAAA;离场:RIA,NODRAW,COLORFF7700;持股:R1 OR R2 OR R3 OR R4 OR R5 OR R6 OR R7 OR R8 OR R9 OR RA OR RB ORRC,NODRA\A4COLOR80QOFF;观望:RD OR RE OR RF OR RIO OR Rll OR R12 OR R13 OR R14 OR R15 OR R16 OR R17 ORR18,NODRAW,COLOR767628;超跌:=(C-MA(C,34))/MA(C,34)*100<-14,COLORBBBBBB,NODRAW;Q1:=CONST(IF(短买z100,IF(离场,0,IF(持股,100,IF(超跌,150,40))))),NODRAW;Q2:=CONST(IF(短买,100,IF(离场,66Z IF(持股,0,IF(超跌,150,118))))),NODRAW;Q3:=CONST(IF(短买,0,IF(离场,132,IF(持股,50,IF(超跌,150,118))))),NODRAW; DRAWBAND(高点,RGB(Q1,Q2,Q3),低点,DRAWNULL);C1:=IF(短买,短买,DRAWNULL),;C2:=IF(离场,离场,DRAWNULL),;{DDE 金指N: 1, 999, 13;}JH:=SMA(MAX(C-REF(C,1),0),6,1)/SMA(ABS(C-REF(C,1)),6,1)*100;SZ:=FILTER(CROSS(JH,35),13);SX:=FILTER(CROSS(JH,30),7);SQ:=FILTER(CROSS(71,JH),74);SD:=FILTER(CROSS(80,JH),74);CCL: = REF(HHV(C,120),1);DD:=REF(LLV(C,120),1);WW: = 100*(C-DD)/(CCL-DD);EE:=AMOUNT;FF:=(EMA(EE,5)/REF(EMA(EE,5),5));低买:IF(CAPITAL<l z SZ,SX),COLOR22FFFI;NODRAW;变盘:FILTER(OvREF(L,l) AND C>0 AND V>REF(V1),13),COLORFF88F£NODRAW;霸占:=FILTER((FF>=2 AND WW<35 AND BARSCOUNT(C)>30 OR (FF>=2 AND WW<100) AND BARSCOUNT(C)<50),90)Z COLOROOOOAA,NODRAW;顶部:=IF(CAPITALvl,SQ,SD),COLOROOCCOO,NODRAW;持股K:C>REF(C,1),COLOR0099F5NODRAW;持币K:C<REF(C,1),COLORFFAAOO,NODRAW;平盘:=C=REF(C,1),COLOR999999,NODRAW;STICKLINE(持股K,H Z L,3,1)/COLOR0099FF;STICKLINE(持股K,C,O,1.5,0),COLOR0099FF;STICKLINE(持币K,H,L,3,1),COLORFF9900;STICKLINE(持币K,C Z O Z 1.5z O),COLORFF9900;STICKLINE(平盘,H,L,3,1),COLOR999999;STICKLINE(平盘,C,O,1.5,0),COLOR999999;STICKLINE(霸占,H,L,3,1),COLOROOOOCC;STICKLINE(霸占,C,0,1.5,0),COLOROOOOCC;STICKLINE(变盘,H,L,3,1), COLORFF88FF;STICKLINE(变盘,C,0,1.5,0),COLORFF88FF;STICKLINE(低买,H,L Z3,1),COLOR22FFFF;STICKLINE(低买,C,O,L5Q),COLOR22FFFF;STICKLINE(顶部,H,L,3,1),COLOROOCCOO;STICKLINE(顶部,C,0,1.5,0),COLOROOCCOO;趋势线:=3*SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))*100,5,1)-2*SMA(SMA((C-LLV(L Z27))/ (HHV(H z27)-LLV(L,27))*100,5,1),3,1),COLORBCBCOO,NODRAW;22:=趋势线〉REF(趋势线,1);{阻力支撑}QWX1:=HHV(C,3O);QWX2:=LLV(C,30);QWX3:=CONST((QWXl+QWX2)/2);QWX4:=ABS((2*C+H+L)/4・MA(C,20))/MA(C,20);QWX5:=CONST((l-7/100)*(DMA(C,QWX4)));QWX6:=CONST((l+7/100)*(DMA(C,QWX4)));阻力:IF(BARSU\ST(CURRBARSCOUNT=12),QWX6,DRAWNULL),COLORFF9D3C,LINETHICK1,CIRCLEDOT;支撑:IF(BARSLAST(CURRBARSCOUNT=12),QWX5,DRAWNULL),COLORFFOOF^LINETHICKl, CIRCLEDOT;{最佳买入选股}RSI5:=(SMA(MAX((C・LC),0),5,l)/SMA(ABS((C・LC)),5,l))*100;TR1:=SUM(MAX(MAX((H-L),ABS(H-REF(C,1))),ABS(L-REF(C,1))),1O);HD:=H-REF(H,1);LD:=REF(L,1)-L;DMP:=SUM(IF((HD>0 AND HD>LD),HD,0),10);DMM:=SUM(IF((LD>0 AND LD>HD),LD,0),10);PDI:=DMP*100/TRl;MDI:=DMM*100/TRl;ADX:=MA((ABS((MDI-PDI)/(MDI+PDI))*100),5);AV: = RSI5+ADX;DXR:=(ADX+REF(ADX,5)/2)+RSI5;WR10:=(100*(HHV(H,10)-C))/(HHV(H,10)-LLV(L,10));NEWVOL:=RSI5-WR10;最佳买入:=AV+NEWVOL;J:=”KDJ.J“;X:=LLV(J,2)=LLV(J,8);买入时机:=(CROSS(J,3));佳选A:=CROSS(最佳买入,0);{DIF综合抓牛}RSIA:=(SMA(MAX(C・LC,0),6,l)/SMA(ABS(C・LC),6,1)*100)/100;WR:=・100*(HHV(H,14)・C)/(HHV(H,14)・LLV(L,14));反向:=((0-WR)-100)/100z;角度差:=1 ■(反向/RSI);角度2: = MA(角度差,2);角度4: = MA(角度差,4);角度差A:=角度差>MA(角度差,3)*13;转向:=REF(角度差,l)vREF(角度差,2) AND角度差〉REF(角度差,1) AND REF(角度差,1)<1.06; SS:=COUNT(转向z4)>0 OR COUNT(角度差A,4)>0;DIF 买:=CROSS(角度2,角度4) AND SS,COLOR0088FF;{精准买点}CYC13:=0.01*EXPMA(AMOUNT13)/EXPMA(V13);CYS:=(C-CYC13)/CYC13*100;逢低买入:=IF(”ZXNH.ZXNH”=1 AND CYS<=-2,0.6,0);抓牛A:=DIF买&&逢低买入;到:=(HHV(H,21)・C)/(HHV(H,21)・LLV(L,21))*100-10;底:=(C-LLV(L,21))/(HHV(H,21)・LLV(L,21))*100;啦:=SMA(底,13,8);哈:=CEILING(SMA(啦,13,8));哈哈:=SMA(到,21,8);差:=哈-哈哈,COLORFFFFFF;RC1:=REF((L+O+C+H)/4,1);RC2:=SMA(ABS(L-RC1),13,1)/SMA(MAX(LOW-RC1,0),10,1);RC3:=EMA(RC2,10);RC4:=LLV(L,33);RC5:=EMA(IF(Lv=RC4,RC3,0),3),;建仓:=IF(RC5>REF(RC5,l),RC5,0);洗:=IF(RC5vREF(RC5,l),RC5,0),;启动A:=FILTER(REF(差z l)<-70 AND 差〉REF(差,1) AND (建仓OR 洗),3); {乖离破底}X3:=(2*C+L+H)/4;地:=EMA(X3,55)*0.84,;乖离5:=(C-MA(C,5))/MA(C,5)*100,NODRAW;乖离A:=FILTER(L<地AND REF(乖离5J)<-5 AND 乖离5>REF(乖离5,1),3);趋势:=7*SMA((C・LLV(L,27))/(HHV(H,27)・LLV(L,27))*30,4,l)・3*SMA(SMA((C-LLV(L,27))/(HHV(H,27)-U_V(L,27))*30,4,l),3,l)・SMA(SMA(SMA((C・LLV(L,27))/(HHV(H,27)・LLV(L,27))*3041),3,1),2,1); 天线:=78.89;逃顶:=CROSS(天线,趋势);低吸A:=CROSS(趋势,5);{内能线}ZF:=((C-REF(C,l))/REF(C,l))*100;HSL:=(V/CAPITAL)*100;KK:=ZF/HSL z COLOR6000FF;KK5:=MA(KK,5),COLORFFAAOO;LL:=LLV(KK,34);内能买A:=CROSS(KK,KK5)&&REF(KK,l)v=LL&&ZZ,;{包赚不赔}止跌:=(REF(EVERY(CvO,2),l) AND C>0);VAR1N:=MA(C,5),;VAR2N:=MA(C,10);VAR3N:=(VARlN-C)/C>3/100;VAR4N:=(VAR2N-VAR1N)/VAR1N>O.O3;VAR5N:=LLV(C,30)=LLV(C Z 120);底部:=VAR3N AND VAR4N AND VAR5N;包赚A:=BARSU\ST(底部)<=2 AND 止跌Z COLORFF8800,NODRAW;{深坑挖金}A: = REF(C,1);RSIK:=SMA(MAX(C-A,0),6,l)/SMA(ABS(C-A),6,l)*100;A4:=RSIA<20;ZZF:=(C/REF(C,l)-l)*100;深坑l:=IF(BETWEEN(A4,0,5) AND L<=REF(C,A4)ANDZZF<=-5 z20z O),COLORFFOOOO,LINETHICK2;CD:= 0=0 AND REF(深坑1 ,1)=20 AND REF(RSI z l)<20 ;深坑A:=C>0 AND REF(深坑 1 ,1)=20 AND REF(RSI,l)<20;深坑★:【「(深坑A Z L*1.005,DRAWNULL)COLOR55FF55Z CIRCLEDOT;LINETHICK5;佳选★:【「(佳选A,L*0.995,DRAWNULL)COLORFF88FECIRCLEDOTLINETHICK4;启动★:,(启动A,L*0.99,DRAWNULL)COLORFFFFOO,CIRCLEDOTLINETHICK4;抓牛★:【「(抓牛A,L*0.985/DRAWNULL)COLOR0088F5CIRCLEDO7;LINETHICK4;乖离底★*(乖离A,L*0.98,DRAWNULL)COLORFFFFF^CIRCLEDOT;LINETHICK4;内能买★:【「(内能买A,L*0.975,DRAWNULL)COLOROOOOF5CIRCLEDOTLINETHICK4; 低吸★:【「(低吸A Z L*0.97,DRAWNULL)COLOROOFFFF;CIRCLEDOTLINETHICK4;包赚★:【「(包赚A,L*0.965,DRAWNULL)COLORFFOOF£CIRCLEDOTLINETHICK4;B01:=IF(佳选A,1,0);B02:=IF(启动A,l,0);B03:=IF(抓牛A,l,0);B04:=IF(乖离A,1,0);B05:=IF(内能买A,1,0);B06:=IF(低吸A,1,0);B07:=IF(包赚A,l,0);B08:=IF(深坑A,1,0);【共振】:B01+B02+B03+B04+B05+B06+B07+B08,COLOR00FFF^NODRAW; DRAWICON(【共振】>=4,H*L008,34);持币线:EMA(C,13),COLOR32E015LINETHICK3;持股线:IF(持币线>REF(持币线,1),持币线,DRAWNULL),COLOR460CF3,LINETHICK3; {画线}IF(BETWEEN(高压M,高点,低点),高压M,DRAWNULL),COLOROOCCF^LINETHICKl; IF(BETWEEN(低撑M,高点,低点),低撑M,DRAWNULL),COLOROOCCF^LINETHICKl; IF(BETWEEN(高压1,高点,低点),高压1,DRAWNULL),COLORCCCCCC,LINETHICK1;IF(BETWEEN(低撑1,高点,低点),低撑1,DRAWNULL)Z COLORCCCCCC,LINETHICK1; 中:=(MA(C,3)+MA(C,6)+MA(C,12)+MA(C,24))/4,COLORFFFFFF;VAR326:=IF(C AND MA(VOL,5)/240 AND C>LC*1.0 AND C,88,0);VAR327:=IF(C/LC>1.050 AND VOL/CAPITAL*100<10 AND C<17 AND H/C<1.010 AND VAR326>0, 91, 0);DRAWTEXT(VAR327>90,L*0.993/, \ 杀庄*),COLOROOFFFF;{背离}RSI:=(SMA(MAX((C-LC)z0),3,l)/SMA(ABS((C-LC))z3,l))*100;FFF:=EMA(C,3);MA15:=EMA(C,21);顶背:=CROSS(88,RSI);DRAWTEXT(CROSS(FFEMA15),L,‘一底背[COLORFF88FF;cci:=n ccr';CCI3:=MA(CCI,3);CCI7:=MA(CCI,7);头:=CROSS(CCI3,CCI) AND (CCI>130);STICKLINE(头,H*L005,H*l.01,4,0),COLOR00CC00;DRAWTEXT(头,头[COLORFFFFFF;STICKLINE(逃顶,H*l.0LH*L015,4,0),COLORFFFFFF;卖出警报:=(头AND顶背),COLOROOOOFF;STICKLINE(卖出警报,H*l.016,H*l.025,4,0),COLOR0000FF;DRAWTEXT(卖出警报z H*1.028;空仓'),COLORFFFFFF;DRAWICON(顶背,H*1.016,8);DRAWTEXT(顶背,H*l.02,‘一顶背[COLOR98FF75;DRAWTE XT_FIX(l,0.92,0.01,0,STRCAT(STRCAT(‘【共振】)CON2STR(【共振】,1)),' '))Z COLOROOFFFF;。
综合背离通达信指标公式源码
本公式带有九转序列,macd背离,kdj背离,macd面积,出现红色箭头表示cci值小于-150,且kdj的j值小于20.其他的自己研究{MACD背离}DIFF:EMA(CLOSE,12) - EMA(CLOSE,26);DEA:EMA(DIFF,9);MACD:2*(DIFF-DEA), COLORSTICK,DRAWABOVE;MACD金叉:=BARSLAST(REF(CROSS(DIFF,DEA),1));MACD死叉:=BARSLAST(REF(CROSS(DEA,DIFF),1));MACD上次金叉:=SUMBARS(REF(CROSS(DIFF,DEA),1),2);MACD上次死叉:=SUMBARS(REF(CROSS(DEA,DIFF),1),2);{MACD底背离}MACD次低点:=LLV(DIFF,MACD金叉);MACD最低点:=LLV(DIFF,MACD上次死叉);MACD底背离:=REF(CLOSE,MACD金叉+1)>CLOSE AND MACD次低点>MACD最低点AND CROSS(DIFF,DEA);DRAWLINE(MACD金叉=0,DEA,MACD底背离,DEA,0),COLORRED,LINETHICK2; {MACD顶背离}MACD次高点:=HHV(DIFF,MACD金叉);MACD最高点:=HHV(DIFF,MACD上次金叉);MACD顶背离:=REF(CLOSE,MACD死叉+1)<CLOSE AND MACD次高点<MACD最高点AND CROSS(DEA,DIFF);DRAWLINE(MACD死叉=0,DEA,MACD顶背离,DEA,0),COLORGREEN,LINETHICK2;红面积:SUM(MACD,BARSLAST(MACD<0))*(MACD>0),COLOR0000FF,NODRAW;绿面积:SUM(MACD,BARSLAST(MACD>0))*(MACD<0),COLORFFFF00,NODRAW;AA:=ROUND(REF(绿面积,1)*100);BB:=ROUND(REF(红面积,1)*100); DRAWNUMBER(CROSS(0,MACD),0.04,ABS(BB)),COLORMAGENTA;DRAWNUMBER(CROSS(MACD,0),-0.01,ABS(AA)),COLORGREEN;{CCI}TYP:=(HIGH+LOW+CLOSE)/3;CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));{BOLL}BOLL:=MA(CLOSE,20);UB:=BOLL+2*STD(CLOSE,20);LB:=BOLL-2*STD(CLOSE,20);{KDJ}RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;K:=SMA(RSV,3,1);D:=SMA(K,3,1);J:=3*K-2*D;PP:=CCI<-160 AND CLOSE<LB AND J<20;QQ:=CCI>160 AND J>100;{KDJ中J值在0-90间为黄色,小于0为绿色,大于90为红色}{显示J值和CCI值}{CCI值小于160且收盘价在BOLL下轨一下,J值小于20为红色箭头,CCI大于160且J 值大于100为绿色箭头}DRAWICON(QQ,0,2);DRAWICON(PP,0,1);KDJ金叉:=BARSLAST(REF(CROSS(J,D),1));KDJ死叉:=BARSLAST(REF(CROSS(D,J),1));KDJ上次金叉:=SUMBARS(REF(CROSS(J,D),1),2);KDJ上次死叉:=SUMBARS(REF(CROSS(D,J),1),2);{KDJ底背离}AAA1:=BARSLAST(REF(CROSS(J,D),1));KDJ次低点:=LLV(J,AAA1);KDJ最低点:=LLV(J,KDJ上次死叉);KDJ底背离:=REF(CLOSE,AAA1+1)>CLOSE AND KDJ次低点>KDJ最低点AND CROSS(J,D); DRAWTEXT(KDJ底背离,MACD,'KDJ底'),COLORRED;STICKLINE(KDJ底背离,MACD,0,2,0),COLORRED;{KDJ顶背离}BBB1:=BARSLAST(REF(CROSS(D,J),1));KDJ次高点:=HHV(J,AAA1);KDJ最高点:=HHV(J,KDJ上次金叉);KDJ顶背离:=REF(CLOSE,BBB1+1)<CLOSE AND KDJ次高点<KDJ最高点AND CROSS(D,J); DRAWTEXT(KDJ顶背离,MACD,'KDJ顶'),COLORGREEN;STICKLINE(KDJ顶背离,MACD,0,2,0),COLORGREEN;{九转}A1:=C>=REF(C,4);A2:=C<REF(C,4);A3:=C<REF(C,4) AND REF(A1,1);T:=BARSLAST(A3),NODRAW;M0:=(T=0 AND REFX(T=1 AND NOT(A2),1)) OR (REFX(T=2 AND NOT(A2),2)) OR (REFX(T=3 AND NOT(A2),3)) OR (REFX(T=4 AND NOT(A2),4)) OR (REFX(T=5 AND NOT(A2),5)) OR (REFX(T=6 AND NOT(A2),6)) OR (REFX(T=7 AND NOT(A2),7)) OR (REFX(T=8 AND NOT(A2),8));M1:=T=1 AND REFX(T=2 AND NOT(A2),1) OR (REFX(T=3 AND NOT(A2),2)) OR (REFX(T=4 AND NOT(A2),3)) OR (REFX(T=5 AND NOT(A2),4)) OR (REFX(T=6 AND NOT(A2),5)) OR (REFX(T=7 AND NOT(A2),6)) OR (REFX(T=8 AND NOT(A2),7));M2:=T=2 AND REFX(T=3 AND NOT(A2),1) OR (REFX(T=4 AND NOT(A2),2)) OR (REFX(T=5 AND NOT(A2),3)) OR (REFX(T=6 AND NOT(A2),4)) OR (REFX(T=7 AND NOT(A2),5)) OR (REFX(T=8 AND NOT(A2),6));M3:=T=3 AND REFX(T=4 AND NOT(A2),1)OR (REFX(T=5 AND NOT(A2),2)) OR (REFX(T=6 AND NOT(A2),3)) OR (REFX(T=7 AND NOT(A2),4)) OR (REFX(T=8 AND NOT(A2),5));M4:=T=4 AND REFX(T=5 AND NOT(A2),1) OR (REFX(T=6 AND NOT(A2),2)) OR (REFX(T=7 AND NOT(A2),3)) OR (REFX(T=8 AND NOT(A2),4));M5:=T=5 AND REFX(T=6 AND NOT(A2),1) OR (REFX(T=7 AND NOT(A2),2)) OR (REFX(T=8 AND NOT(A2),3));{好}M6:=T=6 AND REFX(T=7 AND NOT(A2),1) OR (REFX(T=8 AND NOT(A2),2));M7:=T=7 AND REFX(T=8 AND NOT(A2),1);N0:=T=1 AND REF(T=0 AND A3,1) AND A2;N1:=T=2 AND REF(N0,1) AND A2;N2:=T=3 AND REF(N1,1) AND A2;N3:=T=4 AND REF(N2,1) AND A2;N4:=T=5 AND REF(N3,1) AND A2;N5:=T=6 AND REF(N4,1) AND A2;N6:=T=7 AND REF(N5,1) AND A2;N7:=T=8 AND REF(N6,1) AND A2;WZD:=DEA;WZG:=DEA;DRAWTEXT(N6 AND NOT(M7),WZD,'8'),COLORGREEN;DRAWTEXT(N7,WZG,'9'),COLORMAGENTA;B1:=C<=REF(C,4);B2:=C>REF(C,4);B3:=C>REF(C,4) AND REF(B1,1);T1:=BARSLAST(B3),NODRAW;M8:=(T1=0 AND REFX(T1=1 AND NOT(B2),1)) OR (REFX(T1=2 AND NOT(B2),2)) OR (REFX(T1=3 AND NOT(B2),3)) OR (REFX(T1=4 AND NOT(B2),4)) OR (REFX(T1=5 AND NOT(B2),5)) OR (REFX(T1=6 AND NOT(B2),6)) OR (REFX(T1=7 AND NOT(B2),7)) OR (REFX(T1=8 AND NOT(B2),8));M9:=T1=1 AND REFX(T1=2 AND NOT(B2),1) OR (REFX(T1=3 AND NOT(B2),2)) OR (REFX(T1=4 AND NOT(B2),3)) OR (REFX(T1=5 AND NOT(B2),4)) OR (REFX(T1=6 AND NOT(B2),5)) OR (REFX(T1=7 AND NOT(B2),6)) OR (REFX(T1=8 AND NOT(B2),7));M10:=T1=2 AND REFX(T1=3 AND NOT(B2),1) OR (REFX(T1=4 AND NOT(B2),2)) OR (REFX(T1=5 AND NOT(B2),3)) OR (REFX(T1=6 AND NOT(B2),4)) OR (REFX(T1=7 AND NOT(B2),5)) OR (REFX(T1=8 AND NOT(B2),6));M11:=T1=3 AND REFX(T1=4 AND NOT(B2),1)OR (REFX(T1=5 AND NOT(B2),2)) OR (REFX(T1=6 AND NOT(B2),3)) OR (REFX(T1=7 AND NOT(B2),4)) OR (REFX(T1=8 AND NOT(B2),5));M12:=T1=4 AND REFX(T1=5 AND NOT(B2),1) OR (REFX(T1=6 AND NOT(B2),2)) OR (REFX(T1=7 AND NOT(B2),3)) OR (REFX(T1=8 AND NOT(B2),4));M13:=T1=5 AND REFX(T1=6 AND NOT(B2),1) OR (REFX(T1=7 AND NOT(B2),2)) OR (REFX(T1=8 AND NOT(B2),3));M14:=T1=6 AND REFX(T1=7 AND NOT(B2),1) OR (REFX(T1=8 AND NOT(B2),2));M15:=T1=7 AND REFX(T1=8 AND NOT(B2),1);N8:=T1=1 AND REF(T1=0 AND B3,1) AND B2;N9:=T1=2 AND REF(N8,1) AND B2;N10:=T1=3 AND REF(N9,1) AND B2;N11:=T1=4 AND REF(N10,1) AND B2;N12:=T1=5 AND REF(N11,1) AND B2;N13:=T1=6 AND REF(N12,1) AND B2;N14:=T1=7 AND REF(N13,1) AND B2;N15:=T1=8 AND REF(N14,1) AND B2;DRAWTEXT(N14 AND NOT(M15),WZG,'8'),COLOR9900CC; DRAWTEXT(N15 ,WZD,'9'),COLORGREEN;。
通达信量价背离决策指标公式
通达信量价背离决策指标公式通达信量价背离决策指标公式中:50,COLORYELLOW;VAR1中:=LLV(LOW,13);VAR2:=HHV(HIGH,13);VAR3:=SMA((CLOSE-VAR1中)/(VAR2-VAR1中)*100,5,1);VAR4:=SMA((VAR2-CLOSE)/(VAR2-VAR1中)*100,5,1);DRAWBAND(VAR3,RGB(115,30,150),50,RGB(0,100,100) );主力:VAR3,COLORLIRED,LINETHICK1;散户:VAR4,COLORGREEN;VAR5:=SMA(MAX(CLOSE-REF(CLOSE,1),0),5,1)/SMA(A BS(CLOSE-REF(CLOSE,1)),5,1)*100;操作:EMA(VAR5,3),LINETHICK1,COLORYELLOW;{操作变色:IF(操作>REF(操作,1),操作,DRAWNULL),LINETHICK2,COLORMAGENTA;}STICKLINE(C,90,90,1,0),COLOR3C3CFF;STICKLINE(C,50,50,1,0),COLORYELLOW;STICKLINE(C,10,10,1,0),COLORCYAN;DRAWICON(CROSS(操作,中),中,34);{买入红箭头};DRAWTEXT(CROSS(操作,中),中-0.1,''),COLORYELLOW;N1:=9;N2:=5;N:=21;XIAO1:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);XIAO2:=SMA(ABS(LOW-XIAO1),13,1)/SMA(MAX(LOW-XI AO1,0),10,1);XIAO3:=EMA(XIAO2,10);XIAO4:=LLV(LOW,33);XIAO5:=EMA(IF(LOWREF(XIAO5,1),0,XIAO5,2.1,0 ),COL OR000099;STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,1.5,0 ),COLO R0000BB;STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,0.9,0 ),COLO R0000DD;STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,0.3,0 ),COLO R0000FF;STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,3,0),COLOR0 05500;STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,2.6,0),COLO R007700;STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,2.1,0),COLO R009900;STICKLINE(XIAO5REF(XIAO5,1),XIAO5,0),COLORRED, NODRAW;【私募洗盘】:IF(XIAO5<REF(XIAO5,1),XIAO5,0),COLORGREEN, NODRAW;B1:=(HHV(H,9)-C)/(HHV(H,9)-LLV(LOW,9))*100- 70;B2:=SMA(B1,9,1)+100;B3:=(C-LLV(L,9))/(HHV(H,9)- LLV(L,9))*100;B4:=SMA(B3,3,1);B5:=SMA(B4,3,1)+100;B6:=B5-B2;观望期:=IF(B6>60,B6-60,0);T1:=STICKLINE(REF(观望期,1)观望期,观望期,REF(观望期,1),9,0),COLORCYAN;{趋势背景}TAI1:=MA(C,1)/MA(REF(C,13),8)*100;TAI2:=MA(FORCAST(TAI1,21),3);TAI3:=REF(TAI1,1);TAI4:=REF(TAI1,2);邰1:=LLV(LOW,8);邰2:=HHV(HIGH,13);#股市黑客#:= EMA((CLOSE-邰1)/(邰2-邰1)*100,5),COLORRED,LINETHICK3;{输出后是趋势背景}※升跌临界※:= EMA(0.667*REF(#股市黑客#,1)+0.333*#股市黑客#,2),COLORGREEN,LINETHICK3;{输出后是趋势背景}VAR1:=(CLOSE>REF(CLOSE,1) ANDCLOSE>REF(CLOSE,2));VARD:=(CLOSE=REF(CLOSE,1) ANDCLOSE=REF(CLOSE,1) AND CLOSE=REF(CLOSE,1) AND CLOSE=REF(CLOSE,1) ANDCLOSE=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));VAR19:=REF(VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18,1) AND VAR1;DIFF:=EMA(DCLOSE,12)-EMA(DCLOSE,26);DEA:=EMA(DIFF,9),COLORFFFF00;MACD:=(DIFF-DEA)*2,COLORSTICK;A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));底背离:=REF(CLOSE,A1+1)>CLOSE ANDDIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);顶背离:=REF(CLOSE,A2+1)DIFF ANDCROSS(DEA,DIFF);¥①:IF(REF((MA(C,5)-C)/C>0.04 AND(MA(C,10)-MA(C,5))/MA(C,5)>0.04 AND 观望期=0 AND C>REF(C,1),1),44,0),LINETHICK3,COLORLIRED;{进}¥②:IF(REF("KDJ.J",1)0 AND TAI1>=TAI2 ANDTAI3>TAI4,34,0),LINETHICK3,COLORBROWN;{进}¥③:IF(REF(#股市黑客#,1)REF(MA(C,55),2)&&(VAR19 ORREF(VAR19,1)),33,0),COLORMAGENTA,LINETHICK3;¥④:IF(底背离,45,0),LINETHICK3,COLORYELLOW;DRAWTEXT(底背离,37,'←¥④MACD底背离'),COLORWHITE;DRAWICON(底背离,45,1),COLORYELLOW;DRAWICON(REF(#股市黑客#,1)REF(MA(C,55),2)&&(VAR19 ORREF(VAR19,1)),35,1);DRAWICON(REF((MA(C,5)-C)/C>0.04 AND(MA(C,10)-MA(C,5))/MA(C,5)>0.04 AND 观望期=0 AND C>REF(C,1),1),46,1);DRAWICON(REF("KDJ.J",1)0 AND TAI1>=TAI2 AND TAI3>TAI4,36,1),COLORYELLOW;{DRAWTEXT_FIX(C>O,0.01,0.9,0,''), COLORRED;DRAWTEXT_FIX(C>O,1,1,0,'程序化交易模型'),COLORRED;};DRAWTEXT(REF(#股市黑客#,1)REF(MA(C,55),2)&&(VAR19 ORREF(VAR19,1)),28,'←¥③背离临界'),COLORMAGENTA;DRAWTEXT(REF("KDJ.J",1)0 AND TAI1>=TAI2 AND TAI3>TAI4,32,'←¥②KDJ背离'),COLORBROWN;DRAWTEXT(REF((MA(C,5)-C)/C>0.04 AND(MA(C,10)-MA(C,5))/MA(C,5)>0.04 AND 观望期=0 AND C>REF(C,1),1),37,'←¥①背离中'),COLORLIRED;主力成本:EMA(MA(CLOSE,3),13),NODRAW,COLORAAAAFF; 短期支撑:LLV(HIGH,30),NODRAW,COLORAAAAFF;换手率:VOL/CAPITAL*100,NODRAW,COLORFF8888; 五日均换手率:SUM(100*V/CAPITAL,5)/5,NODRAW,COLORAAAAFF;十日均换手率:SUM(100*V/CAPITAL,10)/10,NODRAW,COLORAAAA FF;量:=IF(C>200,VOL/1000000,VOL/1),LINETHICK0,COLOR EEEEFF;地量:=换手率=5 AND 换手率=25,COLORE66878;{地量AND ISLASTBAR AND PERIOD=5,60,'成交地量'}DRAWTEXT_FIX(地量AND ISLASTBAR AND PERIOD=5, 0.28,0.10,0,'成交地量'),COLORGREEN;DRAWTEXT_FIX(低靡AND ISLASTBAR ANDPERIOD=5,0.28,0.10,0,'成交低靡'),COLORCYAN;DRAWTEXT_FIX(温和AND ISLASTBAR ANDPERIOD=5,0.28,0.10,0,'成交温和'),COLORFFFFFF;DRAWTEXT_FIX(活跃AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交活跃'),COLOR208FFF;DRAWTEXT_FIX(带量AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交带量'),COLORYELLOW;DRAWTEXT_FIX(放量AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交放量'),COLORFF00FF;DRAWTEXT_FIX(巨量AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交巨量'),COLORRED;DRAWTEXT_FIX(怪异AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交怪异'),COLORE66878;VVOL:=IF(CURRBARSCOUNT=1 ANDPERIOD=5,VOL*240/FROMOPEN,DRAWNULL),NODRA W;V换手率:=VVOL/CAPITAL*100,NODRAW,COLORYELLOW;{V量:=IF(C>200,VOL/1000000,VOL/1),LINETHICK0,COLOR EEEEFF;}V地量:=V换手率=5 AND V换手率=25,COLORE66878;DRAWTEXT_FIX(V地量AND ISLASTBAR AND FROMOPEN5, 0.7,0.10,0,'预测地量'),COLORFF6600;DRAWTEXT_FIX(V低靡AND ISLASTBAR AND FROMOPEN5,0.7,0.10,0,'预测低靡'),COLOR008364;DRAWTEXT_FIX(V温和AND ISLASTBAR AND FROMOPEN5,0.7,0.10,0,'预测温和'),COLORFFFFFF;DRAWTEXT_FIX(V活跃AND ISLASTBAR AND FROMOPEN5,0.7,0.10,0,'预测活跃'),COLOR208FFF;DRAWTEXT_FIX(V带量AND ISLASTBAR AND FROMOPEN5,0.7,0.10,0,'预测带量'),COLORYELLOW;DRAWTEXT_FIX(V放量AND ISLASTBAR ANDFROMOPEN5,0.7,0.10,0,'预测放量'),COLORFF00FF;DRAWTEXT_FIX(V巨量AND ISLASTBAR AND FROMOPEN5,0.7,0.10,0,'预测巨量'),COLORRED;DRAWTEXT_FIX(V怪异AND ISLASTBAR AND FROMOPEN5,0.7,0.10,0,'预测怪量'),COLORMAGENTA;个股6日:=(C-MA(C,6))/MA(C,6);个股12日:=(C-MA(C,12))/MA(C,12);个股24日:=(C-MA(C,24))/MA(C,24);大盘6日:=(INDEXC-MA(INDEXC,6))/MA(INDEXC,6);大盘12日:=(INDEXC-MA(INDEXC,12))/MA(INDEXC,12); 大盘24日:=(INDEXC-MA(INDEXC,24))/MA(INDEXC,24); 大盘:=(大盘6日+ 大盘12日+ 大盘24日)/3;个股:=(个股6日+ 个股12日+ 个股24日)/3;DRAWTEXT_FIX(个股>大盘ANDISLASTBAR,0.14,0.10,0,'强于大盘'),COLORYELLOW;DRAWTEXT_FIX(个股0 AND ISLASTBAR,0.21,0.10,0,'走势较强'),COLORYELLOW;DRAWTEXT_FIX(个股<0 AND ISLASTBAR,0.21,0.10,0,'走势较弱'),COLORGREEN;DRAWTEXT_FIX(1,0.00,0.10,0,'友谊看盘:'),COLORYELLOW;DRAWTEXT_FIX(1,0.00,0.00,0,'所属代码名称:'),COLORYELLOW;DRAWTEXT_FIX(1,0.09,0.00,0,CODE),COLORCYAN;DRAWTEXT_FIX(1,0.15,0,0,'所属行业:'),COLORYELLOW;DRAWTEXT_FIX(1,0.215,0,0,HYBLOCK),COLORCYAN;DRAWTEXT_FIX(1,0.26,0,0,'所属地区:'),COLORYELLOW;DRAWTEXT_FIX(1,0.33,0,0,DYBLOCK),COLORCYAN;DRAWTEXT_FIX(1,0.40,0,0,'所属概念:'),COLORYELLOW;DRAWTEXT_FIX(1,0.48,0,0,GNBLOCK),COLORCYAN; {显示年月日星期几}D1:=YEAR AND MONTH AND DAY;AAA1:=STRCAT(CON2STR(YEAR,0),'年');AAA2:=STRCAT(CON2STR(MONTH,0),'月');AAA3:=STRCAT(CON2STR(DAY,0),'日');AAA4:=STRCAT('【',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))));AAA:=STRCAT(STRCAT(STRCAT(AAA1,AAA2),STRCAT (AAA3,AAA4)),'】');DRAWTEXT_FIX(D1,0.65,0.0,0,AAA),COLORCYAN;今总成交(亿):=AMOUNT/100000000,COLORFF00FF,NODRAW;成交:=AMOUNT/((HIGH-LOW)*2-ABS(CLOSE-OPEN));今总流入(亿):=IF(CLOSE>OPEN,成交*(HIGH-LOW),IF(CLOSEOPEN,0-成交*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-成交*(HIGH-LOW),0-AMOUNT/2))/100000000,COLOR00FF00 ,NODRAW;今净流入(亿):=今总流入(亿)+今总流出(亿),COLORYELLOW,NODRAW;今总成交:=STRCAT(STRCAT(' 今总成交: ',CON2STR(今总成交(亿),2)),'亿');今总流入:=STRCAT(STRCAT(' 今总流入: ',CON2STR(今总流入(亿),2)),'亿');今总流出:=STRCAT(STRCAT(' 今总流出: ',CON2STR(今总流出(亿),2)),'亿');今净流入:=STRCAT(STRCAT(' 今净流入: ',CON2STR(今净流入(亿),2)),'亿');今资金流:=STRCAT('今资金流:',STRCAT(STRCAT(STRCAT(STRCAT(今总成交,今总流入),今总流出), 今净流入),0));DRAWTEXT_FIX(ISLASTBAR,0.00,0.05,0,今资金流),COLORYELLOW;。
通达信公式指标源码双底背离指标公式
S05:=SUM(MACD,0);
QST:=BARSLAST(MACD<0 AND REF(MACD,1)>0)+1;
QXT:=BARSLAST(MACD>0 AND REF(MACD,1)<0)+1;
S5:=IF(MACD>0,S05-REF(S05,BARSLAST(MACD<0)),S05-REF(S05,BARSLAST (MACD>0)))/10;
通达信公式指标源码双底背离指标公式 通达信双底背离指标公式 信号出现后买入,因为是见底信号. dif:=ema(c,12)-ema(c,26); dea:=ema(dif,9); macd:=2*(dif-dea); qzq:=barslast(ref(macd,1)<0 and macd>0); qm:=llvbars(macd,qzq+20); mqdz:=if(qm>qzq,ref(macd,qm),0); qf:=llvbars(dif,qzq+20); dqdz:=if(qf>qzq,ref(dif,qf),0); xg1:=macd<0 and macd>mqdz and dif<0 and dif>dqdz and c=llv(c,qzq+20) and mqdz<0 and dqdz<0; xg:ref(xg1,1)=1 and macd>ref(macd,1); s05:=sum(macd,0); qst:=barslast(macd<0 and ref(macd,1)>0)+1; qxt:=barslast(macd>0 and ref(macd,1)<0)+1; s5:=if(macd>0,s05-ref(s05,barslast(macd<0)),s05-ref(s05,barslast (macd>0)))/10; st:=if(macd>0,ref(qst,qxt)+qxt,ref(qxt,qst)+qst); rs5:=ref(s5,st); bc:if(macd>0 and s5 rs5 and dea<0,1,0));
MACD背离自动画线通达信指标公式源码
MACD背离自动画线通达信指标公式源码MACD(Moving Average Convergence Divergence)是一种常用的股票技术指标,用于分析股票的趋势和交易信号。
MACD背离是一种常见的技术分析方法,用于判断趋势的反转点,即价格走势与MACD指标走势不一致的情况。
下面是使用通达信编写MACD背离自动画线指标的源码。
```c/*MACD背离自动画线指标*功能:自动识别MACD背离点并在图表中标注出来*/#include "stdafx.h"#include "stdio.h"#include "string.h"#include "windows.h"//确定最低点、最高点时使用的价格周期数#define MIN_PRICE_DURATION 9#define MAX_PRICE_DURATION 10/**输入参数:*MACD:一个包含MACD数据的数组* price:一个包含价格数据的数组*返回值:*0:没有背离*1:向上背离*-1:向下背离*/int CheckDivergence(float *MACD, float *price) int i, j, k;int start, end;int low_index, high_index;float min_price, max_price;int MACD_bottom, MACD_top;int price_bottom, price_top;float MACD_bottom_value, MACD_top_value;float price_bottom_value, price_top_value;/**阶段1:寻找MACD底背离*/start = MAX_PRICE_DURATION + 1;end = start + MIN_PRICE_DURATION;low_index = -1;high_index = -1;min_price = price[start];max_price = price[start];for (i = start; i < end; i++)//查找最低点if (price[i] < min_price)low_index = i;min_price = price[i];}//查找最高点if (price[i] > max_price)high_index = i;max_price = price[i];}}//无法找到底背离点if (low_index == -1 , high_index == -1)}MACD_bottom = 0;price_bottom = 0;//寻找MACD底背离for (i = start; i < end; i++)if (i == low_index)//找到最低点对应的MACD数值MACD_bottom = i;MACD_bottom_value = MACD[i];}if (i == high_index)//找到最高点对应的MACD数值price_bottom = i;price_bottom_value = price[i];}}//如果最低点出现在最高点之后,则没有底背离if (MACD_bottom > price_bottom)}/**阶段2:寻找MACD顶背离*/start = MAX_PRICE_DURATION + 1; end = start + MIN_PRICE_DURATION; low_index = -1;high_index = -1;min_price = price[start];max_price = price[start];for (i = start; i < end; i++)//查找最低点if (price[i] < min_price)low_index = i;min_price = price[i];}//查找最高点if (price[i] > max_price)max_price = price[i];}}//无法找到顶背离点if (low_index == -1 , high_index == -1) return 0;}MACD_top = 0;price_top = 0;//寻找MACD顶背离for (i = start; i < end; i++)if (i == low_index)//找到最低点对应的MACD数值MACD_top = i;MACD_top_value = MACD[i];}if (i == high_index)//找到最高点对应的MACD数值price_top_value = price[i];}}//如果最高点出现在最低点之后,则没有顶背离if (MACD_top > price_top)return 0;}//判断背离类型if (price_bottom_value < price_top_value && MACD_bottom_value > MACD_top_value)return 1; // 向上背离}if (price_bottom_value > price_top_value && MACD_bottom_value < MACD_top_value)return -1; // 向下背离}return 0;int mainfloat MACD[100] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 3.0, 2.0, 1.0};float price[100] = {1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0, 0.0, -1.0, -2.0};int result = CheckDivergence(MACD, price);printf("Result: %d\n", result);return 0;```该源码实现了一个简单的MACD背离自动画线指标。
通达信软件指标公式源码常用的MACD三次背离副图指标通达信源码.docx
常用的MACD三次背离副图指标通达信源码自己常用的MACD,严重底背离红柱子和底背离绿柱子,三次背离底部划线等, 主要看图比较清晰!DIFIF1:(EMA(CLOSE,12) - EMA(CLOSE,26))*100/EMA(CLOSE Z26); DEAEA1:EMA(DIFIF1,9);MACD1:=2*(DIFIF1-DEAEA1),STICK;MACD2:=EMA(MACD1,3);STICKLINE(MACD 1 >MACD2 AND MACD1>0,0,MACD1,3,0),COLORRED; STICKLINE(MACD 1 >MACD2 AND MACD1<O Z O,MACD1,3,0),COLORGREEN; STICKLINE(MACD1<MACD2,0,MACD1Z3,0),COLORCBCBCO;STICKLINE(MACDl>=0 OR MACDl<=O z O z O z50,l)z COLORWHITE;DIFIF1,COLOR33FF33,LINETHICK2;DEAEAl’COLORYELLOW 丄INETHICK2;MACD: MACD1,NODRAW,COLORMAGENTA;强:IF(DIFIF1>=DEAEA1,DIFIF1QRAWNULL),COLORRED 丄INETHICK2;弱:IF(DEAEA1>=DIFIF1Z DEAEA1,DRAWNULL)Z COLORFF9900,LINETHICK2; DRAWICON(CROSS(DIFIF1,DEAEA1),DIFIF1+O.l,l);DRAWICON(CROSS(DEAEA1,DIFIF1),0.4,2);Al:=BARSLAST(REF(CROSS(n MACD. DIF H z n MACD. DEA n)z 1));B1:=REF(C,A1+1)>C AND REF(H MACD.DIF,,,Al+l)<H MACD.DIF n AND CROSS(n MACD.DIF,,,n MACD.DEA n);DRAWTEXT(Bl>0z-0.8;MACD 底背'),COLORFFOOFF;A2:=BARSLAST(REF(CROSS(,,KDJ.K,,/,,KDJ.D,,)Z1));B2:=REF(C,A2+1)>C AND REF(^^KDJ.K^,,A24-1)<^^KDJ.K,, ANDCROSS(,,KDJ.K,,z,,KDJ.D n);DRAWTEXT(B2z-0.6;KDJ 底离'),COLORYELLOW;{KDJ 底背离};A3:=BARSLAST(REF(CROSS(,,RSLRSI1,,Z,,RSI.RSI2,,),1));B3:=REF(C,A3+1)>C AND REF(,,RSLRSIl,,z A3+l)<,,RSI.RSir,AND CROSS(”RSI・RSI1TRSI・RSI2J;DRAWTEXT(B3>0,-0.3z'RSI 底离'),COLORCYAN;{RSI 底背离};C1:=BARSLAST(REF(CROSS(,,MACD.DEA,,/,MACD.DIF,,),1));Dl:=REF(C,Cl+l)vC AND [^=(“1^。
【通达信】经典MACD(背离)
【通达信】经典MACD(背离)-指标公式源码DIF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORRED,LINETHICK2;DEA:EMA(DIF,9),COLORWHITE,LINETHICK2;持仓段:=0,COLOR00CFFF;空仓段:=0,COLORFFCCFF;STICKLINE(DIF>DEA,-0.5,-0.6,10,1),COLOR00CFFF;STICKLINE(DIF<DEA,-0.5,-0.6,10,1),COLORFFCCFF;MACD:(DIF-DEA)*2,COLORSTICK;STICKLINE(((MACD<REF(MACD,1)) AND (MACD>0)),0,MACD,1,0),COLORLIBLUE,LINETHICK2;STICKLINE(((MACD>REF(MACD,1)) AND (MACD<0)),0,MACD,1,0),COLORFF00FF,LINETHICK2;建仓:IF(DIF<0,DIF,0),COLORYELLOW,LINETHICK2;加仓:IF(DIF<0,0,DIF),COLORRED,LINETHICK2;白线破仓:IF(DIF<DEA,DIF,DEA),COLORWHITE,LINETHICK2;趋势强弱:IF(DIF>DEA,DEA,DEA),COLORFF937F,LINETHICK2;AA:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(AA=2,21)=1;DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;BB:=COUNT(CROSS(DEA,DIF),BARSLAST(DEA<=0));二次绿叉:=CROSS(DEA,DIF) AND DEA>0 AND COUNT(BB=2,21)=1;DRAWTEXT(二次绿叉,0.2,' 二次绿叉'),COLORGREEN;A1:=BARSLAST(REF(CROSS(DIF,DEA),1));底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA); STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4; DRAWTEXT(底背离,0.12,' 底背离'),COLORFF00FF;A2:=BARSLAST(REF(CROSS(DEA,DIF),1));顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF); 顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;【通达信】经典MACD(背离)-指标公式效果图。
常用到的背离指标通达信指标公式源码
结合你自己的指标抄底逃顶自由把握妖股不算中线:18.5,COLORLIRED;AA1:=BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1));MACD底背离:=REF(C,AA1+1)>C AND REF("MACD.DIF",AA1+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA")>0;AA2:=BARSLAST(REF(CROSS("KDJ.K","KDJ.D"),1));KDJ底背离:=REF(C,AA2+1)>C AND REF("KDJ.K",AA2+1)<"KDJ.K" ANDCROSS("KDJ.K","KDJ.D");AA3:=BARSLAST(REF(CROSS("RSI.RSI1","RSI.RSI2"),1));RSI底背离:=REF(C,AA3+1)>C AND REF("RSI.RSI1",AA3+1)<"RSI.RSI1" AND CROSS("RSI.RSI1","RSI.RSI2")>0;AA4:=BARSLAST(REF(CROSS("BIAS.BIAS1","BIAS.BIAS2"),1));BIAS底背离:=REF(C,AA4+1)>C AND REF("BIAS.BIAS1",AA4+1)<"BIAS.BIAS1" AND CROSS("BIAS.BIAS1","BIAS.BIAS2")>0;CC1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1));MACD顶背离:=REF(C,CC1+1)<C AND REF("MACD.DIF",CC1+1)>"MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF")>0;CC2:=BARSLAST(REF(CROSS("KDJ.D","KDJ.K"),1));KDJ顶背离:=REF(C,CC2+1)<C AND REF("KDJ.K",CC2+1)>"KDJ.K" ANDCROSS("KDJ.D","KDJ.K")>0;CC3:=BARSLAST(REF(CROSS("RSI.RSI2","RSI.RSI1"),1));RSI顶背离:=REF(C,CC3+1)<C AND REF("RSI.RSI1",CC3+1)>"RSI.RSI1" AND CROSS("RSI.RSI2","RSI.RSI1")>0;CC4:=BARSLAST(REF(CROSS("BIAS.BIAS2","BIAS.BIAS1"),1));BIAS顶背离:=REF(C,CC4+1)<C AND REF("BIAS.BIAS1",CC4+1)>"BIAS.BIAS1" AND CROSS("BIAS.BIAS2","BIAS.BIAS1")>0;{CCI}N:=60;DD:=C=LLV(C,N);{60日最低点}DDSJ:=BARSLAST(REF(DD,1));{上一低点时间}DDGJ:=REF(CLOSE,DDSJ+1)>CLOSE;{股价趋势}GD:=C=HHV(C,N);{60日最高点}GDSJ:=BARSLAST(REF(GD,1));{上一高点时间}GDGJ:=REF(CLOSE,GDSJ+1)<CLOSE;{股价趋势}TYP:=(HIGH + LOW + CLOSE)/3;CCI:=(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));CDZB:=REF(CCI,DDSJ+1)<CCI;{CCI指标趋势}CCI底背离:=DDGJ AND CDZB;CGZB:=REF(CCI,GDSJ+1)>CCI;CCI顶背离:=GDGJ AND CGZB;K值:="KDJ.K";KDZB:=REF(K值,DDSJ+1)<K值;{KDJ.K指标趋势}K底背离:=DDGJ AND KDZB{ AND K超卖};KGZB:=REF(K值,GDSJ+1)>K值;K顶背离:=GDGJ AND KGZB;MACD:="MACD.MACD";MDZB:=REF(MACD,DDSJ+1)<MACD;{MACD指标趋势}M底背离:=DDGJ AND MDZB;MGZB:=REF(MACD,GDSJ+1)>MACD;M顶背离:=GDGJ AND MGZB;RSI:="RSI.RSI1";RDZB:=REF(RSI,DDSJ+1)<RSI;{RSI指标趋势}R底背离:=DDGJ AND RDZB;RGZB:=REF(RSI,GDSJ+1)>RSI;R顶背离:=GDGJ AND RGZB;BIAS:="BIAS.BIAS1";BDZB:=REF(BIAS,DDSJ+1)<BIAS;{BIAS指标趋势}B底背离:=DDGJ AND BDZB;BGZB:=REF(BIAS,GDSJ+1)>BIAS;B顶背离:=GDGJ AND BGZB;DRAWTEXT(ISLASTBAR,19,' CCI底背离'),LINETHICK2,COLORGREEN;DRAWTEXT(CCI底背离,IF(ISLASTBAR,19,19),'I'),LINETHICK2,COLORGREEN; DRAWTEXT(ISLASTBAR,16,' RSI底背离'),LINETHICK2,COLORWHITE; DRAWTEXT(R底背离,IF(ISLASTBAR,16,16),'I'),LINETHICK2,COLORWHITE; DRAWTEXT(RSI底背离,IF(ISLASTBAR,16,16),'-'),LINETHICK2,COLORWHITE; DRAWTEXT(ISLASTBAR,13,' MACD底背离'),LINETHICK2,COLORMAGENTA; DRAWTEXT(M底背离,IF(ISLASTBAR,13,13),'I'),LINETHICK2,COLORMAGENTA; DRAWTEXT(MACD底背离,IF(ISLASTBAR,13,13),'-'),LINETHICK2,COLORMAGENTA; DRAWTEXT(ISLASTBAR,10,' KDJ底背离'),LINETHICK2,COLORRED; DRAWTEXT(K底背离,IF(ISLASTBAR,10,10),'I'),LINETHICK2,COLORRED; DRAWTEXT(KDJ底背离,IF(ISLASTBAR,10,10),'-'),LINETHICK2,COLORRED; DRAWTEXT(ISLASTBAR,7,' BIAS底背离'),LINETHICK2,COLORYELLOW; DRAWTEXT(B底背离,IF(ISLASTBAR,7,7),'I'),LINETHICK2,COLORYELLOW; DRAWTEXT(BIAS底背离,IF(ISLASTBAR,7,7),'-'),LINETHICK2,COLORYELLOW; DRAWTEXT(ISLASTBAR,4,' BIAS底背离'),LINETHICK2,COLORYELLOW; DRAWTEXT(ISLASTBAR,34,' BIAS顶背离'),LINETHICK2,COLORYELLOW; DRAWTEXT(B顶背离,IF(ISLASTBAR,34,34),'I'),LINETHICK2,COLORYELLOW; DRAWTEXT(BIAS顶背离,IF(ISLASTBAR,34,34),'-'),LINETHICK2,COLORYELLOW; DRAWTEXT(ISLASTBAR,31,' KDJ顶背离'),LINETHICK2,COLORRED; DRAWTEXT(K顶背离,IF(ISLASTBAR,31,31),'I'),LINETHICK2,COLORRED; DRAWTEXT(KDJ顶背离,IF(ISLASTBAR,31,31),'-'),LINETHICK2,COLORRED; DRAWTEXT(ISLASTBAR,28,' MACD顶背离'),LINETHICK2,COLORMAGENTA; DRAWTEXT(M顶背离,(ISLASTBAR,28,28),'I'),LINETHICK2,COLORMAGENTA; DRAWTEXT(MACD顶背离,(ISLASTBAR,28,28),'-'),LINETHICK2,COLORMAGENTA; DRAWTEXT(ISLASTBAR,25,' RSI顶背离'),LINETHICK2,COLORWHITE; DRAWTEXT(R顶背离,(ISLASTBAR,25,25),'I'),LINETHICK2,COLORWHITE; DRAWTEXT(RSI顶背离,(ISLASTBAR,25,25),'-'),LINETHICK2,COLORWHITE; DRAWTEXT(ISLASTBAR,22,' CCI顶背离'),LINETHICK2,COLORGREEN; DRAWTEXT(CCI顶背离,(ISLASTBAR,22,22),'I'),LINETHICK2,COLORGREEN;{超买超卖}K超买:="KDJ.K">=80 OR "KDJ.D">=80 OR "KDJ.J">=100;K超卖:="KDJ.K"<=20 OR "KDJ.D"<=30 OR "KDJ.J"<0;{RSI:="RSI.RSI1"; }R超买:=RSI>=80;R超卖:=RSI<=20;C超买:="I">=100;C超卖:="I"<=-100;{BIAS:="BIAS.BIAS1";}B超买:="BIAS.BIAS1">3.5 OR "BIAS.BIAS2">5;B超卖:="BIAS.BIAS1"<-3 OR "BIAS.BIAS2"<-4;{超卖超买显示}{DRAWTEXT(B超买,IF(ISLASTBAR,34,34),'○'),LINETHICK2,COLORYELLOW; DRAWTEXT(K超买,IF(ISLASTBAR,31,31),'○'),LINETHICK2,COLORRED; DRAWTEXT(R超买,(ISLASTBAR,25,25),'○'),LINETHICK2,COLORWHITE; DRAWTEXT(C超买,(ISLASTBAR,22,22),'○'),LINETHICK2,COLORGREEN;} {DRAWTEXT(C超卖,IF(ISLASTBAR,19,19),'○'),LINETHICK2,COLORGREEN; DRAWTEXT(R超卖,IF(ISLASTBAR,16,16),'○'),LINETHICK2,COLORWHITE; DRAWTEXT(K超卖,IF(ISLASTBAR,10,10),'○'),LINETHICK2,COLORRED; DRAWTEXT(B超卖,IF(ISLASTBAR,7,7),'○'),LINETHICK2,COLORYELLOW;} {BAIS买入}BIAS5:=(C-MA(C,6))/MA(C,6)*100;BIAS6:=(C-MA(C,12))/MA(C,12)*100;BIAS7:=(C-MA(C,24))/MA(C,24)*100;BIAS8:=(BIAS5+2*BIAS6+3*BIAS7)/6;乖离:=MA(BIAS8,6);STICKLINE(CROSS(BIAS8,乖离) AND 乖离<-9,18,20,1,0),COLORRED;超卖O背离I:1,NODRAW,COLORWHITE;顶背比底背更准:1,NODRAW,COLORGREEN;红方点BIAS买点:1,NODRAW,COLORRED;。
通达信指标公式源码 顶底背离MACD副图指标
VAR1:=EMA(SLOPE(C,21)+C,55);VAR2:=EMA(SLOPE(O,21)+O,55);VAR3:=EMA(SLOPE(H,21)+H,55);VAR4:=EMA(SLOPE(L,21)+L,55);VAR5:=EMA(C,3);VAR6:=EMA(O,3);VAR7:=EMA(H,3);VAR8:=EMA(L,3);VAR9:=VAR1-VAR5,LINETHICK2;VAR10:=VAR2-VAR6,LINETHICK2;VAR11:=VAR3-VAR7,LINETHICK2;VAR12:=VAR4-VAR8,LINETHICK2;ZJC:=REVERSE(VAR9);ZJO:=REVERSE(VAR10);ZJH:=REVERSE(VAR11);ZJL:=REVERSE(VAR12);DIF:EMA(ZJC*5,12)-EMA(ZJC*5,26);DEA:EMA(DIF,9);MACD:(DIF-DEA)*2,COLORSTICK;STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,0,0),COLORRED; STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,0,0),COLORMAGENTA;STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,0,0),COLORYELLOW;STICKLINE(MACD<REF(MACD,1) AND MACD<0,0,MACD,0,0),COLORLIGREEN; STICKLINE(ZJC> ZJO,ZJH,ZJL,0.0,0),COLORFF66FF;STICKLINE(ZJC> ZJO,ZJC,ZJO,2.1,0),COLORAA00AA;STICKLINE(ZJC> ZJO,ZJC,ZJO,1.9,0),COLORCC11CC;STICKLINE(ZJC> ZJO,ZJC,ZJO,1.6,0),COLORFF22FF;STICKLINE(ZJC> ZJO,ZJC,ZJO,1.2,0),COLORFF44FF;STICKLINE(ZJC> ZJO,ZJC,ZJO,0.7,0),COLORFF66FF;STICKLINE(ZJC> ZJO,ZJC,ZJO,0.2,0),COLORFF99FF;STICKLINE(ZJC<=ZJO,ZJL,ZJC,0.0,0),COLORGREEN;STICKLINE(ZJC<=ZJO,ZJO,ZJC,2.1,0),COLOR005500;STICKLINE(ZJC<=ZJO,ZJO,ZJC,1.9,0),COLOR007700;STICKLINE(ZJC<=ZJO,ZJO,ZJC,1.6,0),COLOR009900;STICKLINE(ZJC<=ZJO,ZJO,ZJC,1.2,0),COLOR00BB00;STICKLINE(ZJC<=ZJO,ZJO,ZJC,0.7,0),COLOR00DD00;STICKLINE(ZJC<=ZJO,ZJO,ZJC,0.2,0),COLOR44FF00;ZTB:=(C-REF(C,1))/REF(C,1)*100>9.9;DRAWTEXT(ZTB,IF(ZJC<0,ZJC*0.9,ZJC*1.1),'涨停板')COLORYELLOW; STICKLINE(ZTB,ZJC,ZJO,2.1,0),COLOR006666;STICKLINE(ZTB,ZJC,ZJO,1.9,0),COLOR008888;STICKLINE(ZTB,ZJC,ZJO,1.6,0),COLOR00AAAA;STICKLINE(ZTB,ZJC,ZJO,1.2,0),COLOR00CCCC;STICKLINE(ZTB,ZJC,ZJO,0.7,0),COLOR00EEEE;STICKLINE(ZTB,ZJC,ZJO,0.2,0),COLOR33FFFF;DTB:=(C-REF(C,1))/REF(C,1)*100<-9.9;DRAWTEXT(DTB,IF(ZJC>0,ZJC*0.9,ZJC*1.1),'跌停板')COLORFF8800; STICKLINE(DTB,ZJO,ZJC,2.1,0),COLORFF0000;{蓝色}STICKLINE(DTB,ZJO,ZJC,1.9,0),COLORFF2200;STICKLINE(DTB,ZJO,ZJC,1.6,0),COLORFF4400;STICKLINE(DTB,ZJO,ZJC,1.2,0),COLORFF6600;STICKLINE(DTB,ZJO,ZJC,0.7,0),COLORFF8800;STICKLINE(DTB,ZJO,ZJC,0.2,0),COLORFFAA00;。
通达信实用背离指标公式
通达信实用背离指标公式来源:Internet,编辑:股旁网,2017-01-11 {MACD背离}DIFF:EMA(CLOSE,12) - EMA(CLOSE,26); DEA:EMA(DIFF,9);MACD:2*(DIFF-DEA),COLORSTICK,DRAWABOVE;MACD金叉:=BARSLAST(REF(CROSS(DIFF,DEA),1)); MACD死叉:=BARSLAST(REF(CROSS(DEA,DIFF),1)); MACD上次金叉:=SUMBARS(REF(CROSS(DIFF,DEA),1),2); MACD上次死叉:=SUMBARS(REF(CROSS(DEA,DIFF),1),2); {MACD底背离}MACD次低点:=LLV(DIFF,MACD金叉);MACD最低点:=LLV(DIFF,MACD上次死叉); MACD底背离:=REF(CLOSE,MACD金叉+1)>CLOSE AND MACD次低点>MACD最低点AND CROSS(DIFF,DEA);DRAWLINE(MACD金叉=0,DEA,MACD底背离,DEA,0),COLORRED,LINETHICK2;{MACD顶背离}MACD次高点:=HHV(DIFF,MACD金叉);MACD最高点:=HHV(DIFF,MACD上次金叉); MACD顶背离:=REF(CLOSE,MACD死叉+1)<CLOSE AND MACD次高点<MACD最高点AND CROSS(DEA,DIFF);DRAWLINE(MACD死叉=0,DEA,MACD顶背离,DEA,0),COLORGREEN,LINETHICK2;红面积:SUM(MACD,BARSLAST(MACD<0))*(MACD>0 ),COLOR0000FF,NODRAW;绿面积:SUM(MACD,BARSLAST(MACD>0))*(MACD<0 ),COLORFFFF00,NODRAW;AA:=ROUND(REF(绿面积,1)*100);BB:=ROUND(REF(红面积,1)*100); DRAWNUMBER(CROSS(0,MACD),0.04,ABS(BB)),COLORMAGENTA;DRAWNUMBER(CROSS(MACD,0),-0.01,ABS(AA) ),COLORGREEN;{CCI}TYP:=(HIGH+LOW+CLOSE)/3;CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,1 4));{BOLL}BOLL:=MA(CLOSE,20);UB:=BOLL+2*STD(CLOSE,20);LB:=BOLL-2*STD(CLOSE,20);{KDJ}RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV (LOW,9))*100;K:=SMA(RSV,3,1);D:=SMA(K,3,1);J:=3*K-2*D;PP:=CCI<-160 AND CLOSE<LB AND J<20; QQ:=CCI>160 AND J>100;{KDJ中J值在0-90间为黄色,小于0为绿色,大于90为红色}{显示J值和CCI值}{CCI值小于160且收盘价在BOLL下轨一下,J值小于20为红色箭头,CCI大于160且J值大于100为绿色箭头}DRAWICON(QQ,0,2);DRAWICON(PP,0,1);KDJ金叉:=BARSLAST(REF(CROSS(J,D),1));KDJ死叉:=BARSLAST(REF(CROSS(D,J),1));KDJ上次金叉:=SUMBARS(REF(CROSS(J,D),1),2); KDJ上次死叉:=SUMBARS(REF(CROSS(D,J),1),2); {KDJ底背离}AAA1:=BARSLAST(REF(CROSS(J,D),1));KDJ次低点:=LLV(J,AAA1);KDJ最低点:=LLV(J,KDJ上次死叉);KDJ底背离:=REF(CLOSE,AAA1+1)>CLOSE AND KDJ次低点>KDJ最低点AND CROSS(J,D); DRAWTEXT(KDJ底背离,MACD,'KDJ底'),COLORRED;STICKLINE(KDJ底背离,MACD,0,2,0),COLORRED;{KDJ顶背离}BBB1:=BARSLAST(REF(CROSS(D,J),1));KDJ次高点:=HHV(J,AAA1);KDJ最高点:=HHV(J,KDJ上次金叉);KDJ顶背离:=REF(CLOSE,BBB1+1)<CLOSE AND KDJ次高点<KDJ最高点AND CROSS(D,J); DRAWTEXT(KDJ顶背离,MACD,'KDJ顶'),COLORGREEN;STICKLINE(KDJ顶背离,MACD,0,2,0),COLORGREEN;{九转}A1:=C>=REF(C,4);A2:=C<REF(C,4);A3:=C<REF(C,4) AND REF(A1,1);T:=BARSLAST(A3),NODRAW;M0:=(T=0 AND REFX(T=1 AND NOT(A2),1)) OR (REFX(T=2 AND NOT(A2),2)) OR (REFX(T=3 AND NOT(A2),3)) OR (REFX(T=4 ANDNOT(A2),4)) OR (REFX(T=5 AND NOT(A2),5)) OR (REFX(T=6 AND NOT(A2),6)) OR (REFX(T=7AND NOT(A2),7)) OR (REFX(T=8 ANDNOT(A2),8));M1:=T=1 AND REFX(T=2 AND NOT(A2),1) OR (REFX(T=3 AND NOT(A2),2)) OR (REFX(T=4 AND NOT(A2),3)) OR (REFX(T=5 ANDNOT(A2),4)) OR (REFX(T=6 AND NOT(A2),5)) OR (REFX(T=7 AND NOT(A2),6)) OR (REFX(T=8 AND NOT(A2),7));M2:=T=2 AND REFX(T=3 AND NOT(A2),1) OR (REFX(T=4 AND NOT(A2),2)) OR (REFX(T=5 AND NOT(A2),3)) OR (REFX(T=6 ANDNOT(A2),4)) OR (REFX(T=7 AND NOT(A2),5)) OR (REFX(T=8 AND NOT(A2),6));M3:=T=3 AND REFX(T=4 AND NOT(A2),1)OR (REFX(T=5 AND NOT(A2),2)) OR (REFX(T=6 AND NOT(A2),3)) OR (REFX(T=7 ANDNOT(A2),4)) OR (REFX(T=8 AND NOT(A2),5)); M4:=T=4 AND REFX(T=5 AND NOT(A2),1) OR (REFX(T=6 AND NOT(A2),2)) OR (REFX(T=7 AND NOT(A2),3)) OR (REFX(T=8 ANDNOT(A2),4));M5:=T=5 AND REFX(T=6 AND NOT(A2),1) OR (REFX(T=7 AND NOT(A2),2)) OR (REFX(T=8 AND NOT(A2),3));M6:=T=6 AND REFX(T=7 AND NOT(A2),1) OR (REFX(T=8 AND NOT(A2),2));M7:=T=7 AND REFX(T=8 AND NOT(A2),1);N0:=T=1 AND REF(T=0 AND A3,1) AND A2; N1:=T=2 AND REF(N0,1) AND A2;N2:=T=3 AND REF(N1,1) AND A2;N3:=T=4 AND REF(N2,1) AND A2;N4:=T=5 AND REF(N3,1) AND A2;N5:=T=6 AND REF(N4,1) AND A2;N6:=T=7 AND REF(N5,1) AND A2;N7:=T=8 AND REF(N6,1) AND A2;WZD:=DEA;WZG:=DEA;DRAWTEXT(N6 ANDNOT(M7),WZD,'8'),COLORGREEN; DRAWTEXT(N7,WZG,'9'),COLORMAGENTA;B1:=C<=REF(C,4);B2:=C>REF(C,4);B3:=C>REF(C,4) AND REF(B1,1);T1:=BARSLAST(B3),NODRAW;M8:=(T1=0 AND REFX(T1=1 AND NOT(B2),1)) OR (REFX(T1=2 AND NOT(B2),2)) OR(REFX(T1=3 AND NOT(B2),3)) OR (REFX(T1=4 AND NOT(B2),4)) OR (REFX(T1=5 ANDNOT(B2),5)) OR (REFX(T1=6 AND NOT(B2),6)) OR (REFX(T1=7 AND NOT(B2),7)) OR(REFX(T1=8 AND NOT(B2),8));M9:=T1=1 AND REFX(T1=2 AND NOT(B2),1) OR (REFX(T1=3 AND NOT(B2),2)) OR (REFX(T1=4 AND NOT(B2),3)) OR (REFX(T1=5 ANDNOT(B2),4)) OR (REFX(T1=6 AND NOT(B2),5)) OR (REFX(T1=7 AND NOT(B2),6)) OR(REFX(T1=8 AND NOT(B2),7));M10:=T1=2 AND REFX(T1=3 AND NOT(B2),1) OR (REFX(T1=4 AND NOT(B2),2)) OR(REFX(T1=5 AND NOT(B2),3)) OR (REFX(T1=6AND NOT(B2),4)) OR (REFX(T1=7 ANDNOT(B2),5)) OR (REFX(T1=8 AND NOT(B2),6)); M11:=T1=3 AND REFX(T1=4 ANDNOT(B2),1)OR (REFX(T1=5 AND NOT(B2),2)) OR (REFX(T1=6 AND NOT(B2),3)) OR(REFX(T1=7 AND NOT(B2),4)) OR (REFX(T1=8 AND NOT(B2),5));M12:=T1=4 AND REFX(T1=5 AND NOT(B2),1) OR (REFX(T1=6 AND NOT(B2),2)) OR(REFX(T1=7 AND NOT(B2),3)) OR (REFX(T1=8 AND NOT(B2),4));M13:=T1=5 AND REFX(T1=6 AND NOT(B2),1) OR (REFX(T1=7 AND NOT(B2),2)) OR(REFX(T1=8 AND NOT(B2),3));M14:=T1=6 AND REFX(T1=7 AND NOT(B2),1) OR (REFX(T1=8 AND NOT(B2),2));M15:=T1=7 AND REFX(T1=8 AND NOT(B2),1); N8:=T1=1 AND REF(T1=0 AND B3,1) AND B2; N9:=T1=2 AND REF(N8,1) AND B2;N10:=T1=3 AND REF(N9,1) AND B2;N11:=T1=4 AND REF(N10,1) AND B2;N12:=T1=5 AND REF(N11,1) AND B2;N13:=T1=6 AND REF(N12,1) AND B2;N14:=T1=7 AND REF(N13,1) AND B2;N15:=T1=8 AND REF(N14,1) AND B2; DRAWTEXT(N14 ANDNOT(M15),WZG,'8'),COLOR9900CC; DRAWTEXT(N15 ,WZD,'9'),COLORGREEN;。
通达信macd顶底背离指标公式
DRAWICON(二次金叉,DEA*0.9,1) ;
DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
底背:DRAWLINE(A1ห้องสมุดไป่ตู้0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;
DRAWTEXT(底背离,0.12,' 底背离'),COLORFF00FF;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
请注意甄别内容中的联系方式诱导购买等信息谨防诈骗
通达信macd顶底背离指标公式
DIFF:EMA(CLOSE,12)-EMA(CLOSE,27);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA), COLORSTICK,LINETHICK2;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
顶背离:=REF(CLOSE,A2+1) AND CROSS(DEA,DIFF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;
DRAWTEXT(低位金叉 AND 二次金叉 AND 底背离,0.25,'进场'),COLOR0000FF,LINETHICK2;
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
结合你自己的指标抄底逃顶自由把握妖股不算中线:18.5,COLORLIRED;AA1:=BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1));MACD底背离:=REF(C,AA1+1)>C AND REF("MACD.DIF",AA1+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA")>0;AA2:=BARSLAST(REF(CROSS("KDJ.K","KDJ.D"),1));KDJ底背离:=REF(C,AA2+1)>C AND REF("KDJ.K",AA2+1)<"KDJ.K" ANDCROSS("KDJ.K","KDJ.D");AA3:=BARSLAST(REF(CROSS("RSI.RSI1","RSI.RSI2"),1));RSI底背离:=REF(C,AA3+1)>C AND REF("RSI.RSI1",AA3+1)<"RSI.RSI1" AND CROSS("RSI.RSI1","RSI.RSI2")>0;AA4:=BARSLAST(REF(CROSS("BIAS.BIAS1","BIAS.BIAS2"),1));BIAS底背离:=REF(C,AA4+1)>C AND REF("BIAS.BIAS1",AA4+1)<"BIAS.BIAS1" AND CROSS("BIAS.BIAS1","BIAS.BIAS2")>0;CC1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1));MACD顶背离:=REF(C,CC1+1)<C AND REF("MACD.DIF",CC1+1)>"MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF")>0;CC2:=BARSLAST(REF(CROSS("KDJ.D","KDJ.K"),1));KDJ顶背离:=REF(C,CC2+1)<C AND REF("KDJ.K",CC2+1)>"KDJ.K" ANDCROSS("KDJ.D","KDJ.K")>0;CC3:=BARSLAST(REF(CROSS("RSI.RSI2","RSI.RSI1"),1));RSI顶背离:=REF(C,CC3+1)<C AND REF("RSI.RSI1",CC3+1)>"RSI.RSI1" AND CROSS("RSI.RSI2","RSI.RSI1")>0;CC4:=BARSLAST(REF(CROSS("BIAS.BIAS2","BIAS.BIAS1"),1));BIAS顶背离:=REF(C,CC4+1)<C AND REF("BIAS.BIAS1",CC4+1)>"BIAS.BIAS1" AND CROSS("BIAS.BIAS2","BIAS.BIAS1")>0;{CCI}N:=60;DD:=C=LLV(C,N);{60日最低点}DDSJ:=BARSLAST(REF(DD,1));{上一低点时间}DDGJ:=REF(CLOSE,DDSJ+1)>CLOSE;{股价趋势}GD:=C=HHV(C,N);{60日最高点}GDSJ:=BARSLAST(REF(GD,1));{上一高点时间}GDGJ:=REF(CLOSE,GDSJ+1)<CLOSE;{股价趋势}TYP:=(HIGH + LOW + CLOSE)/3;CCI:=(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));CDZB:=REF(CCI,DDSJ+1)<CCI;{CCI指标趋势}CCI底背离:=DDGJ AND CDZB;CGZB:=REF(CCI,GDSJ+1)>CCI;CCI顶背离:=GDGJ AND CGZB;K值:="KDJ.K";KDZB:=REF(K值,DDSJ+1)<K值;{KDJ.K指标趋势}K底背离:=DDGJ AND KDZB{ AND K超卖};KGZB:=REF(K值,GDSJ+1)>K值;K顶背离:=GDGJ AND KGZB;MACD:="MACD.MACD";MDZB:=REF(MACD,DDSJ+1)<MACD;{MACD指标趋势}M底背离:=DDGJ AND MDZB;MGZB:=REF(MACD,GDSJ+1)>MACD;M顶背离:=GDGJ AND MGZB;RSI:="RSI.RSI1";RDZB:=REF(RSI,DDSJ+1)<RSI;{RSI指标趋势}R底背离:=DDGJ AND RDZB;RGZB:=REF(RSI,GDSJ+1)>RSI;R顶背离:=GDGJ AND RGZB;BIAS:="BIAS.BIAS1";BDZB:=REF(BIAS,DDSJ+1)<BIAS;{BIAS指标趋势}B底背离:=DDGJ AND BDZB;BGZB:=REF(BIAS,GDSJ+1)>BIAS;B顶背离:=GDGJ AND BGZB;DRAWTEXT(ISLASTBAR,19,' CCI底背离'),LINETHICK2,COLORGREEN;DRAWTEXT(CCI底背离,IF(ISLASTBAR,19,19),'I'),LINETHICK2,COLORGREEN; DRAWTEXT(ISLASTBAR,16,' RSI底背离'),LINETHICK2,COLORWHITE; DRAWTEXT(R底背离,IF(ISLASTBAR,16,16),'I'),LINETHICK2,COLORWHITE; DRAWTEXT(RSI底背离,IF(ISLASTBAR,16,16),'-'),LINETHICK2,COLORWHITE; DRAWTEXT(ISLASTBAR,13,' MACD底背离'),LINETHICK2,COLORMAGENTA; DRAWTEXT(M底背离,IF(ISLASTBAR,13,13),'I'),LINETHICK2,COLORMAGENTA; DRAWTEXT(MACD底背离,IF(ISLASTBAR,13,13),'-'),LINETHICK2,COLORMAGENTA; DRAWTEXT(ISLASTBAR,10,' KDJ底背离'),LINETHICK2,COLORRED; DRAWTEXT(K底背离,IF(ISLASTBAR,10,10),'I'),LINETHICK2,COLORRED; DRAWTEXT(KDJ底背离,IF(ISLASTBAR,10,10),'-'),LINETHICK2,COLORRED; DRAWTEXT(ISLASTBAR,7,' BIAS底背离'),LINETHICK2,COLORYELLOW; DRAWTEXT(B底背离,IF(ISLASTBAR,7,7),'I'),LINETHICK2,COLORYELLOW; DRAWTEXT(BIAS底背离,IF(ISLASTBAR,7,7),'-'),LINETHICK2,COLORYELLOW; DRAWTEXT(ISLASTBAR,4,' BIAS底背离'),LINETHICK2,COLORYELLOW; DRAWTEXT(ISLASTBAR,34,' BIAS顶背离'),LINETHICK2,COLORYELLOW; DRAWTEXT(B顶背离,IF(ISLASTBAR,34,34),'I'),LINETHICK2,COLORYELLOW; DRAWTEXT(BIAS顶背离,IF(ISLASTBAR,34,34),'-'),LINETHICK2,COLORYELLOW; DRAWTEXT(ISLASTBAR,31,' KDJ顶背离'),LINETHICK2,COLORRED; DRAWTEXT(K顶背离,IF(ISLASTBAR,31,31),'I'),LINETHICK2,COLORRED; DRAWTEXT(KDJ顶背离,IF(ISLASTBAR,31,31),'-'),LINETHICK2,COLORRED; DRAWTEXT(ISLASTBAR,28,' MACD顶背离'),LINETHICK2,COLORMAGENTA; DRAWTEXT(M顶背离,(ISLASTBAR,28,28),'I'),LINETHICK2,COLORMAGENTA; DRAWTEXT(MACD顶背离,(ISLASTBAR,28,28),'-'),LINETHICK2,COLORMAGENTA; DRAWTEXT(ISLASTBAR,25,' RSI顶背离'),LINETHICK2,COLORWHITE; DRAWTEXT(R顶背离,(ISLASTBAR,25,25),'I'),LINETHICK2,COLORWHITE; DRAWTEXT(RSI顶背离,(ISLASTBAR,25,25),'-'),LINETHICK2,COLORWHITE; DRAWTEXT(ISLASTBAR,22,' CCI顶背离'),LINETHICK2,COLORGREEN; DRAWTEXT(CCI顶背离,(ISLASTBAR,22,22),'I'),LINETHICK2,COLORGREEN;{超买超卖}K超买:="KDJ.K">=80 OR "KDJ.D">=80 OR "KDJ.J">=100;K超卖:="KDJ.K"<=20 OR "KDJ.D"<=30 OR "KDJ.J"<0;{RSI:="RSI.RSI1"; }R超买:=RSI>=80;R超卖:=RSI<=20;C超买:="I">=100;C超卖:="I"<=-100;{BIAS:="BIAS.BIAS1";}B超买:="BIAS.BIAS1">3.5 OR "BIAS.BIAS2">5;B超卖:="BIAS.BIAS1"<-3 OR "BIAS.BIAS2"<-4;{超卖超买显示}{DRAWTEXT(B超买,IF(ISLASTBAR,34,34),'○'),LINETHICK2,COLORYELLOW; DRAWTEXT(K超买,IF(ISLASTBAR,31,31),'○'),LINETHICK2,COLORRED; DRAWTEXT(R超买,(ISLASTBAR,25,25),'○'),LINETHICK2,COLORWHITE; DRAWTEXT(C超买,(ISLASTBAR,22,22),'○'),LINETHICK2,COLORGREEN;} {DRAWTEXT(C超卖,IF(ISLASTBAR,19,19),'○'),LINETHICK2,COLORGREEN; DRAWTEXT(R超卖,IF(ISLASTBAR,16,16),'○'),LINETHICK2,COLORWHITE; DRAWTEXT(K超卖,IF(ISLASTBAR,10,10),'○'),LINETHICK2,COLORRED; DRAWTEXT(B超卖,IF(ISLASTBAR,7,7),'○'),LINETHICK2,COLORYELLOW;} {BAIS买入}BIAS5:=(C-MA(C,6))/MA(C,6)*100;BIAS6:=(C-MA(C,12))/MA(C,12)*100;BIAS7:=(C-MA(C,24))/MA(C,24)*100;BIAS8:=(BIAS5+2*BIAS6+3*BIAS7)/6;乖离:=MA(BIAS8,6);STICKLINE(CROSS(BIAS8,乖离) AND 乖离<-9,18,20,1,0),COLORRED;超卖O背离I:1,NODRAW,COLORWHITE;顶背比底背更准:1,NODRAW,COLORGREEN;红方点BIAS买点:1,NODRAW,COLORRED;。