通达信指标公式源码概况:指标类别: 通达信指标公式授权方式: 免费版指标评级: ★★★★★指标分类: 策略画线方法: 副图一、副图k线指标公式 VAR1:=1; 趋势线:((3*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1)-2*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1),3,1)-50)*1.032+50),COLORRED; VAR2:=(2*CLOSE+HIGH+LOW+OPEN)/5; VAR3:=LLV(LOW,34); VAR4:=HHV(HIGH,34); SK:EMA((VAR2-VAR3)/(VAR4-VAR3)*100,13)*VAR1,COLORWHITE; SD:EMA(SK,2)*VAR1,COLORYELLOW; VAR5:=EMA(CLOSE,12)-EMA(CLOSE,26); VAR6:=EMA(VAR5,9); VAR7:=VAR1*CLOSE*1.236 MA(CLOSE,60); VAR8:=CLOSE/REF(CLOSE,1) 1.021; VAR9:=(HIGH-CLOSE)*1.36 =CLOSE-OPEN; VARA:=(MA(CLOSE,120)-CLOSE)/CLOSE*100; VARB:=ABS(VAR5-VAR6); VARC:=STD(CLOSE,90)*10; VARD:=COUNT((REF(CLOSE,15)-CLOSE)/CLOSE*100 45,5); 买:VAR1*VAR7ANDVAR8ANDVAR9ANDVARC 25ANDCLOSE 8ANDVARA 114ANDVARB =0.23*40,COLORRED; VARE:=SLOPE(CLOSE,40); VARF:=COUNT((CLOSE-REF(CLOSE,1))/REF(CLOSE,1) -0.098,90); VAR10:=(MA(CLOSE,120)-CLOSE)/CLOSE*100; VAR11:=VAR1*STD(CLOSE,63)*10; VAR12:=VAR1*(MA(CLOSE,76)-MA(CLOSE,13)/3); VAR13:=VAR1*MA((CLOSE-VAR12)/VAR12,1); 买1:=VAR1*IF(CROSS(VAR13,-0.008)ANDVARE -0.618ANDVAR10 114ANDVAR11 23.6ANDVARF 8ANDLOW/REF(HIGH,1) 1.145ORREF(VAR13,2)=LLV(VAR13,20)ANDREF(VAR13,2) 0.042ANDVARF 8ANDREF(VAR13,2) REF(VAR13,1)ANDNOT(REF(LOW,1) REF(HIGH,2)ANDLOW REF(HIGH,1))ANDVAR13 -0.368ANDCLOSE REF(CLOSE,1),68,0); VAR14:=MA(CLOSE,5); VAR15:=MA(CLOSE,10); VAR16:=MA(CLOSE,20); VAR17:=MA(CLOSE,30); VAR18:=MA(CLOSE,60); VAR19:=MA(CLOSE,150); VAR1A:=MA(CLOSE,250); VAR1B:=VAR1*VOL/CAPITAL*100; VAR1C:=(CLOSE-VAR1A)/VAR1A*100; VAR1D:=(CLOSE/REF(CLOSE,1)-1)*100; VAR1E:=PWINNER(1,CLOSE); VAR1F:=IF(VAR1 0.75ANDVAR1 0.901,0.618,1); 牛:IF(VAR14 VAR15ANDVAR15 VAR16ANDVAR16 VAR17ANDVAR16 VAR18ANDVAR19 VAR1AAND(VAR1E =0.9ORVAR1E 0.76ANDVAR1E 0.901ANDVAR1D 5ANDVAR1B 5)ANDVAR1D 1.8ANDVAR1C 40ANDCLOSE 3AND(CLOSE-VAR18)/VAR18 0.25ANDVAR1B =6ANDVAR4*VAR1B =1ANDCLOSE 18.5,76,0),COLORMAGENTA; VAR20:=(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4; VAR21:=(MA(CLOSE,48)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4; VAR22:=VAR1*(MA(CLOSE,12)+MA(CLOSE,24)+MA(CLOSE,48)+MA(CLOSE,96))/4; VAR23:=VAR1*MA(CLOSE,250); VAR24:=MA(CLOSE,125); 牛1:=IF(SD 18ANDSK 75ANDCROSS(VAR20,VAR21)AND(VAR22-VAR23)/VAR23 0.161ANDREF(SK,3) SKANDREF(VAR22,1) VAR22,95,0); VAR25:=CLOSE/MA(CLOSE,3) =1.05ANDCLOSE=HHV(CLOSE,3)ANDMA(VOL,2)/MA(VOL,40) =3ANDMA(VOL,2)=HHV(MA(VOL,2),3)ANDVOL REF(VOL,1)ANDCLOSE REF(CLOSE,1); VAR26:=REF(CLOSE,1); VAR27:=SMA(MAX(CLOSE-VAR26,0),5,1)/SMA(ABS(CLOSE-VAR26),5,1)*100; VAR28:=VAR1*COUNT(VAR27 25,20) VAR29:=(HIGH-LOW)/HIGH*100+(CLOSE-VAR26)/VAR26*100; VAR2A:=EMA(MA(VAR29,41),6); VAR2B:=VAR2A LLV(VAR2A,6)*1.02ANDREF(VAR2A,1) REF(LLV(VAR2A,6),1)*1.02ANDLLV(VAR2A,29)=LLV(VAR2A,6); VAR2C:=VAR1*LLV(LOW,6)=LLV(LOW,41)ANDLLV(LOW,6) HHV(LOW,41)*71/100; VAR2D:=HIGH LOW*1.033; 涨势确立:VAR1*(VAR2C 0ANDVAR2D*16+81.5)*VAR1,COLOR80FFFF; 买入:IF(CROSS(趋势线,21),50,18.5); 卖出:IF(CROSS(87,趋势线),50,81.5),COLORFFAA00; DRAWTEXT(VAR2C 0ANDVAR2D,88, ↑ VAR2E:=IF(CROSS(SK,SD),25,18.5); VAR2F:=IF(CROSS(SD,SK),75,81.5); 卖线:VAR2F,COLORWHITE; 买线:VAR2E,COLORRED; VAR13 0.06*(-10)+81.5,COLORWHITE; DIF:=EMA(CLOSE,12)-EMA(CLOSE,26); DEA:=EMA(DIF,9); MACD:=2*(DIF-DEA); LS:=((DIF =0ANDDEA =0)ORDIF =0)ANDDIF =DEA; STICKLINE(LS,O,C,3,0),COLORRED; LX:=DIF =0ANDDEA =0ANDDIF =DEA; STICKLINE(LX,O,C,3,0),COLORWHITE; QT:=DIF =DEA; STICKLINE(QT,O,C,3,0),COLORGREEN;二、关键k线副图指标公式 去除ST:=IF(NAMELIKE( ST ),0,1)ANDIF(NAMELIKE( *ST ),0,1)AND IF(NAMELIKE( S ),0,1); ZF:=C/REF(C,1); STICKLINE(IF(去除ST=0,ZF 1.03ANDCROSS(C MA(C,20),0.5),ZF 1.05ANDCROSS(C MA(C,20),0.5)),C,O,1,0),COLORYELLOW; STICKLINE(IF(去除ST=0,ZF 0.97ANDCROSS(C MA(C,20),0.5),ZF 0.95ANDCROSS(C MA(C,20),0.5)),C,O,1,0),COLORRED; M20:MA(C,20); DRAWTEXT_FIX(ISLASTBAR,0,0,0,HYBLOCK);{在屏幕左上角显示所属行业板块} DRAWTEXT_FIX(ISLASTBAR,0.05,0,0,DYBLOCK);{在屏幕左上角显示所属地域板块} DRAWTEXT_FIX(ISLASTBAR,0.1,0,0,GNBLOCK);{在屏幕左上角显示所属概念板块} {跳空} STICKLINE(REF(L,1) H,H,REF(L,1),5,0),COLORGRAY; STICKLINE(REF(H,1) L,L,REF(H,1),5,0),COLORGRAY; C_:CONST(C),COLORLIRED,POINTDOT;{现价线} MA5:=MA(C,5); MA5角度:ATAN((MA5/REF(MA5,1)-1)*100)*180/3.1416,NODRAW; DRAWKLINE(H,O,L,C);{重绘K线} RC1:=REF(C,1);{178448-WEN98编写} CS:=IF(C =1,10000,100000); C涨停10:=1.10*RC1-49/CS;{考虑到4舍5入} C涨停5:=1.05*RC1-49/CS; C跌停10:=0.90*RC1+51/CS; C跌停5:=0.95*RC1+51/CS; ST:=NAMELIKE( S )ORNAMELIKE( *S 涨停:=IF(ST,C =C涨停5,C =C涨停10); 跌停:=IF(ST,C =C跌停5,C =C跌停10); 盘中涨停:=IF(ST,H =C涨停5,H =C涨停10); 盘中跌停:=IF(ST,L =C跌停5,L =C跌停10); STICKLINE(盘中涨停,H,MAX(C,O),0,0),COLORMAGENTA;{涨停后回落} STICKLINE(盘中跌停,L,MIN(C,O),0,0),COLORLICYAN;{跌停后回升} 大阳线:=C OAND(C =C涨停5ORC (1.05*O-51/CS)) OR(C 1000ANDC RC1*1.024); STICKLINE(大阳线,O,C,1,0),COLOR0000BB; 大阴线:=C OAND(C =C跌停5ORC (0.95*O+49/CS)) OR(C 1000ANDC RC1*0.976); STICKLINE(大阴线,O,C,1,0),COLORLIGREEN; STICKLINE(涨停,O,C,1,0),COLORMAGENTA; STICKLINE(跌停,O,C,1,0),COLORLICYAN; 假阴:=C OANDC REF(C,1); STICKLINE(假阴,O,C,0,0),COLORRED;{假阴柱}; 假阳:=C OANDC REF(C,1); STICKLINE(假阳,O,C,0,0),COLORGREEN;{假阳柱}; 大盘TJ:=PERIOD=5ANDNAMELIKE( 上证指数 ) AND(ABS((C-REF(C,1)))/REF(C,1) =0.025ORABS(C-O) =60); STICKLINE(大盘TJ,(H+L)/2,(H+L)/2,2,0),COLORYELLOW;{显示大盘日线的60点大K线中值}; STICKLINE((大阳线OR大阴线OR涨停OR跌停) ANDBETWEEN(C,1,500),L+(H-L)/2,L+(H-L)/2,1,0),COLORYELLOW;{大K线画中点线}; {后面的内容为后加的,从别处摘来的} DYNAINFO(7),COLORBBBBBB,LINETHICK1;{现价} DYNAINFO(6),COLOR22FF22,DOTLINE;{最低} DYNAINFO(5),COLORC4F18F,DOTLINE;{最高} 半分位: (O+C)/2,NODRAW; 上三分之一位:(MAX(O,C)-MIN(O,C))*2/3+MIN(O,C),NODRAW; 下三分之一位:(MAX(O,C)-MIN(O,C))/3+MIN(O,C),NODRAW; 月K: KDJ.K (89,3,3),COLOR00FF00; 月D: KDJ.D (89,3,3),COLOR00FF00,LINETHICK2; 周K: KDJ.K (27,3,3),COLORRED; 周D: KDJ.D (27,3,3),COLORRED,LINETHICK2; 日K: KD.K (5,3,3),COLORWHITE; 日D: KD.D (5,3,3),COLORWHITE,LINETHICK2; 日金叉:IF(CROSS(日K,日D),50,0),COLORFFFFFF; DRAWTEXT(日金叉,50, 日叉 ),COLORFFFFFF; 周金叉:IF(CROSS(周K,周D),30,0),COLORRED; DRAWTEXT(周金叉,30, 周叉 ),COLORRED; 月金叉:IF(CROSS(月K,月D),20,0),COLOR0080FF; DRAWTEXT(月金叉,20, 月叉 ),COLORYELLOW; {KD在30以下多次金叉} JM:=CROSS( KDJ.K (5,3,3), KDJ.D (5,3,3)); JMCOUNT:=COUNT(JM,BARSLAST( KDJ.D (5,3,3) =30)); JMTJ:=28*( KDJ.D (5,3,3) 30ANDCOUNT(JMCOUNT=1,21)=1); DRAWTEXT(JMTJ,70, ① ),COLORWHITE; JMTJ2:=28*( KDJ.D (5,3,3) 30ANDCOUNT(JMCOUNT=2,21)=1); DRAWTEXT(JMTJ2,70, ② ),COLORYELLOW; JMTJ3:=28*( KDJ.D (5,3,3) 30ANDCOUNT(JMCOUNT=3,21)=1); DRAWTEXT(JMTJ3,70, ③ ),COLORYELLOW; JMTJ4:=28*( KDJ.D (5,3,3) 30ANDCOUNT(JMCOUNT=4,21)=1); DRAWTEXT(JMTJ4,70, ④ ),COLORYELLOW; JMTJ5:=28*( KDJ.D (5,3,3) 30ANDCOUNT(JMCOUNT=5,21)=1); DRAWTEXT(JMTJ5,70, ⑤ ),COLORYELLOW; 0,COLORYELLOW; DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26); DEA:=EMA(DIFF,9); MACD:=2*(DIFF-DEA); A1:=BARSLAST(REF(CROSS(DIFF,DEA),1)); B1:=REF(C,A1+1) CANDREF(DIFF,A1+1) DIFFANDCROSS(DIFF,DEA); MACD底背离:STICKLINE(FILTER(B1 0,5),0,0.75,3,0),COLORGREEN; DRAWTEXT(FILTER(B1 0,5),0.57, MACD底背离 ),COLORGREEN; RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100; K:=SMA(RSV,3,1); D:=SMA(K,3,1); A2:=BARSLAST(REF(CROSS(K,D),1)); B2:=REF(C,A2+1) CANDREF(K,A2+1) KANDCROSS(K,D); KDJ底背离:STICKLINE(FILTER(B2 0,5),0,1,3,0),COLORYELLOW; DRAWTEXT(FILTER(B2 0,5),0.80, KDJ底背离 ),COLORYELLOW; LC:=REF(CLOSE,1); RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100; RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100; A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1)); B3:=REF(C,A3+1) CANDREF(RSI1,A3+1) RSI1ANDCROSS(RSI1,RSI2); RSI底背离:STICKLINE(FILTER(B3 0,5),0,0.5,3,0),COLORWHITE; DRAWTEXT(FILTER(B3 0,5),0.25, RSI底背离 ),COLORWHITE; 2,COLORRED; C1:=BARSLAST(REF(CROSS(DEA,DIFF),1)); D1:=REF(C,C1+1) CANDREF(DIFF,C1+1) DIFFANDCROSS(DEA,DIFF); MACD顶背离:STICKLINE(FILTER(D1 0,5),2,1.25,3,0),COLOR0066FF; DRAWTEXT(FILTER(D1 0,5),1.47, MACD顶背离 ),COLOR0066FF; C2:=BARSLAST(REF(CROSS(D,K),1));D2:=REF(C,C2+1) CANDREF(K,C2+1) KANDCROSS(D,K); KDJ顶背离:STICKLINE(FILTER(D2 0,5),2,1,3,0),COLORRED; DRAWTEXT(FILTER(D2 0,5),1.2, KDJ顶背离 ),COLORRED; C3:=BARSLAST(REF(CROSS(RSI2,RSI1),1)); D3:=REF(C,C3+1) CANDREF(RSI1,C3+1) RSI1ANDCROSS(RSI2,RSI1); RSI顶背离:STICKLINE(FILTER(D3 0,5),2,1.5,3,0),COLORFF00FF; DRAWTEXT(FILTER(D3 0,5),1.75, RSI顶背离 ),COLORFF00FF; 0,COLORFFA2AF; 20,COLORFFA2AF,POINTDOT; 50,COLORFFA2AF; 80,COLORFFA2AF,POINTDOT; 100,COLORFFA2AF;[源码注释]通达信公式动态公式解读输出 买入:统计4日中满足1日前的收盘价 2日前的收盘价*1.03的天数 =3 AND 收盘价 1日前的收盘价*0.97 AND 1日前的收盘价 2日前的收盘价*0.97推荐阅读:k线图副图指标 来势线:EMA(CLOSE,7)-EMA(CLOSE,21),COLORYELLOW; 福星:EMA(来势线,7),COLORSTICK,COLORRED; VAR1:=CLOSE/REF(LLV(LOW,35),5) 决策:IF(VAR1,0.5,0),STICK,COLORBLUE; 必买:IF(TROUGHBARS(3,15,1)=0ANDHIGH LOW+0.01,1,-1),COLORYELLOW,LINETHICK1; 必卖:IF(PEAKBARS(3,15,1)=1,1,2),COLORWHITE,LINETHICK1; 趋势线:(EMA(WINNER(CLOSE),7)-EMA(WINNER(CLOSE),35))*5,COLORRED; 逃顶线:EMA(CLOSE/REF(HHV(CLOSE,7),50),1),COLOR007000,LINETHICK1; AA:0,COLORBROWN; DRAWICON(CROSS(趋势线,AA),AA,1); DRAWICON(CROSS(逃顶线,趋势线),逃顶线,2); A0:=(2*C+H+L)/4; 均线:=MA(A0,3) REF(MA(A0,3),1); A1:=(CLOSE-LLV(LOW,7))/(HHV(HIGH,7)-LLV(LOW,7))*100; A2:=EMA(WINNER(C)*100,5); A3:=MA(SMA(C-REF(C,1),3,1)/SMA(H-REF(C,1),3,1),3)*100; K:MA(3*SMA(A1,6,1)-2*SMA(SMA(A1,5,1),5,1),3),LINETHICK1,COLORWHITE; D:MA(K,3),COLORYELLOW,LINETHICK1; J:3*K-2*D,COLORYELLOW,LINETHICK1; A4:=SMA(MAX(C-REF(C,2),0),6,1)/SMA(ABS(C-REF(C,2)),6,1)*100; A5:=MA(3*SMA((C-LLV(L,21))/(HHV(H,21)-LLV(L,21))*100,5,1)-2*SMA(SMA((C-LLV(L,21))/(HHV(H,21)-LLV(L,21))*100,5,1),3,1),3); 低吸:IF(CROSS(A4,14)ORA5 REF(A5,1)ANDCROSS(K,A2)ANDK 40,10,0),COLORYELLOW; IF(A2 80ANDCROSS(95,K),85,100); 入虎穴:K 5ANDLLV(C,3)/HHV(C,20) 0.8,COLORYELLOW; STICKLINE(入虎穴,0,30,3,0),COLORYELLOW; A6:=COUNT(CROSS(K,A2),2)=1ANDCROSS(K,A5)ANDA5/REF(A5,1) 0.9ANDK A7:=CROSS(K,D)ANDD 10ORCROSS(K,D)ANDCROSS(K,A5)ANDD DRAWTEXT(FILTER((A6ORA7)ANDK REF(K,1),5)AND均线,D, 金叉 DRAWTEXT(CROSS(D,K)ANDCROSS(A5,K)ANDD 85,D, 死叉 DRAWTEXT(FILTER(K REF(K,1)AND(CROSS(K,10)ORCROSS(K,A2))ANDCOUNT(A4 14,3) =1,3),15, 抱虎仔 无限风光:A2 85ANDK 85ORA2 90ORK 90,LINETHICK0,COLORLIGRAY; STICKLINE(无限风光,MAX(A2,K),100,5,1),COLORLIGRAY; DRAWICON(CROSS(A3,-300)ANDK 10,5,1); A8:=BARSLAST(REF(CROSS(K,D),1)); 二金:=(A8 15ANDD 50ANDK REF(K,A8+1)ANDCROSS(K,D)ANDA5 DRAWTEXT(二金AND均线,K, 二金 ),COLORYELLOW; A9:=LLV(C,2) REF(LLV(C,15),2); DRAWTEXT(二金ANDA9,K, 底背离 ),COLORRED; DRAWTEXT(LONGCROSS(J,K,7)ANDCROSS(J,A2)ANDA2 30ANDA2 REF(A2,1),K, 穿三线 ),COLORMAGENTA; DRAWTEXT(CROSS(84,A4)ANDCROSS(K,A4),90, 虎口 ),COLOR00FF00; A10:=MA((A0-MA(A0,13))/(0.15*AVEDEV(A0,13)),3); DRAWICON(CROSS(A10,-15)ANDJ REF(J,1),5,1); DRAWICON(CROSS(20,A10),100,2); IF(K REF(K,1),K,DRAWNULL),COLORGREEN,LINETHICK1; IF(D REF(D,1),D,DRAWNULL),COLORGREEN,LINETHICK1; IF(J REF(J,1),J,DRAWNULL),COLORFFFF00,LINETHICK1; IF(K REF(K,1),K,DRAWNULL),COLORRED,LINETHICK1; IF(D REF(D,1),D,DRAWNULL),COLORRED,LINETHICK1; IF(J REF(J,1),J,DRAWNULL),COLORFF00FF,LINETHICK1;