通达信指标公式源码概况:

指标类别: 通达信指标公式

授权方式: 免费版

指标评级: ★★★★★

指标分类: 策略

画线方法: 副图

一、通达信偏离值指标公式

  

C/ZSTJJ<=0.98  

中极偏:IF(C>EMA(C,55),(H-EMA(C,55))/EMA(C,55)*100,(L-EMA(C,55))/EMA(C,55)*100),COLORYELLOW;  

中收偏:IF(C>EMA(C,55),(C-EMA(C,55))/EMA(C,55)*100,(C-EMA(C,55))/EMA(C,55)*100),COLORRED;  

短极偏:IF(C>EMA(C,13),(H-EMA(C,13))/EMA(C,13)*100,(L-EMA(C,13))/EMA(C,13)*100)COLORWHITE;  

短收偏:IF(C>EMA(C,13),(C-EMA(C,13))/EMA(C,13)*100,(C-EMA(C,13))/EMA(C,13)*100),COLORGREEN;  

INPUT:定位年(2008,1990,3400),百分比(15,5,50);  

v1:=ZIG(4,百分比);{调整需要的百分比转向}  

sj:=BARSSINCE(YEAR>=定位年);{时间定位年}  

bb:=v1<ref(v1,1)andv1<refx(v1,1);  

s:=sum(bb,sj);  

ss:=s[datacount]-s+1;  

a:=barssince(ss=1);  

aa:=if(a>=a[LBOUND(a)+1],a,1);  

sjj:=STKTYPE=1orSTKTYPE=2orSTKTYPE=3orSTKTYPE=5orSTKTYPE=11;  

低1:IF(NOT(sjj),ma(c,aa),sum(AMOUNT,aa)/sum(v,aa)/100),PRECISION2,Color00FF00;  

d2:=barssince(ss=1+1);  

dd2:=if(d2>=d2[LBOUND(d2)+1],d2,1);  

低2:IF(NOT(sjj),ma(c,dd2),sum(AMOUNT,dd2)/sum(v,dd2)/100),PRECISION2,Color00B700;  

d3:=barssince(ss=1+2);  

dd3:=if(d3>=d3[LBOUND(d3)+1],d3,1);  

低3:IF(NOT(sjj),ma(c,dd3),sum(AMOUNT,dd3)/sum(v,dd3)/100),PRECISION2,Color8BC800;  

{}  

bb1:=v1>ref(v1,1)andv1>refx(v1,1);  

s1:=sum(bb1,sj);  

ss1:=s1[datacount]-s1+1;  

a1:=barssince(ss1=1);  

aa1:=if(a1>=a1[LBOUND(a1)+1],a1,1);  

高1:IF(NOT(sjj),ma(c,aa1),sum(AMOUNT,aa1)/sum(v,aa1)/100),PRECISION2,Color00FFFF;  

d21:=barssince(ss1=1+1);  

dd21:=if(d21>=d21[LBOUND(d21)+1],d21,1);  

高2:IF(NOT(sjj),ma(c,dd21),sum(AMOUNT,dd21)/sum(v,dd21)/100),PRECISION2,Color00D4FF;  

d31:=barssince(ss1=1+2);  

dd31:=if(d31>=d31[LBOUND(d31)+1],d31,1);  

高3:IF(NOT(sjj),ma(c,dd31),sum(AMOUNT,dd31)/sum(v,dd31)/100),PRECISION2,Color0098FF;  

{}  

bc:=barslast(SYSPARAM(1)=barpos)+1;  

fc:=sum(v,bc)/capital*100;  

hsl:=refx(fc,bc[datacount]-1);  

jjc:=sum(AMOUNT,bc)/sum(v,bc)/100;  

均价:=refx(jjc,bc[datacount]-1);//光标后均价  

偏离:=(C-均价)/均价*100;  

{}  

DRAWTEXT(ISLASTBAR,均价,'均价\n偏离\n'+NUMTOSTR(偏离[DATACOUNT],1)+'%'),PXUP20,SHIFT1,COLORWHITE;  

PARTLINE(C,均价),Color8B9091;//均价横线  

DRAWTEXT(SYSPARAM(1)=barpos,均价,'\n换手'+NUMTOSTR(hsl,2)+'%'),SHIFT1,PXUP10,ColorFF89FF;  

DRAWTEXT(SYSPARAM(1)=barpos,均价,'均价:'+NUMTOSTR(均价,2)+'元'),PXUP8,ALIGN2,Color0098FF;  

DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);  

DEA:EMA(DIFF,9);  

MACD:2*(DIFF-DEA),COLORSTICK;  

MA5:=MA(CLOSE,5);  

股价偏离MA5:(CLOSE-MA5)/MA5,color399c7f;  

MA55:=MA(CLOSE,55);  

股价偏离MA55:(CLOSE-MA55)/MA55,colorred;  

N5:=MA(AMOUNT,5);  

N13:=MA(AMOUNT,13);  

N55:=MA(AMOUNT,55);  

M5:=MA(VOL,5);  

M13:=MA(VOL,13);  

M55:=MA(VOL,55);  

MC5:=N5/M5/100;  

MC13:=N13/M13/100;  

MC55:=N55/M55/100;  

BMC_5日均价:(CLOSE-MC5)/MC5,colorgreen;{收盘价与5日均价比}  

{BMC_13日均价:(CLOSE-MC13)/MC13;}{收盘价与13日均价比}  

BMC_55日均价:(CLOSE-MC55)/MC55,color000999;{收盘价与55日均价比};  

drawtextabs(0,0,'流通盘市值与资金比,应该大于7200,否则,跌时出货就不暢!');

image.png

二、通达信量化均线偏离公式

  

DRAWTEXT_FIX(1,0.0,0.02,0,'多空平衡线|最低点低吸'),COLORRED;  

DRAWTEXT_FIX(1,0.0,0.08,0,'红线:工作|蓝线:休息'),COLORFFFFFF;  

DRAWTEXT_FIX(1,0.0,0.14,0,'红点:买入|绿点:清仓'),COLORGREEN;  

DRAWTEXT_FIX(1,0.0,0.2,0,'线上阴线买|买错也要买'),COLORRED;  

DRAWTEXT_FIX(1,0.0,0.26,0,'线下阳线卖|卖错也要卖'),COLORRED;  

多方强度:EMA(CLOSE,3),LINETHICK1,COLORFFFFDD;  

IF(多方强度<REF(多方强度,2),多方强度,DRAWNULL),COLORFFFFFF;  

空方强度:EMA(CLOSE,8),LINETHICK3,COLORFF00FF;  

IF(空方强度<REF(空方强度,2),空方强度,DRAWNULL),COLORFF0000;  

多空平衡:EMA(CLOSE,17),LINETHICK4,COLORRED;  

IF(多空平衡<REF(多空平衡,2),多空平衡,DRAWNULL),COLORYELLOW;  

洗盘线:EMA(CLOSE,27),LINETHICK1,COLOR80FF00;  

IF(洗盘线<REF(洗盘线,1),洗盘线,DRAWNULL),LINETHICK1,COLOR408080;  

DRAWICON(CROSS(多方强度,空方强度),空方强度,34);  

DRAWICON(CROSS(空方强度,多方强度),空方强度,35);  

LC:=REF(CLOSE,1);  

RSI:=(SMA(MAX(CLOSE-LC,0),6,1))/(SMA(ABS(CLOSE-LC),6,1))*100;  

量:=REF(C,REF(HHV(V,21),0));  

M1:=MA(C,1);  

A:=V>1*REF(V,1)AND(C/REF(C,1)-1)*100>9.5ANDM1>=量;  

DRAWICON(CROSS(A,1),L*0.98,1);  

DRAWTEXT(A,L*0.93,'追涨停'),COLORFF00FF;  

古道:=MA(CLOSE,5),LINETHICK1,COLOR00FFFF;  

西风:=MA(CLOSE,10),LINETHICK1,COLORFF00FF;  

瘦马:=MA(CLOSE,25),LINETHICK1,COLOR0000FF;  

断肠:=MA(CLOSE,34),LINETHICK1,COLORFFFF00;  

人在:=MA(CLOSE,62),LINETHICK1,COLORFF0000;  

天涯:=MA(CLOSE,99),LINETHICK1,COLOR00FF00;  

荣归故里:=MA(CLOSE,181),LINETHICK1,COLORFFFFFF;  

VAR1:=(OPEN+LOW+HIGH+CLOSE)/(4);  

STICKLINE(1,VAR1,VAR1,6,0),COLORFF00FF;  

FA:=BARSLAST(CROSS(西风,古道))ANDCROSS(古道,西风);  

FB:=FAAND(古道>断肠)AND(西风>断肠)AND(西风>REF(西风,1));  

STICKLINE(FB,LOW,LOW-0.09,4,0),COLORFFFFFF;  

DRAWTEXT(FB,LOW-0.13,'西风'),COLORFFFFFF;  

FA1:=BARSLAST(CROSS(人在,瘦马))ANDCROSS(瘦马,人在);  

FB1:=FAAND(瘦马>天涯)AND(人在>天涯)AND(瘦马>REF(瘦马,1));  

STICKLINE(FB,LOW,LOW-0.09,4,0),COLORFFFFFF;  

DRAWTEXT(FB,LOW-0.13,'西风'),COLOR00FF00;  

VARA:=((AMOUNT)/(VOL))/(100);  

VARB:=((3)*(HIGH)+LOW+OPEN+(2)*(CLOSE))/(7);  

VARC:=((SUM(AMOUNT,7))/(VARA))/(100);  

VARD:=DMA(VARB,(VOL)/(VARC));  

VARE:=((CLOSE-VARD)/(VARD))*(100);  

VARF:=((CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34)))*(100);  

VARJ:=MA(VARE,20)+STD(VARE,20);  

BIAS18:=((CLOSE-MA(CLOSE,18))/(MA(CLOSE,18)))*(100);  

K:=SMA(VARF,3,1);  

DRAWTEXT((REF(BIAS18,1)>=5)ANDCROSS(VARJ,VARE)AND(K>79),HIGH+0.1,'风雨飘摇'),COLOR00FFFF;  

LC:=REF(CLOSE,1);  

RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;  

洗钱A:=(CLOSE-LLV(LOW,32))/(HHV(HIGH,32)-LLV(LOW,32))*1.2*CLOSE;  

量1:=EMA(洗钱A,3);  

量2:=EMA(洗钱A,5);  

量3:=EMA(洗钱A,7);  

STICKLINE(量1>量2,量3,量1,3,1),COLORRED;  

STICKLINE(量1<量2,量3,量1,2,0),COLORCYAN;  

N:=5;  

M:=13;  

H1:=MAX(DYNAINFO(3),DYNAINFO(5));  

L1:=MIN(DYNAINFO(3),DYNAINFO(6));  

P1:=H1-L1;  

量化阻力:=L1+P1*7/8,colorgreen;  

量化支撑:=L1+P1*0.5/8,colorred;  

量化中线:=(量化支撑+量化阻力)/2,colorwhite,POINTDOT;  

V11:=3*SMA((C-LLV(L,N))/(HHV(H,N)-LLV(L,N))*M,5,1)-2*SMA(SMA((C-LLV(L,N))/(HHV(H,N)-LLV(L,N))*M,5,1),3,1);  

量化趋势线:EMA(V11,3),LINETHICK1,coloryellow;  

V12:=(量化趋势线-REF(量化趋势线,1))/REF(量化趋势线,1)*100;  

准备买入:STICKLINE(量化趋势线<11,量化趋势线,11,5,0),colorred;  

AA:=(量化趋势线<11)ANDFILTER((量化趋势线<=11),15)ANDC<量化中线;  

BB0:=REF(量化趋势线,1)<11ANDCROSS(量化趋势线,11)ANDC<量化中线;  

BB1:=REF(量化趋势线,1)<11ANDREF(量化趋势线,1)>6ANDCROSS(量化趋势线,11);  

BB2:=REF(量化趋势线,1)<6ANDREF(量化趋势线,1)>3ANDCROSS(量化趋势线,6);  

BB3:=REF(量化趋势线,1)<3ANDREF(量化趋势线,1)>1ANDCROSS(量化趋势线,3);  

BB4:=REF(量化趋势线,1)<1ANDREF(量化趋势线,1)>0ANDCROSS(量化趋势线,1);  

BB5:=REF(量化趋势线,1)<0ANDCROSS(量化趋势线,0);  

BB:=BB1=1ORBB2=1ORBB3=1ORBB4=1ORBB5=1;  

下单买入:STICKLINE(BB=1ANDC<量化中线,11,52,1,0),colorred;  

DRAWICON(BB=1ANDC<量化中线,55,1);  

DRAWTEXT(BB0,60,'★抄底'),colorred;  

DRAWTEXT(AA,16,'超卖见底'),colorwhite;  

准备卖出:STICKLINE(量化趋势线>89,量化趋势线,89,5,0),colorgreen;  

CC:=(量化趋势线>89)ANDFILTER((量化趋势线>89),15)ANDC>量化中线;  

DD0:=REF(量化趋势线,1)>89ANDCROSS(89,量化趋势线)ANDC>量化中线;  

DD1:=REF(量化趋势线,1)>89ANDREF(量化趋势线,1)<94ANDCROSS(89,量化趋势线);  

DD2:=REF(量化趋势线,1)>94ANDREF(量化趋势线,1)<97ANDCROSS(94,量化趋势线);  

DD3:=REF(量化趋势线,1)>97ANDREF(量化趋势线,1)>99ANDCROSS(97,量化趋势线);  

DD4:=REF(量化趋势线,1)>99ANDREF(量化趋势线,1)<100ANDCROSS(99,量化趋势线);  

DD5:=REF(量化趋势线,1)>100ANDCROSS(100,量化趋势线);  

DD:=DD1=1ORDD2=1ORDD3=1ORDD4=1ORDD5=1;  

下单卖出:STICKLINE(DD=1ANDC>量化中线,89,49,1,0),colorgreen;  

DRAWICON(DD=1ANDC>量化中线,55,2);  

DRAWTEXT(DD0,40,'★逃顶'),colorgreen;  

DRAWTEXT(CC,84,'超买见顶'),colorwhite;  

顶:89,colorgreen;  

底:11,colorred;  

中:50,POINTDOT,colorwhite;  

DRAWTEXT(ISLASTBAR,顶,'顶'),colorgreen;  

DRAWTEXT(ISLASTBAR,底,'底'),colorred;  

DRAWTEXT(ISLASTBAR,中,'中'),colorwhite;

image.png

[源码注释]通达信公式动态翻译结果

LC赋值:1日前的收盘价

RSI1赋值:收盘价-LC和0的较大值的6日[1日权重]移动平均/收盘价-LC的绝对值的6日[1日权重]移动平均*100

洗钱A赋值:(收盘价-32日内最低价的最低值)/(32日内最高价的最高值-32日内最低价的最低值)*1.2*收盘价

量1赋值:洗钱A的3日指数移动平均

量2赋值:洗钱A的5日指数移动平均

量3赋值:洗钱A的7日指数移动平均

当满足条件量1>量2时,在量3和量1位置之间画柱状线,宽度为3,1不为0则画空心柱.,画红色

当满足条件量1<量2时,在量3和量1位置之间画柱状线,宽度为2,0不为0则画空心柱.,画青色

推荐阅读:通达信强弱追踪指标公式

  

RSV1:=(C-LLV(L,34))/(HHV(H,34)-LLV(L,34))*100;  

GG:MA(RSV1,3),COLORWHITE;  

RSV2:=(INDEXC-LLV(INDEXL,34))/(HHV(INDEXH,34)-LLV(INDEXL,34))*100;  

DP:MA(RSV2,3),COLORGREEN;  

0,COLORRED,POINTDOT,LINETHICK2;  

20,COLORRED,POINTDOT,LINETHICK2;  

50,COLORRED,POINTDOT,LINETHICK2;  

80,COLORRED,POINTDOT,LINETHICK2;  

100,COLORRED,POINTDOT,LINETHICK2;  

A1:=COUNT(GG>REF(GG,1),2)=2;  

A2:=COUNT(DP<REF(DP,1),2)=2;  

A3:=COUNT(GG<REF(GG,1),2)=2;  

A4:=COUNT(DP>REF(DP,1),2)=2;  

逆势上涨:IF(A1ANDA2,25,0),LINETHICK1;  

DRAWTEXT(逆势上涨,10,'涨'),COLORRED;  

逆势下跌:IF(A3ANDA4,10,0),LINETHICK1;  

DRAWTEXT(逆势下跌,10,'跌'),COLORGREEN;  

换手率:VOL/CAPITAL*100,colorred,DRAWNULL;  

个股:EMA(100*(C-LLV(LOW,34))/(HHV(H,34)-LLV(LOW,34)),3),COLOR1010FF;  

大盘:EMA(100*(INDEXC-LLV(INDEXL,34))/(HHV(INDEXH,34)-LLV(INDEXL,34)),3),COLORE67010,LINETHICK2;  

短线反弹:IF(CROSS(个股,9),50,0),STICK,LINETHICK3,COLOR00FF00;  

DRAWTEXT(CROSS(个股,9),40,'反弹!'),COLOR00FF00;  

VAR1:=EMA(CLOSE,3);  

VAR2:=EMA(CLOSE,21);  

VAR3:=BARSLAST(CROSS(VAR2,VAR1))>15;  

VAR4:=VOL>MA(VOL,5)*2ANDVOL<MA(VOL,5)*5;  

VAR5:=CROSS(VAR1,VAR2)ANDVAR4ANDVAR3;  

黑马:IF(VAR5,80,0),STICK,LINETHICK4,COLORF00FF0;  

DRAWTEXT(VAR5,70,'黑马!'),COLORF00FF0;  

65,LINETHICK1,colorgreen;  

45,LINETHICK1,colorred;  

逆势上:=个股>REF(个股,1)AND大盘<REF(大盘,1);  

逆势增仓:(逆势上ANDREF(逆势上,1)ANDREF(逆势上,2))*80;  

等待拉升:(BARSLAST(逆势增仓)<22ANDBARSLAST(逆势增仓)>5)*80;  

拉升:(BARSLAST(等待拉升)<5ANDVOL>MA(VOL,3)*1.15ANDC>REF(C,1))*80;  

成交量:VOL,VOLSTICK;  

{预计量:IF(CURRBARSCOUNT=1ANDPERIOD=5,VOL*240/FROMOPEN,DRAWNULL),COLORFFFF00;}  

VAR1:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));  

买盘:IF(CLOSE>OPEN,VAR1*(HIGH-LOW),IF(CLOSE<OPEN,VAR1*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2)),COLORRED,POINTDOT;  

卖盘:-IF(CLOSE>OPEN,0-VAR1*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-VAR1*(HIGH-LOW),0-VOL/2)),COLORGREEN,POINTDOT;  

净买:(买盘-卖盘),COLORYELLOW,NODRAW;  

换手率:HSL,COLORWHITE,NODRAW;  

累计10日换手:SUM(换手率,10),NODRAW;  

{绿色柱子}  

STICKLINE(VOL>0,VOL,0,3,0),COLOR005500;  

{红色柱子}  

STICKLINE(买盘>0,0,买盘,3,0),COLOR0000BB;  

五周期量:MA(VOL,5),COLORWHITE,LINETHICK1;  

十周期量:MA(VOL,10),COLORFFFF00,LINETHICK1;  

TOTAL:=IF(PERIOD=1,5,IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,240,1)))));  

MTIME:=MOD(FROMOPEN,TOTAL);  

CTIME:=IF(MTIME<0.5,TOTAL,MTIME);  

VA:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL);  

OBV1:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0);  

OBV2:=EMA(OBV1,3)-MA(OBV1,9);  

OBV3:=EMA(IF(OBV2>0,OBV2,0),3);  

MAC3:=MA(C,3);  

STICKLINE(OBV3>REF(OBV3,1)ANDMAC3>REF(MAC3,1),0,OBV3,0.1,0),COLORYELLOW;

image.png

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