短线多空 MACD指标 趋势一目了然通达信指标公式源码
通达信指标公式源码好厉害的MACD背离(通达信副图指标)
通达信指标公式源码好厉害的MACD背离
(通达信副图指标)
MACD背离是一种通达信副图指标,它可以帮助我们更
好地判断市场走势。
DIF和DEA是MACD指标中的两个重要
参数,其中DIF表示短期EMA(12日)和长期EMA(26日)的差值,DEA表示DIF的9日EMA。
我们可以通过改变DIF
和DEA的数值来调整MACD指标的敏感度。
持仓段和空仓段是两个重要的标志,它们可以帮助我们更好地判断市场走势。
当DIF大于DEA时,我们可以认为市场
处于持仓段,此时我们可以考虑建仓或加仓;当DIF小于
DEA时,我们可以认为市场处于空仓段,此时我们应该考虑
减仓或空仓。
在MACD指标中,我们还可以使用STICKLINE函数来
绘制柱状图。
当MACD小于前一天的MACD并且大于0时,
我们可以使用COLORLIBLUE来表示;当MACD大于前一天
的MACD并且小于0时,我们可以使用COLORFF00FF来表示。
二次金叉和底背离是MACD指标中的两个重要信号。
当DIF和DEA交叉两次并且DEA小于0时,我们可以认为出现了二次金叉。
当收盘价比前一天低并且DIF高于前一天的DIF 时,我们可以认为出现了底背离。
在绘制底背离时,我们可以使用STICKLINE函数来绘制绿色的柱状图,同时使用DRAWLINE函数来绘制红色的线条。
实用 macd通达信指标公式源码
简洁大方实用macd 方便自己diy!!拒绝花哨给喜欢macd的坛友添加一点色彩里边信号精准方便参考!DIF:EMA(CLOSE,D1)-EMA(CLOSE,D2);DEA:EMA(DIF,D3);MACD:2*(DIF-DEA), COLORSTICK,LINETHICK2;低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;STICKLINE(低位金叉,0,0.12,4,0),COLORYELLOW;DRAWTEXT(低位金叉,0.1,' 低位金叉'),COLORWHITE;JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,30)=1; STICKLINE(二次金叉,0,0.06,4,0),COLORFF00FF;DRAWICON(二次金叉,DEA*0.9,1) ;DRAWTEXT(二次金叉,0.3,' 二次金叉'),COLORYELLOW;A1:=BARSLAST(REF(CROSS(DIF,DEA),1));{上一次昨日MACD金叉到当日周期数。
}底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA) ANDDEA<0;{上次金叉时的收盘价>当日收盘价,股价创新低,当日MACD金叉点却未创新低,形成底背离,并且在0轴之下。
}STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;{第一次金叉为起点,出现底背离的第二次金叉为终点,画线段。
}DRAWTEXT(底背离,-0.15,' 底背离'),COLORFF00FF;A2:=BARSLAST(REF(CROSS(DEA,DIF),1));顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF); DRAWTEXT(顶背离,0.3,' 顶背离'),COLORGREEN;顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;。
新版极品整合MACD划线指标公式通达信指标公式源码
通达信新版极品整合MACD划线指标公式DIF:EMA(CLOSE,12)-EMA(CLOSE,26);DEA:EMA(DIF,9),COLOR888888;NOTEXT5:IF(DIF>=DEA, DIF,DRAWNULL),COLORRED;NOTEXT6:IF(DIF<DEA, DIF,DRAWNULL),COLORWHITE;AT1:=BARSLAST(REF(CROSS(DIF,DEA),1));BT1:=REF(C,AT1+1)>C AND REF(DIF,AT1+1)<DIF AND CROSS(DIF,DEA); AT2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));CT1:=BARSLAST(REF(CROSS(DEA,DIF),1));DT1:=REF(C,CT1+1)<C AND REF(DIF,CT1+1)>DIF AND CROSS(DEA,DIF); MACD底背:IF(BT1>0,-0.1,0),COLORRED;MACD顶背:IF(DT1>0,0.1,0),COLOR00FF00;STICKLINE(BT1>0,0.5*DIF,0,2,0),COLORRED;STICKLINE(DT1>0,0.5*DIF,0,2,0),COLOR00FF00;MACD:(DIF-DEA)*2,COLORSTICK;STICKLINE(MACD<REF(MACD,1) AND MACD>0, 0,MACD,0,0),COLOR44FF00; STICKLINE(MACD>REF(MACD,1) AND MACD<0, 0,MACD,0,0),COLOR0066FF;M1:=13;M2:=13;A1:=REF(DIF,M1)=HHV(DIF,2*M1+1);B1:=FILTER(A1,M1);C1:=BACKSET(B1,M1+1);D1:=FILTER(C1,M1);E1:=BACKSET(ISLASTBAR,BARSLAST(D1)+1);F1:=E1>REF(E1,1);A2:=REF(DIF,M2)=LLV(DIF,2*M2+1);B2:=FILTER(A2,M2);C2:=BACKSET(B2,M2+1);D2:=FILTER(C2,M2);E2:=BACKSET(ISLASTBAR,BARSLAST(D2)+1);F2:=E2>REF(E2,1);压力线:DRAWLINE(D1,DIF,F1,DIF,0),COLORFFFF00,DOTLINE;支撑线:DRAWLINE(D2,DIF,F2,DIF,0),COLOR00AAFF,DOTLINE;G3:=FILTERX(支撑线>REF(支撑线,1) && DIF>支撑线&& REF(支撑线,1)=REF(DIF,1),2); 底抬高:DRAWLINE(D2,DIF,G3,支撑线,0),COLORYELLOW,DOTLINE;{画趋势线}M:=INTPART(3*10/5);A12:=REF(DIF,M)=HHV(DIF,2*M+1);B12:=FILTER(A12,M);C12:=BACKSET(B12,M+1);D12:=FILTER(C12,M);R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+1);S112:=R112>REF(R112,1);AL12:=REF(DIF,M)=LLV(DIF,2*M+1);BL12:=FILTER(AL12,M);CL12:=BACKSET(BL12,M+1);DL12:=FILTER(CL12,M);RL112:=BACKSET(ISLASTBAR,BARSLAST(DL12)+1);SL112:=RL112>REF(RL112,1);短压线:DRAWLINE(D12,DIF,S112,DIF,0),COLOR99FF00,DOTLINE;短撑线:DRAWLINE(DL12,DIF,SL112,DIF,0),COLOR0055FF,DOTLINE;VARX2:=LLV(DEA,43);VARX3:=DEA-(DIF-DEA);低点线:=IF(DIF<VARX2 AND DEA=VARX2,MIN(HHV(VARX2,10),VARX3),VARX2);VL:=REF(LOW,1);VAR12:=(SMA(ABS(LOW-VL),13,1))/(SMA(MAX(LOW-VL,0),13,1))*100;VAR14:=MA(VAR12,13);VAR15:=LLV(LOW,34);VAR18:=EMA(IF(LOW<=VAR15,VAR14,0),3);VAR110:=SMA(SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,7,1),5,1); VAR111:=SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,8,1)*15-VAR1 10*10.38;T:=FILTER(IF(VAR111<=VAR110 AND VAR18>0,VAR18*8,0),5);止跌:DRAWTEXT(T AND DIF<低点线,DIF*1.01,'止跌'),COLORYELLOW;{形态}A:=IF(CROSS(0,DEA),1,0);A11:=IF(DIF<0 AND CROSS(DIF,DEA),1,0);SS:=IF(A,SUM(A11,0),0);SSB:=HHV(SS,0);SSS:=SUM(A11,0);W底:=SSS-SSB=2 AND SSS>REF(SSS,1);DRAWTEXT(W底,DIF,'↖W底'),COLOR0080FF;MACD金叉:=CROSS(MACD,DIF) AND MACD>=(0-0.05) AND MACD<=0.02; DRAWTEXT(MACD金叉,MACD,'-MACD金叉'),COLOR00FFFF;低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1; DRAWTEXT(二次金叉,0.01,'二次金叉'),COLOR5500FF;AA11:=BARSLAST(REF(CROSS(DIF,DEA),1));底背离:=REF(CLOSE,AA11+1)>CLOSE AND DIF>REF(DIF,AA11+1) ANDCROSS(DIF,DEA);底背:DRAWLINE(AA11=0,DIF,底背离,DIF,0),COLORYELLOW,LINETHICK2;AA22:=BARSLAST(REF(CROSS(DEA,DIF),1));顶背离:=REF(CLOSE,AA22+1)<CLOSE AND REF(DIF,AA22+1)>DIF ANDCROSS(DEA,DIF);顶背:DRAWLINE(AA22=0,DIF,顶背离,DIF,0),COLORGREEN,LINETHICK2; DRAWTEXT(底背离,DIF*0.5,'-DIF底背'),COLOR0055FF;DRAWTEXT(顶背离,DIF*0.5,'-DIF顶背'),COLOR99FF00;{小周期}N:=3;DIF3_6.5F:=(EMA(CLOSE,3)-(EMA(CLOSE,6)+EMA(CLOSE,7))/2);DEA3_6.5F:=(EMA(DIF3_6.5F,3)+EMA(DIF3_6.5,2));AA:=REF(DIF3_6.5F,N)=HHV(DIF3_6.5F,2*N+1);CC:=FILTER(BB,N) AND DIF3_6.5F=HHV(DIF3_6.5F,N+1);AX1:=BARSLAST(REF(CC,1));小顶背离:=REF(CLOSE,AX1+1)<CLOSE AND REF(DIF3_6.5F,AX1+1)>DIF3_6.5F AND CC; DRAWTEXT(小顶背离,DIF3_6.5F*1.2,'-小顶背离'),COLORGREEN;DRAWICON(小顶背离>0,DIF3_6.5F*1.2,2);AAA2:=REF(DIF3_6.5F,N)=LLV(DIF3_6.5F,2*N+1);BBB2:=BACKSET(AAA2,N+1);CCC2:=FILTER(BBB2,N) AND DIF3_6.5F=LLV(DIF3_6.5F,N+1);AX2:=BARSLAST(REF(CCC2,1));小底背离:=REF(CLOSE,AX2+1)>CLOSE AND REF(DIF3_6.5F,AX2+1)<DIF3_6.5F;{画白柱线}VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);VA2:=CROSS(BACKSET(CROSS(0,MACD),REF(VA1,1)+2),0.5);QG:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR ANDMACD>0),REF(VA1,1)+2),0.5);前高:=DRAWLINE(VA2,MACD,REF(VA2,1),REF(MACD,1),1),COLORMAGENTA;VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);VA4:=CROSS(BACKSET(CROSS(MACD,0),REF(VA3,1)+2),0.5);前低:=DRAWLINE(VA4,MACD,REF(VA4,1),REF(MACD,1),1);BD:=BARSLAST(FILTERX(CROSS(0,MACD),BARSCOUNT(C)));BDTJ:=IF(MACD<0,FILTERX(MACD=LLV(MACD,BARSLAST(MACD>0)),BARSCOUNT(C)),DRAWNULL);TSBDTJ:=BARSLAST(BDTJ);BDZH:=FILTERX(MACD<CONST(LLV(MACD,BD+1)),BARSCOUNT(C));BDTS:=BARSLAST(BDZH);本低:=IF(BD+1>=1,CONST(LLV(MACD,BD+1)),DRAWNULL);BDCL:=CROSS(COUNT(CROSS(MACD>本低/2 AND MACD<0,0.5),TSBDTJ)=1,0.5) AND TSBDTJ>=0;终点:=IF(ISLASTBAR AND MACD>0 AND MACD=HHV(MACD,BARSLAST(MACD<0)),1,IF(FILTERX(QG,BARSCOUNT(C)),2,DRAWNULL));UU:=(终点=1 OR 终点=2) AND MACD>0;ZZ:=FILTERX(UU,BARSCOUNT(C));本高:=DRAWLINE(ZZ,MACD,REF(ZZ,1),REF(MACD,1),1),COLORWHITE;WQG:=CROSS(COUNT(CROSS(MACD<本高/2 AND MACD>0,0.5),ZZ)=1,0.5) AND ZZ>=0;STICKLINE(MACD>前高,MACD,前高,0,0),COLORFFFFFF;STICKLINE(MACD<0 AND MACD<前低AND 前低<0,MACD,前低,0,0),COLORFFFFFF; DRAWICON(CROSS(DIF,DEA),DEA,1);DRAWICON(CROSS(DEA,DIF),DEA,2);底:ABS((CROSS("MACD.DIF","MACD.DEA")&&"MACD.DEA"<=-0.07)*"MACD.DIF")*1.50, COLORLIMAGENTA;DRAWTEXT(ABS(底)>0,底*1.20,'底'),COLORYELLOW;。
通达信指标公式源码好厉害的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;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;。
通达信指标公式源码 趋势指标+多空对比
RSV:=(CLOSE-LLV(LOW,7))/(HHV(HIGH,7)-LLV(LOW,7))*100;短多:SMA(RSV,3,1),COLORRED,LINETHICK1;短空:SMA(短多,3,1),COLORYELLOW,LINETHICK1;RSV1:=(CLOSE-LLV(LOW,38))/(HHV(HIGH,38)-LLV(LOW,38))*100;中多:SMA(RSV1,5,1),COLORFF00FF,LINETHICK1;中空:SMA(中多,10,1),COLORGREEN,LINETHICK1;DRAWBAND(中多,RGB(055,50,34),中空,RGB(100,100,50)); DRAWBAND(短多,RGB(255,50,34),短空,RGB(0,91,0));短期:=100*(C-LLV(L,5))/(HHV(C,5)-LLV(L,5)),COLORWHITE;中期:=100*(C-LLV(L,10))/(HHV(C,10)-LLV(L,10)),COLORYELLOW;中长期:=100*(C-LLV(L,20))/(HHV(C,20)-LLV(L,20)),COLORMAGENTA;长期:=100*(C-LLV(L,30))/(HHV(C,30)-LLV(L,30)),COLORRED,LINETHICK2; 长强势区:=IF((EVERY(短多>=REF(短多,1),1)AND 短多<短空),5,0)COLOR0000FF,LINETHICK3;低买:IF((CROSS(长强势区,0.1)),10,0),COLORWHITE,LINETHICK3;长强势区1:=IF((EVERY(中多>=REF(中多,1),1)AND 中多<18),5,0)COLOR0000FF,LINETHICK3;低买1:IF((CROSS(长强势区1,0.1)),5,0),COLORGREEN,LINETHICK3;长强势区11:=IF((EVERY(中多<=REF(中多,1),1)AND 中多>85),5,0)COLOR0000FF,LINETHICK3;高卖11:IF((CROSS(长强势区11,0.1)),105,110),COLORGREEN,LINETHICK3; 长强势区2:=IF((EVERY(短多<=REF(短多,1),1)AND 短多>短空),5,0)COLOR0000FF,LINETHICK3;低买2:IF((CROSS(长强势区2,0.1)),100,110),COLOR00FFFF,LINETHICK3;短期2:100*(C-LLV(L,5))/(HHV(C,5)-LLV(L,5)),COLORWHITE;中期2:100*(C-LLV(L,10))/(HHV(C,10)-LLV(L,10)),DOTLINE,COLORGRAY; 中长期2:100*(C-LLV(L,20))/(HHV(C,20)-LLV(L,20)),DOTLINE,COLORGRAY;长期2:100*(C-LLV(L,30))/(HHV(C,30)-LLV(L,30)),COLORRED,LINETHICK2;。
通达信指标公式源码 超前MACD优化版 副图源码
DIFF:EMA(CLOSE,7) - EMA(CLOSE,19);DEA:EMA(DIFF,9);MACD:6*(DIFF-DEA),COLORSTICK;A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("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)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("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)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT;KDJ底背:IF(B2>0,-0.1,0),COLORCC0055,POINTDOT;RSI底背:IF(B3>0,-0.1,0),COLORYELLOW,POINTDOT;MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;KDJ顶背:IF(D2>0,0.1,0),COLORFFCC66,POINTDOT;RSI顶背:IF(D3>0,0.1,0),COLORWHITE,POINTDOT;STICKLINE(B1>0,-0.2,0,2.5,1),COLORMAGENTA;STICKLINE(B2>0,-0.16,0,3.5,1),COLORCC0066;STICKLINE(B3>0,-0.18,0,5,1),COLORYELLOW;STICKLINE(D1>0,0.2,0,2.5,0),COLOR00FF00;STICKLINE(D2>0,0.18,0,3.5,0),COLORFFCC66;STICKLINE(D3>0,0.16,0,6,0),COLORWHITE;STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1,1),COLORRED; STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,0,1),COLORCYAN; STICKLINE(MACD<REF(MACD,1) AND MACD<0,0,MACD,1,1),COLORGREEN; STICKLINE(MACD>=REF(MACD,1) AND MACD<0,0,MACD,1,1),COLORMAGENTA; STICKLINE(C>0,0,0,50,1),COLORBLUE;DIFF,COLORGREEN;DEA,COLORYELLOW;强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED;弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA;{大盘神针}UAR1:=INDEXA/100000000;UAR2:=INDEXADV;UAR3:=INDEXDEC;UAR4:=UAR2/(UAR2+UAR3);UAR5:=UAR3/(UAR2+UAR3);UAR6:=EMA(UAR4,3);UAR7:=EMA(UAR5,3);UAR8:=EMA(UAR6,5);UAR9:=EMA(UAR7,5);进场资金: EMA(UAR8,10)/150 ;资金: EMA(UAR9,10)/150;大盘神针:=(SMA(MAX(CLOSE-REF(CLOSE,1),0),7,1)/SMA(ABS(CLOSE-REF(CLOSE,3)),7,1)*100< 20ANDSMA(MAX(CLOSE-REF(CLOSE,3),0),13,1)/SMA(ABS(CLOSE-REF(CLOSE,3)),13,1)*100<25 AND MA((LLV(LOW,45)-CLOSE)/(HHV(HIGH,45)-LLV(LOW,45))*100,5)>-19AND (LOW>LLV(LOW,5) AND (CLOSE-HHV(CLOSE,8))/HHV(CLOSE,8)<-0.05 ANDMA(AMOUNT,125)/MA(VOL,125)/(MA(AMOUNT,5)/MA(VOL,5))>1.12))*0.75;买入:=BARSLAST(大盘神针)<15 AND CROSS(MACD.DIF,MACD.DEA);底:=BARSLAST(LLV(L,4)=LLV(L,120))<5 ;均线买:=CROSS(MA(C,5),MA(C,20));买:=(底AND 均线买AND (进场资金>资金) OR 买入);STICKLINE(买,资金-1.35,资金-1.5,2,0),COLORYELLOW;DRAWTEXT(买,资金-1.28,'买'),COLORYELLOW;安全区:STICKLINE(底,资金-0.01,资金,0.04,1),COLORRED;{黄雀}短线趋势:=(EMA(C,7) - EMA(C,13));中线趋势:=EMA(短线趋势,13);VAR4:=MA(C,7);VAR5:=MA(C,13);VAR6:=MA(C,34);VAR7:=MA(C,55);VAR10:=((0 - ((10 * (HHV(C,5) - C)) / (HHV(C,5) - LLV(L,5)))) + 10);VAR11:=((0 - ((10 * (HHV(C,13) - C)) / (HHV(C,13) - LLV(L,13)))) + 10);VAR12:=((0 - ((10 * (HHV(C,21) - C)) / (HHV(C,21) - LLV(L,21)))) + 10);VAR13:=((0 - ((10 * (HHV(C,34) - C)) / (HHV(C,34) - LLV(L,34)))) + 10);VAR14:=REF(中线趋势,1);VAR15:=中线趋势;VAR16:=(VAR15 - VAR14);VAR17:=REF(短线趋势,1);VAR18:=短线趋势;VAR19:=(VAR18 - VAR17);VARE:=(SUM(((C * VOL) * 10),34) / SUM((VOL * 200),34));VARF:=(INTPART((VARE * 10)) / 10);吃货:(((((((O<= VAR4) AND (O<= VAR5)) AND (O<= VAR6)) AND (C>= VAR4)) AND (C>= VARF)) AND (VAR16 > 0)) AND (VAR19 > 0)),LINETHICK0;DRAWBAND (0>吃货,RGB(0,0,0),0<吃货,RGB(200,0,10)),NODRAW;STICKLINE (吃货,-1.75,-1.60,5,1),COLORCC0099;{抄}STICKLINE((DMI.PDI(14,6)<5 AND DMI.ADX(14,6)>70),1.5,-1.5,0,-1),COLORRED; DRAWTEXT (抄,-1.58,'抄'),COLORRED;{一阳二阴}VAR1:=3;VAR2:=((3 * SMA((((CLOSE - LLV(LOW,89)) / (HHV(HIGH,89) - LLV(LOW,89))) * 100),5,1))- (2 * SMA(SMA((((CLOSE - LLV(LOW,89)) / (HHV(HIGH,89) - LLV(LOW,89))) * 100),5,1),3,1)));大赚小赔:1.5*IF(CROSS(VAR2,VAR1),-0.89,-1),COLORRED,LINETHICK1;{黄金坑}RR8:=MA(CLOSE,27);RR9:=(CLOSE-RR8)/RR8*100;RRA:=MA(RR9,2);RRB:=BARSLAST(CROSS(-10,RRA)=1);RRD:=RRA<-10 AND RRB>3;黄金坑:0.01*IF(RRD,-300,1),COLORYELLOW,LINETHICK2;{神秘买点}SM01:=MA((2*C+H+L)/4,5);SM02:=SM01*(200-102)/100;SM03:=(1-7/100)*DMA(C,ABS((2*C+H+L)/4-MA(C,20))/MA(C,20));SM04:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;SM05:=3*SMA(SM04,3,1)-2*SMA(SMA(SM04,3,1),3,1);SM06:=((H+L+C)/3-MA((H+L+C)/3,14))/(0.015*AVEDEV((H+L+C)/3,14));SM07:=SM02<SM03&&SM05>REF(SM05,1)&&REF(SM05,1)<REF(SM05,2)&&SM06<-100 &&SM06>REF(SM06,1);神秘买点:IF(SM07*0.35,-1.3,-1.5),COLORCC0099,LINETHICK1;{止盈}转折周期:=7;转折灵敏:=50;TTR:=SMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),转折周期,1);HD:=HIGH-REF(HIGH,1);LD:=REF(LOW,1)-LOW;DMP:=SMA(IF(HD>0 AND HD>LD,HD,0),转折周期,1);DMM:=SMA(IF(LD>0 AND LD>HD,LD,0),转折周期,1);正DI:=DMP*100/TTR,COLORRED;负DI:=DMM*100/TTR,COLORGREEN;转折点:SMA(ABS(负DI-正DI)/(负DI+正DI)*100,转折周期,1),NODRAW;转折点A:=FILTER(转折点<REF(转折点,1)-1.3 AND EVERY(REF(转折点,1)>=REF(转折点,2)-1.3,5) AND REF(转折点,1)>转折灵敏,5);STICKLINE(转折点A AND REF(正DI>负DI,1),1.5,-1.5,0,-1),COLORGREEN; DRAWTEXT (转折点A AND REF(正DI>负DI,1),1.45,'止'),COLORGREEN;顶:1.5*IF(LAST(MA(C,5)>MA(C,10),5,0) AND "I"<REF("I",1) AND CROSS(100,"I"),0.9,1),COLORWHITE;N:=38;N1:=5;N2:=13;WAR1:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*80;X: SMA(WAR1,7,1),LINETHICK1,NODRAW;WAR2:=SMA(X,5,1);Y: IF(CROSS(X,WAR2) AND CROSS(MA(C,N1),MA(C,N2) AND X>50) ,WAR2*2,WAR2),COLORYELLOW,NODRAW;WAR4:= EMA(CLOSE,8);WAR5:= EMA(CLOSE,20);黑码上山:IF(CROSS(MA(CLOSE,1),MA(CLOSE,N)) AND X-Y>2 AND WAR4>WAR5 ,WAR2*2,WAR2),COLOR00FF00,NODRAW;入:=(CROSS(MA(CLOSE,1),MA(CLOSE,N)) AND X-Y>2 AND WAR4>WAR5 );排序:IF(入>0,2,0), STICK,COLORCC0099;DRAWICON(排序>0,2,1);STICKLINE(X>WAR2,X,Y,0,0), , COLORF00FF0,NODRAW;STICKLINE(X<WAR2,X,WAR2,0,0), ,COLOR00FF00,NODRAW ;。
通达信指标公式源码 机构,大户,中户,散户资金流副图 资金出入一目了然 贴图
V1:=DMA((((HIGH + LOW) + (CLOSE * 2)) / 4),0.9);HY1:=REF(EMA(V1,3),1);多空趋势:=(MA((CLOSE - HY1) * 10,2))*0.1;操盘4:STICKLINE(多空趋势>=0 AND 多空趋势>=REF(多空趋势,1),6.5,6.5+多空趋势,1.5,0),COLORRED;减仓4:STICKLINE(多空趋势>=0 AND 多空趋势< REF(多空趋势,1),6.5,6.5+多空趋势,1.5,0), COLORRED;反弹4:STICKLINE(多空趋势<0 AND 多空趋势>=REF(多空趋势,1),6.5,6.5+多空趋势,1.5,0),COLORGREEN;寻底4:STICKLINE(多空趋势<0 AND 多空趋势< REF(多空趋势,1),6.5,6.5+多空趋势,1.5,0),COLORGREEN;DRAWTEXT(ISLASTBAR=1,IF(多空趋势>=0,6,6.3),' 多空'),COLORWHITE;换手:=V*100/CAPITAL;主力:=MA(换手,4);大户:=MA(换手,9);中户:=MA(换手,17);散户:=MA(换手,34);均量:=(主力+大户+中户+散户)/4;成交量:V,COLORWHITE,NODRAW;主力能量:(主力-均量)COLORMAGENTA,NODRAW;大户能量:(大户-均量)COLORYELLOW,NODRAW;中户能量:(中户-均量)COLORLIBLUE,NODRAW;散户能量:(散户-均量)COLORBLUE,NODRAW;操盘:STICKLINE(主力能量>=0 AND 主力能量>=REF(主力能量,1),4.5,4.5+主力能量,1.5,0),COLORYELLOW;减仓:STICKLINE(主力能量>=0 AND 主力能量< REF(主力能量,1),4.5,4.5+主力能量,1.5,0),COLORRED;反弹:STICKLINE(主力能量<0 AND 主力能量>=REF(主力能量,1),4.5,4.5+主力能量,1.5,0),COLORGREEN;寻底:STICKLINE(主力能量<0 AND 主力能量< REF(主力能量,1),4.5,4.5+主力能量,1.5,0),COLORGREEN;DRAWTEXT(ISLASTBAR=1,IF(主力能量>=0,4.2,4.8),' 机构'),COLORMAGENTA;操盘1:STICKLINE(大户能量>=0 AND 大户能量>=REF(大户能量,1),3,3+大户能量,1.5,0),COLORWHITE;减仓1:STICKLINE(大户能量>=0 AND 大户能量< REF(大户能量,1),3,3+大户能量,1.5,0),COLORRED;反弹1:STICKLINE(大户能量<0 AND 大户能量>=REF(大户能量,1),3,3+大户能量,1.5,0),COLORGREEN;寻底1:STICKLINE(大户能量<0 AND 大户能量< REF(大户能量,1),3,3+大户能量,1.5,0),COLORGREEN;DRAWTEXT(ISLASTBAR=1,IF(大户能量>=0,2.7,3.3),' 大户'),COLORYELLOW;操盘2:STICKLINE(中户能量>=0 AND 中户能量>=REF(中户能量,1),1.5,1.5+中户能量,1.5,0),COLORRED;减仓2:STICKLINE(中户能量>=0 AND 中户能量< REF(中户能量,1),1.5,1.5+中户能量,1.5,0),COLORRED;反弹2:STICKLINE(中户能量<0 AND 中户能量>=REF(中户能量,1),1.5,1.5+中户能量,1.5,0),COLORGREEN;寻底2:STICKLINE(中户能量<0 AND 中户能量< REF(中户能量,1),1.5,1.5+中户能量,1.5,0),COLORGREEN;DRAWTEXT(ISLASTBAR=1,IF(中户能量>=0,1.2,1.8),' 中户'),COLORLIBLUE;操盘3:STICKLINE(散户能量>=0 AND 散户能量>=REF(散户能量,1),0,散户能量,1.5,0),COLORRED;减仓3:STICKLINE(散户能量>=0 AND 散户能量< REF(散户能量,1),0,散户能量,1.5,0),COLORRED;反弹3:STICKLINE(散户能量<0 AND 散户能量>=REF(散户能量,1),0,散户能量,1.5,0),COLORGREEN;寻底3:STICKLINE(散户能量<0 AND 散户能量< REF(散户能量,1),0,散户能量,1.5,0),COLORGREEN;DRAWTEXT(ISLASTBAR=1,IF(散户能量>=0,-0.3,0.3),' 散户'),COLORBLUE;JZ:=V/(ABS(主力能量)+ABS(大户能量)+ABS(中户能量)+ABS(散户能量));ZLCJ:=JZ*ABS(主力能量);DHCJ:=JZ*ABS(大户能量);ZHCJ:=JZ*ABS(中户能量);SHCJ:=JZ*ABS(散户能量);机构量:ZLCJ,COLORMAGENTA,NODRAW;大户量:DHCJ,COLORYELLOW,NODRAW;中户量:ZHCJ,COLORLIBLUE,NODRAW;散户量:SHCJ,COLORBLUE,NODRAW;。
通达信指标公式源码 超前MACD优化版 副图源码
DIFF:EMA(CLOSE,7) - EMA(CLOSE,19);DEA:EMA(DIFF,9);MACD:6*(DIFF-DEA),COLORSTICK;A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("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)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("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)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT;KDJ底背:IF(B2>0,-0.1,0),COLORCC0055,POINTDOT;RSI底背:IF(B3>0,-0.1,0),COLORYELLOW,POINTDOT;MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;KDJ顶背:IF(D2>0,0.1,0),COLORFFCC66,POINTDOT;RSI顶背:IF(D3>0,0.1,0),COLORWHITE,POINTDOT;STICKLINE(B1>0,-0.2,0,2.5,1),COLORMAGENTA;STICKLINE(B2>0,-0.16,0,3.5,1),COLORCC0066;STICKLINE(B3>0,-0.18,0,5,1),COLORYELLOW;STICKLINE(D1>0,0.2,0,2.5,0),COLOR00FF00;STICKLINE(D2>0,0.18,0,3.5,0),COLORFFCC66;STICKLINE(D3>0,0.16,0,6,0),COLORWHITE;STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1,1),COLORRED; STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,0,1),COLORCYAN; STICKLINE(MACD<REF(MACD,1) AND MACD<0,0,MACD,1,1),COLORGREEN; STICKLINE(MACD>=REF(MACD,1) AND MACD<0,0,MACD,1,1),COLORMAGENTA; STICKLINE(C>0,0,0,50,1),COLORBLUE;DIFF,COLORGREEN;DEA,COLORYELLOW;强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED;弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA;{大盘神针}UAR1:=INDEXA/100000000;UAR2:=INDEXADV;UAR3:=INDEXDEC;UAR4:=UAR2/(UAR2+UAR3);UAR5:=UAR3/(UAR2+UAR3);UAR6:=EMA(UAR4,3);UAR7:=EMA(UAR5,3);UAR8:=EMA(UAR6,5);UAR9:=EMA(UAR7,5);进场资金: EMA(UAR8,10)/150 ;资金: EMA(UAR9,10)/150;大盘神针:=(SMA(MAX(CLOSE-REF(CLOSE,1),0),7,1)/SMA(ABS(CLOSE-REF(CLOSE,3)),7,1)*100< 20ANDSMA(MAX(CLOSE-REF(CLOSE,3),0),13,1)/SMA(ABS(CLOSE-REF(CLOSE,3)),13,1)*100<25 AND MA((LLV(LOW,45)-CLOSE)/(HHV(HIGH,45)-LLV(LOW,45))*100,5)>-19AND (LOW>LLV(LOW,5) AND (CLOSE-HHV(CLOSE,8))/HHV(CLOSE,8)<-0.05 ANDMA(AMOUNT,125)/MA(VOL,125)/(MA(AMOUNT,5)/MA(VOL,5))>1.12))*0.75;买入:=BARSLAST(大盘神针)<15 AND CROSS(MACD.DIF,MACD.DEA);底:=BARSLAST(LLV(L,4)=LLV(L,120))<5 ;均线买:=CROSS(MA(C,5),MA(C,20));买:=(底AND 均线买AND (进场资金>资金) OR 买入);STICKLINE(买,资金-1.35,资金-1.5,2,0),COLORYELLOW;DRAWTEXT(买,资金-1.28,'买'),COLORYELLOW;安全区:STICKLINE(底,资金-0.01,资金,0.04,1),COLORRED;{黄雀}短线趋势:=(EMA(C,7) - EMA(C,13));中线趋势:=EMA(短线趋势,13);VAR4:=MA(C,7);VAR5:=MA(C,13);VAR6:=MA(C,34);VAR7:=MA(C,55);VAR10:=((0 - ((10 * (HHV(C,5) - C)) / (HHV(C,5) - LLV(L,5)))) + 10);VAR11:=((0 - ((10 * (HHV(C,13) - C)) / (HHV(C,13) - LLV(L,13)))) + 10);VAR12:=((0 - ((10 * (HHV(C,21) - C)) / (HHV(C,21) - LLV(L,21)))) + 10);VAR13:=((0 - ((10 * (HHV(C,34) - C)) / (HHV(C,34) - LLV(L,34)))) + 10);VAR14:=REF(中线趋势,1);VAR15:=中线趋势;VAR16:=(VAR15 - VAR14);VAR17:=REF(短线趋势,1);VAR18:=短线趋势;VAR19:=(VAR18 - VAR17);VARE:=(SUM(((C * VOL) * 10),34) / SUM((VOL * 200),34));VARF:=(INTPART((VARE * 10)) / 10);吃货:(((((((O<= VAR4) AND (O<= VAR5)) AND (O<= VAR6)) AND (C>= VAR4)) AND (C>= VARF)) AND (VAR16 > 0)) AND (VAR19 > 0)),LINETHICK0;DRAWBAND (0>吃货,RGB(0,0,0),0<吃货,RGB(200,0,10)),NODRAW;STICKLINE (吃货,-1.75,-1.60,5,1),COLORCC0099;{抄}STICKLINE((DMI.PDI(14,6)<5 AND DMI.ADX(14,6)>70),1.5,-1.5,0,-1),COLORRED; DRAWTEXT (抄,-1.58,'抄'),COLORRED;{一阳二阴}VAR1:=3;VAR2:=((3 * SMA((((CLOSE - LLV(LOW,89)) / (HHV(HIGH,89) - LLV(LOW,89))) * 100),5,1))- (2 * SMA(SMA((((CLOSE - LLV(LOW,89)) / (HHV(HIGH,89) - LLV(LOW,89))) * 100),5,1),3,1)));大赚小赔:1.5*IF(CROSS(VAR2,VAR1),-0.89,-1),COLORRED,LINETHICK1;{黄金坑}RR8:=MA(CLOSE,27);RR9:=(CLOSE-RR8)/RR8*100;RRA:=MA(RR9,2);RRB:=BARSLAST(CROSS(-10,RRA)=1);RRD:=RRA<-10 AND RRB>3;黄金坑:0.01*IF(RRD,-300,1),COLORYELLOW,LINETHICK2;{神秘买点}SM01:=MA((2*C+H+L)/4,5);SM02:=SM01*(200-102)/100;SM03:=(1-7/100)*DMA(C,ABS((2*C+H+L)/4-MA(C,20))/MA(C,20));SM04:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;SM05:=3*SMA(SM04,3,1)-2*SMA(SMA(SM04,3,1),3,1);SM06:=((H+L+C)/3-MA((H+L+C)/3,14))/(0.015*AVEDEV((H+L+C)/3,14));SM07:=SM02<SM03&&SM05>REF(SM05,1)&&REF(SM05,1)<REF(SM05,2)&&SM06<-100 &&SM06>REF(SM06,1);神秘买点:IF(SM07*0.35,-1.3,-1.5),COLORCC0099,LINETHICK1;{止盈}转折周期:=7;转折灵敏:=50;TTR:=SMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),转折周期,1);HD:=HIGH-REF(HIGH,1);LD:=REF(LOW,1)-LOW;DMP:=SMA(IF(HD>0 AND HD>LD,HD,0),转折周期,1);DMM:=SMA(IF(LD>0 AND LD>HD,LD,0),转折周期,1);正DI:=DMP*100/TTR,COLORRED;负DI:=DMM*100/TTR,COLORGREEN;转折点:SMA(ABS(负DI-正DI)/(负DI+正DI)*100,转折周期,1),NODRAW;转折点A:=FILTER(转折点<REF(转折点,1)-1.3 AND EVERY(REF(转折点,1)>=REF(转折点,2)-1.3,5) AND REF(转折点,1)>转折灵敏,5);STICKLINE(转折点A AND REF(正DI>负DI,1),1.5,-1.5,0,-1),COLORGREEN; DRAWTEXT (转折点A AND REF(正DI>负DI,1),1.45,'止'),COLORGREEN;顶:1.5*IF(LAST(MA(C,5)>MA(C,10),5,0) AND "I"<REF("I",1) AND CROSS(100,"I"),0.9,1),COLORWHITE;N:=38;N1:=5;N2:=13;WAR1:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*80;X: SMA(WAR1,7,1),LINETHICK1,NODRAW;WAR2:=SMA(X,5,1);Y: IF(CROSS(X,WAR2) AND CROSS(MA(C,N1),MA(C,N2) AND X>50) ,WAR2*2,WAR2),COLORYELLOW,NODRAW;WAR4:= EMA(CLOSE,8);WAR5:= EMA(CLOSE,20);黑码上山:IF(CROSS(MA(CLOSE,1),MA(CLOSE,N)) AND X-Y>2 AND WAR4>WAR5 ,WAR2*2,WAR2),COLOR00FF00,NODRAW;入:=(CROSS(MA(CLOSE,1),MA(CLOSE,N)) AND X-Y>2 AND WAR4>WAR5 );排序:IF(入>0,2,0), STICK,COLORCC0099;DRAWICON(排序>0,2,1);STICKLINE(X>WAR2,X,Y,0,0), , COLORF00FF0,NODRAW;STICKLINE(X<WAR2,X,WAR2,0,0), ,COLOR00FF00,NODRAW ;。
MACD看透主力通达信指标公式源码
MACD看透主力通达信指标公式源码该算法主要通过计算不同时间段的移动平均线之间的差异来判断主力资金的买入和卖出行为。
MACD公式包括两个指标:DIF(差离值)和DEA (差离平均值)。
DIF的计算公式为:DIF = EMA(close, short) - EMA(close, long)其中,EMA代表指数移动平均线,short代表短期时间段,long代表长期时间段。
(1)计算短期移动平均线EMA(close, short):EMA(close, short) = (2 * close + (short - 1) * EMA(close, short)) / (short + 1)(2)计算长期移动平均线EMA(close, long):EMA(close, long) = (2 * close + (long - 1) * EMA(close, long)) / (long + 1)DEA的计算公式为:DEA = EMA(DIF, mid)其中,mid代表DEA的时间周期。
(3)计算差离平均值DEA:EMA(DIF, mid) = (2 * DIF + (mid - 1) * EMA(DIF, mid)) / (mid + 1)最后,通过计算DIF和DEA的差异,可以得到MACD的值:MACD=(DIF-DEA)*2这是一个基本的MACD指标计算公式,可以用于分析主力资金的买入和卖出信号。
通达信指标公式源码实现如下:```pythondef calculate_macd(close, short, long, mid):#计算DIFema_short = calculate_ema(close, short)ema_long = calculate_ema(close, long)dif = ema_short - ema_long#计算DEAdea = calculate_ema(dif, mid)#计算MACDmacd = (dif - dea) * 2return dif, dea, macddef calculate_ema(values, period):ema = []for i in range(len(values)):if i == 0:ema.append(values[i])else:ema.append((2 * values[i] + (period - 1) * ema[i - 1]) / (period + 1))return ema```上述代码中,`calculate_macd`函数计算DIF、DEA和MACD值,`calculate_ema`函数用于计算指数移动平均线。
分时MACD通达信指标公式源码
分时MACD通达信指标公式源码该文档为分时MACD通达信指标公式的源码,这是一种常用的技术指标,用于分析股票价格的趋势和转折点。
首先,我们需要了解MACD指标的基本原理。
MACD指标由两条线组成,一条为快速线(DIF),一条为慢速线(DEA),同时还有一条若干周期的移动平均线(MACD)。
它的计算公式如下:- DIF = EMA(CLOSE, 12) - EMA(CLOSE, 26)- DEA = EMA(DIF, 9)- MACD = (DIF - DEA) * 2其中,EMA为指数移动平均线的计算公式。
接下来,我们需要在通达信软件中实现这些计算公式。
首先,打开通达信软件,点击“自定义”按钮,选择“函数编辑器”。
然后,点击“新建”按钮,选择“指标公式编辑器”。
在编辑器中,输入以下代码:// DIFEMA(CLOSE, 12) - EMA(CLOSE, 26)// DEAEMA(DIF, 9)// MACD(DIF - DEA) * 2然后,点击保存按钮,输入指标的名称和说明,比如“分时MACD”。
接下来,点击“编译”按钮,检查代码是否有错误。
如果没有错误,点击“确定”按钮,保存指标公式。
保存完指标公式后,我们可以在通达信软件中使用该指标。
打开一个股票的分时图,点击“指标”按钮,选择“自定义指标”。
在弹出的窗口中,选择刚才保存的分时MACD指标,点击“确定”按钮。
之后,我们就可以在分时图上看到分时MACD指标的线条和柱状图了。
根据线条和柱状图的相对位置和走势,我们可以判断股票价格的趋势和转折点。
总结来说,分时MACD通达信指标是一种常用的技术指标,通过计算快速线、慢速线和移动平均线的差值来分析股票价格的走势。
我们可以通过通达信软件中的指标公式编辑器来实现该指标的计算,并在分时图中使用该指标进行分析。
请注意,在此文档中提供的是一种常用的分时MACD通达信指标的源码示例,具体的使用方法和逻辑可能会因实际需求而有所不同。
通达信指标公式源码MACD底背离
通达信指标公式源码MACD底背离MACD(Moving Average Convergence Divergence)是一种常用的技术指标,用于衡量市场的动量和趋势。
其中,底背离是MACD指标中的一种特殊形态,它在市场底部形成,提示市场可能出现反转。
首先,我们需要了解MACD指标的计算公式。
MACD由两个指数移动平均线(EMA)的差值构成,其中包括了一个快速线(快线),一个慢速线(慢线)和一个信号线。
它们的计算公式如下:快线=12日EMA-26日EMA慢线=9日快线EMA信号线=9日慢线的EMA接下来,我们将讨论如何使用MACD指标检测底背离。
底背离是指价格形成新的低位,但MACD的低点却比前一低点高,这表明市场下跌动力减弱,可能即将反转向上。
以下是通达信公式源码实现MACD底背离的示例:```python#引入所需的库import pandas as pdimport talib#读取历史数据data = pd.read_csv('historical_data.csv') # 假设数据以csv格式保存,包含时间、开盘价、最高价、最低价、收盘价等列#计算MACD指标macd, signal, hist = talib.MACD(data['close'], fastperiod=12, slowperiod=26, signalperiod=9)#寻找底背离divergence = [] # 存储背离信号for i in range(1, len(data)):if (data['close'][i] < data['close'][i-1] and hist[i] >hist[i-1]) or (data['close'][i] > data['close'][i-1] and hist[i] < hist[i-1]):divergence.append(i)#输出背离信号print("底背离信号出现在以下日期:")for idx in divergence:print(data['date'][idx])```在上述代码中,我们首先使用pandas库读取历史数据。
通达信指标公式源码 超前MACD优化版 副图源码
DIFF:EMA(CLOSE,7) - EMA(CLOSE,19);DEA:EMA(DIFF,9);MACD:6*(DIFF-DEA),COLORSTICK;A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("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)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("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)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT;KDJ底背:IF(B2>0,-0.1,0),COLORCC0055,POINTDOT;RSI底背:IF(B3>0,-0.1,0),COLORYELLOW,POINTDOT;MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;KDJ顶背:IF(D2>0,0.1,0),COLORFFCC66,POINTDOT;RSI顶背:IF(D3>0,0.1,0),COLORWHITE,POINTDOT;STICKLINE(B1>0,-0.2,0,2.5,1),COLORMAGENTA;STICKLINE(B2>0,-0.16,0,3.5,1),COLORCC0066;STICKLINE(B3>0,-0.18,0,5,1),COLORYELLOW;STICKLINE(D1>0,0.2,0,2.5,0),COLOR00FF00;STICKLINE(D2>0,0.18,0,3.5,0),COLORFFCC66;STICKLINE(D3>0,0.16,0,6,0),COLORWHITE;STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1,1),COLORRED; STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,0,1),COLORCYAN; STICKLINE(MACD<REF(MACD,1) AND MACD<0,0,MACD,1,1),COLORGREEN; STICKLINE(MACD>=REF(MACD,1) AND MACD<0,0,MACD,1,1),COLORMAGENTA; STICKLINE(C>0,0,0,50,1),COLORBLUE;DIFF,COLORGREEN;DEA,COLORYELLOW;强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED;弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA;{大盘神针}UAR1:=INDEXA/100000000;UAR2:=INDEXADV;UAR3:=INDEXDEC;UAR4:=UAR2/(UAR2+UAR3);UAR5:=UAR3/(UAR2+UAR3);UAR6:=EMA(UAR4,3);UAR7:=EMA(UAR5,3);UAR8:=EMA(UAR6,5);UAR9:=EMA(UAR7,5);进场资金: EMA(UAR8,10)/150 ;资金: EMA(UAR9,10)/150;大盘神针:=(SMA(MAX(CLOSE-REF(CLOSE,1),0),7,1)/SMA(ABS(CLOSE-REF(CLOSE,3)),7,1)*100< 20ANDSMA(MAX(CLOSE-REF(CLOSE,3),0),13,1)/SMA(ABS(CLOSE-REF(CLOSE,3)),13,1)*100<25 AND MA((LLV(LOW,45)-CLOSE)/(HHV(HIGH,45)-LLV(LOW,45))*100,5)>-19AND (LOW>LLV(LOW,5) AND (CLOSE-HHV(CLOSE,8))/HHV(CLOSE,8)<-0.05 ANDMA(AMOUNT,125)/MA(VOL,125)/(MA(AMOUNT,5)/MA(VOL,5))>1.12))*0.75;买入:=BARSLAST(大盘神针)<15 AND CROSS(MACD.DIF,MACD.DEA);底:=BARSLAST(LLV(L,4)=LLV(L,120))<5 ;均线买:=CROSS(MA(C,5),MA(C,20));买:=(底AND 均线买AND (进场资金>资金) OR 买入);STICKLINE(买,资金-1.35,资金-1.5,2,0),COLORYELLOW;DRAWTEXT(买,资金-1.28,'买'),COLORYELLOW;安全区:STICKLINE(底,资金-0.01,资金,0.04,1),COLORRED;{黄雀}短线趋势:=(EMA(C,7) - EMA(C,13));中线趋势:=EMA(短线趋势,13);VAR4:=MA(C,7);VAR5:=MA(C,13);VAR6:=MA(C,34);VAR7:=MA(C,55);VAR10:=((0 - ((10 * (HHV(C,5) - C)) / (HHV(C,5) - LLV(L,5)))) + 10);VAR11:=((0 - ((10 * (HHV(C,13) - C)) / (HHV(C,13) - LLV(L,13)))) + 10);VAR12:=((0 - ((10 * (HHV(C,21) - C)) / (HHV(C,21) - LLV(L,21)))) + 10);VAR13:=((0 - ((10 * (HHV(C,34) - C)) / (HHV(C,34) - LLV(L,34)))) + 10);VAR14:=REF(中线趋势,1);VAR15:=中线趋势;VAR16:=(VAR15 - VAR14);VAR17:=REF(短线趋势,1);VAR18:=短线趋势;VAR19:=(VAR18 - VAR17);VARE:=(SUM(((C * VOL) * 10),34) / SUM((VOL * 200),34));VARF:=(INTPART((VARE * 10)) / 10);吃货:(((((((O<= VAR4) AND (O<= VAR5)) AND (O<= VAR6)) AND (C>= VAR4)) AND (C>= VARF)) AND (VAR16 > 0)) AND (VAR19 > 0)),LINETHICK0;DRAWBAND (0>吃货,RGB(0,0,0),0<吃货,RGB(200,0,10)),NODRAW;STICKLINE (吃货,-1.75,-1.60,5,1),COLORCC0099;{抄}STICKLINE((DMI.PDI(14,6)<5 AND DMI.ADX(14,6)>70),1.5,-1.5,0,-1),COLORRED; DRAWTEXT (抄,-1.58,'抄'),COLORRED;{一阳二阴}VAR1:=3;VAR2:=((3 * SMA((((CLOSE - LLV(LOW,89)) / (HHV(HIGH,89) - LLV(LOW,89))) * 100),5,1))- (2 * SMA(SMA((((CLOSE - LLV(LOW,89)) / (HHV(HIGH,89) - LLV(LOW,89))) * 100),5,1),3,1)));大赚小赔:1.5*IF(CROSS(VAR2,VAR1),-0.89,-1),COLORRED,LINETHICK1;{黄金坑}RR8:=MA(CLOSE,27);RR9:=(CLOSE-RR8)/RR8*100;RRA:=MA(RR9,2);RRB:=BARSLAST(CROSS(-10,RRA)=1);RRD:=RRA<-10 AND RRB>3;黄金坑:0.01*IF(RRD,-300,1),COLORYELLOW,LINETHICK2;{神秘买点}SM01:=MA((2*C+H+L)/4,5);SM02:=SM01*(200-102)/100;SM03:=(1-7/100)*DMA(C,ABS((2*C+H+L)/4-MA(C,20))/MA(C,20));SM04:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;SM05:=3*SMA(SM04,3,1)-2*SMA(SMA(SM04,3,1),3,1);SM06:=((H+L+C)/3-MA((H+L+C)/3,14))/(0.015*AVEDEV((H+L+C)/3,14));SM07:=SM02<SM03&&SM05>REF(SM05,1)&&REF(SM05,1)<REF(SM05,2)&&SM06<-100 &&SM06>REF(SM06,1);神秘买点:IF(SM07*0.35,-1.3,-1.5),COLORCC0099,LINETHICK1;{止盈}转折周期:=7;转折灵敏:=50;TTR:=SMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),转折周期,1);HD:=HIGH-REF(HIGH,1);LD:=REF(LOW,1)-LOW;DMP:=SMA(IF(HD>0 AND HD>LD,HD,0),转折周期,1);DMM:=SMA(IF(LD>0 AND LD>HD,LD,0),转折周期,1);正DI:=DMP*100/TTR,COLORRED;负DI:=DMM*100/TTR,COLORGREEN;转折点:SMA(ABS(负DI-正DI)/(负DI+正DI)*100,转折周期,1),NODRAW;转折点A:=FILTER(转折点<REF(转折点,1)-1.3 AND EVERY(REF(转折点,1)>=REF(转折点,2)-1.3,5) AND REF(转折点,1)>转折灵敏,5);STICKLINE(转折点A AND REF(正DI>负DI,1),1.5,-1.5,0,-1),COLORGREEN; DRAWTEXT (转折点A AND REF(正DI>负DI,1),1.45,'止'),COLORGREEN;顶:1.5*IF(LAST(MA(C,5)>MA(C,10),5,0) AND "I"<REF("I",1) AND CROSS(100,"I"),0.9,1),COLORWHITE;N:=38;N1:=5;N2:=13;WAR1:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*80;X: SMA(WAR1,7,1),LINETHICK1,NODRAW;WAR2:=SMA(X,5,1);Y: IF(CROSS(X,WAR2) AND CROSS(MA(C,N1),MA(C,N2) AND X>50) ,WAR2*2,WAR2),COLORYELLOW,NODRAW;WAR4:= EMA(CLOSE,8);WAR5:= EMA(CLOSE,20);黑码上山:IF(CROSS(MA(CLOSE,1),MA(CLOSE,N)) AND X-Y>2 AND WAR4>WAR5 ,WAR2*2,WAR2),COLOR00FF00,NODRAW;入:=(CROSS(MA(CLOSE,1),MA(CLOSE,N)) AND X-Y>2 AND WAR4>WAR5 );排序:IF(入>0,2,0), STICK,COLORCC0099;DRAWICON(排序>0,2,1);STICKLINE(X>WAR2,X,Y,0,0), , COLORF00FF0,NODRAW;STICKLINE(X<WAR2,X,WAR2,0,0), ,COLOR00FF00,NODRAW ;。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
多空线:0,COLORYELLOW,LINETHICK9;
A1:=EMA(EMA(CLOSE,7),2)-EMA(EMA(CLOSE,21),2);
B1:=EMA((0.668*REF(A1,1)+0.333*A1),1);
短多:IF(A1>=B1,A1,B1),LINETHICK3,COLORLIMAGENTA;
短空:B1,LINETHICK3,COLORGREEN;
STICKLINE(B1<0 AND B1<REF(B1,1),B1*0.7,0,0.05,0),COLORLIBLUE; STICKLINE(B1<0 AND B1>REF(B1,1),B1*0.7,0,0.05,0),COLORYELLOW; STICKLINE(B1>REF(B1,1) AND B1>0,B1*0.7,0,0.05,0),COLORRED; STICKLINE(B1<REF(B1,1) AND B1>0,B1*0.7,0,0.05,0),COLORGREEN; LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),2,1)/SMA(ABS(CLOSE-LC),2,1)*100; RSI2:=SMA(MAX(CLOSE-LC,0),3,1)/SMA(ABS(CLOSE-LC),3,1)*100; RSI3:=SMA(MAX(CLOSE-LC,0),4,1)/SMA(ABS(CLOSE-LC),4,1)*100; RSI4:=SMA(MAX(CLOSE-LC,0),5,1)/SMA(ABS(CLOSE-LC),5,1)*100; RSI5:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100; RSI6:=SMA(MAX(CLOSE-LC,0),7,1)/SMA(ABS(CLOSE-LC),7,1)*100; RSI7:=SMA(MAX(CLOSE-LC,0),8,1)/SMA(ABS(CLOSE-LC),8,1)*100; RSI8:=SMA(MAX(CLOSE-LC,0),9,1)/SMA(ABS(CLOSE-LC),9,1)*100; RSI9:=SMA(MAX(CLOSE-LC,0),10,1)/SMA(ABS(CLOSE-LC),10,1)*100; RSI10:=SMA(MAX(CLOSE-LC,0),11,1)/SMA(ABS(CLOSE-LC),11,1)*100; RSI11:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100; RSI12:=SMA(MAX(CLOSE-LC,0),13,1)/SMA(ABS(CLOSE-LC),13,1)*100; RSI13:=SMA(MAX(CLOSE-LC,0),14,1)/SMA(ABS(CLOSE-LC),14,1)*100; RSI14:=SMA(MAX(CLOSE-LC,0),15,1)/SMA(ABS(CLOSE-LC),15,1)*100;
RSI15:=SMA(MAX(CLOSE-LC,0),16,1)/SMA(ABS(CLOSE-LC),16,1)*100;
RSI16:=SMA(MAX(CLOSE-LC,0),17,1)/SMA(ABS(CLOSE-LC),17,1)*100;
RSI17:=SMA(MAX(CLOSE-LC,0),18,1)/SMA(ABS(CLOSE-LC),18,1)*100;
RSI18:=SMA(MAX(CLOSE-LC,0),19,1)/SMA(ABS(CLOSE-LC),19,1)*100;
RSI19:=SMA(MAX(CLOSE-LC,0),20,1)/SMA(ABS(CLOSE-LC),20,1)*100;
RSI21:=SMA(MAX(CLOSE-LC,0),21,1)/SMA(ABS(CLOSE-LC),21,1)*100;
短线RSI:=(RSI1+RSI2+RSI3+RSI4+RSI5)/5,COLORWHITE;
中线RSI:=(RSI6+ RSI7+ RSI8+ RSI9+ RSI10+ RSI11+ RSI12+ RSI13+ RSI14+ RSI15+ RSI16+ RSI17+ RSI18+ RSI19+ RSI21)/15,COLORYELLOW;
A:=CROSS(短线RSI,中线RSI);
B:=CROSS(中线RSI,短线RSI);。