通达信公式源码概况:

指标类别:通达信公式

授权方式: 免费版

指标评级: ★★★★★

指标分类: 策略

画线方法: 副图

一、通达信金蜘蛛主图指标公式

  

input:n(4,1,255),m(13,1,255);  

drawgbk(c=c,colorrgb(90,90,90),colorrgb(0,0,0),1);  

aa:=ref(h,n)=hhv(h,2*n+1);  

aaa:=filter(aa,n);  

bb:=backset(aaa,n+1);  

cc1:=filter(bb,n);  

cc:=cc1orislastbar;  

aa2:=ref(l,n)=llv(l,2*n+1);  

aaa2:=filter(aa2,n);  

bb2:=backset(aaa2,n+1);  

cc22:=filter(bb2,n);  

cc2:=cc22andnot(cc1);  

ea:=backset(cc,ref(barslast(cc2),1)+1);  

eb:=ea>ref(ea,1);  

ee:=backset(eb,2);  

ff1:=ee>ref(ee,1);  

ee2:=backset(ff1andcount(cc,ref(barslast(cc2),1)+2)=0,ref(barslast(cc2),1)+2);  

ff2:=ee2>ref(ee2,1);  

ee3:=backset(ff2andcount(cc,ref(barslast(cc2),1)+2)=0,ref(barslast(cc2),1)+2);  

ff3:=ee3>ref(ee3,1);  

js:=if(cc,count(cc2,ref(barslast(cc),1)+1),0);  

g1:=if(js=1andcc,barslast(ff1),0);  

ga:=if(ccandref(l,barslast(ff1))>=ref(l,barslast(ff2)),barslast(ff2),barslast(ff1));  

g2:=if(js=2andcc,ga,0);  

g3:=if(js>=3andcc,if(ccandref(l,ga)>=ref(l,barslast(ff3)),barslast(ff3),ga),0);  

gg:=g1+g2+g3;  

ja:=backset(cc,gg);  

jb:=ja>ref(ja,1);  

jj:=backset(jb,2);  

ld:=jj>ref(jj,1);  

ld1:=ldorislastbar;  

hea:=backset(ld1,ref(barslast(cc),1)+1);  

heb:=hea>ref(hea,1);  

hee:=backset(heb,2);  

hff1:=hee>ref(hee,1);  

hee2:=backset(hff1andcount(ld1,ref(barslast(cc),1)+2)=0,ref(barslast(cc),1)+2);  

hff2:=hee2>ref(hee2,1);  

hee3:=backset(hff2andcount(ld1,ref(barslast(cc),1)+2)=0,ref(barslast(cc),1)+2);  

hff3:=hee3>ref(hee3,1);  

hjs:=if(ld1,count(cc1,ref(barslast(ld1),1)+1),0);  

hg1:=if(hjs=1andld1,barslast(hff1),0);  

hga:=if(ld1andref(h,barslast(hff1))<=ref(h,barslast(hff2)),barslast(hff2),barslast(hff1));  

hg2:=if(hjs=2andld1,hga,0);  

hg3:=if(hjs>=3andld1,if(ld1andref(h,hga)<=ref(h,barslast(hff3)),barslast(hff3),hga),0);  

hgg:=hg1+hg2+hg3;  

hja:=backset(ld1,hgg);  

hjb:=hja>ref(hja,1);  

hjj:=backset(hjb,2);  

hd:=hjj>ref(hjj,1);  

x1:=backset(islastbar,barslast(ld)+1);  

x2:=x1>ref(x1,1);  

y1:=backset(islastbar,barslast(hd)+1);  

y2:=y1>ref(y1,1);  

z1:=if(barslast(x2)<barslast(y2),x2,y2);  

z2:=if(barslast(x2)<barslast(y2),l,h);  

drawline(z1,z2,islastbar,c,0),pointdot,colorff9900;  

uu:=backset(islastbar,barslast(ld)+1);  

vv:=uu>ref(uu,1);  

ww:=backset(vv,ref(barslast(ld),1)+2);  

xx:=ww>ref(ww,1);  

drawline(xx,l,vv,l,1),pointdot,colorffff;  

uu2:=backset(islastbar,barslast(hd)+1);  

vv2:=uu2>ref(uu2,1);  

ww2:=backset(vv2,ref(barslast(hd),1)+2);  

xx2:=ww2>ref(ww2,1);  

drawline(xx2,h,vv2,h,1),pointdot,colorffff;  

drawicon(hdandxx2,h*1.002,12);  

drawicon(ldandxx,l*1.002,10);  

高1:ref(h,barslast(vv2)),pointdot,color99ff66;  

高2:ref(h,barslast(xx2)),pointdot,colorff66ff;  

低1:ref(l,barslast(vv)),pointdot,color99ff66;  

低2:ref(l,barslast(xx)),pointdot,colorff66ff;  

ok:=ema(o,60);  

cg:=ema(c,60);  

pdu:=if(ok>ref(ok,1)andcg>ref(cg,1),1,0);  

pdd:=if(ok<ref(ok,1)andcg<ref(cg,1),1,0);  

pdm:=if(pdu=0andpdu=0,1,0);  

z1:=ma(c,m);  

zx:=ref(z1,m/2+1);  

life:=(ema(c,60)+ema(c,90))/2;  

var1:=(2*c+h+l)/4;  

snook:=ema(var1,99)*0.91;  

a1:=(c-ref(c,1))/ref(c,1)*100;  

ma5:=barslast(a1>3);  

ma20:=if(ma5>0,1,0);  

stickline(c>zx,h,l,1,0),colorffff;  

stickline(c>zxandc>=life,o,c,8,0),colorff;  

stickline(c>zxandc<=snook,o,c,8,0),colorff00;  

stickline(c>zxandc>snookandc<life,o,c,8,0),colorff0000;  

stickline(c>zxandma20=0,o,c,8,0),colorffff;  

stickline(c>zx,o,c,2,0),colorffffff;  

drawicon(cross(c,zx),l*0.99,4);  

drawicon(cross(zx,c),h*1.01,5);  

by20:=ma(c,5);  

顶选:cross(c,zx),LINETHICK0;  

招财猫:ma(c,20),colorffff;  

鼠变异:if(by20>招财猫,招财猫,by20),color808080;  

选股:cross(c,zx)andc>zxandma20=0,LINETHICK0;  

rb:=BARSCOUNT(C)=SYSPARAM(2);  

rd:=BARSLAST(rb);  

k2:=hhv(h,rd);  

k1:=llv(l,rd);  

t1:=c>zxandc>=life;  

t2:=c>zxandc>snookandc<life;  

t3:=c>zxandc<=snook;  

t4:=c<=zx;  

t5:=鼠变异>ref(鼠变异,1)and鼠变异<>招财猫;  

t6:=鼠变异>ref(鼠变异,1)and鼠变异=招财猫andpdu<>1;  

t7:=鼠变异>ref(鼠变异,1)and鼠变异=招财猫andpdu=1;  

t8:=c>zxandma20=0;  

eee:=t1+t2+t3+t4+t5+t6+t7+t8;  

e:=(k2-k1)/(eee+4);  

DRAWTEXT(C>0andt1>0andBARSTATUS=2,k2-e,'老鼠出洞了,'),color0000ff;  

DRAWTEXT(C>0andt1>0andBARSTATUS=2,k2-e*2,'逮住它!'),color0000ff;  

DRAWTEXT(C>0andt2>0andBARSTATUS=2,k2-e,'老鼠玩猫猫,'),colorff7700;  

DRAWTEXT(C>0andt2>0andBARSTATUS=2,k2-e*2,'守着它!'),colorff7700;  

DRAWTEXT(C>0andt3>0andBARSTATUS=2,k2-e,'老鼠露尾巴,'),color00ff00;  

DRAWTEXT(C>0andt3>0andBARSTATUS=2,k2-e*2,'动作快!'),color00ff00;  

DRAWTEXT(C>0andt4>0andBARSTATUS=2,k2-e,'老鼠没有了,'),color808080;  

DRAWTEXT(C>0andt4>0andBARSTATUS=2,k2-e*2,'打个盹!'),color808080;  

DRAWTEXT(C>0andt5>0andBARSTATUS=2,k2-e*3,'发现鼠迹!'),color00ff00;  

DRAWTEXT(C>0andt6>0andBARSTATUS=2,k2-e*3,'瞬间鼠影!'),colorff66ff;  

DRAWTEXT(C>0andt7>0andBARSTATUS=2,k2-e*3,'恶鼠难遁!'),color0000ff;  

DRAWTEXT(C>0andt8>0andBARSTATUS=2,k2-e*4,'老鼠去哪里,'),color00ffff;  

DRAWTEXT(C>0andt8>0andBARSTATUS=2,k2-e*5,'思考哦!'),color00ffff;  

DIF1:=Ema(CLOSE,7)-EMA(CLOSE,19),COLORWHITE;  

DEA1:=EMA(DIF1,9);  

RSV1:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;  

K日:SMA(RSV1,3,1),COLORWHITE;  

D日:SMA(K日,3,1),COLORYELLOW;  

J日:3*K日-2*D日,COLORFF00FF;  

底部:=0,COLORF00FF0,LINETHICK2;  

XG:=crOSS(J日,底部);  

VAR11:=REF(CLOSE,1);  

VAR21:=SMA(MAX(CLOSE-VAR11,0),7,1)/SMA(Abs(CLOSE-VAR11),7,1)*100;  

MJ3:=FILTER(REF(VAR21,1)<20ANDVAR21>REF(VAR21,1),5);  

DIF:=EMA(CLOSE,12)-EMA(CLOSE,29);  

DEA:=EMA(DIF,9);  

MD:=(DIF-DEA)*2;  

MJ1:=CROSS(DIF,DEA);  

DIFF:=EMA(DCLOSE,12)-EMA(DCLOSE,26);{来自经典副B}  

DEAQ:=EMA(DIFF,9),COLORFFFF00;  

macd:=(DIFF-DEAQ)*2;  

A1:=BArslAst(REF(CROSS(DIFF,DEAQ),1));  

A2:=BARSLAST(REF(CROSS(DEAQ,DIFF),1));  

背离:=REF(CLOSE,A1+1)>CLOSEANDDIFF>REF(DIFF,A1+1)ANDCROSS(DIFF,DEAQ);  

N:=9;  

A1:=Ema(EMA(EMA(EMA(EMA(EMA(CLOSE,3),3),3),3),3),20);  

B1:=(A1-REF(A1,1))/REF(A1,1)*100;  

C1:SUM(B1,N);  

A2:=EMA(EMA(EMA(EMA(EMA(CLOSE,12),12),12),12),12);  

B2:=(A2-REF(A2,1))/REF(A2,1)*100;  

C2:SUM(B2,N);  

A3:=EMA(EMA(EMA(CLOSE,18),18),18);  

B3:=(A3-REF(A3,1))/REF(A3,1)*100;  

C3:SUM(B3,N);  

stICKLINE(C2>REF(C2,1),C2,C3,0,0),COLORRED;  

STICKLINE(C2<REF(C2,1),C2,C3,0,0),COLORGREEN;  

STICKLINE(C1>REF(C1,1),C1,C3,0,0),COLORRED;  

STICKLINE(C1<REF(C1,1),C1,C3,0,0),COLORGREEN;  

DRAWTEXT(crOSS(C1,REF(C1,1))ANDC1>C3,C1,'买点'),COLORRED;  

DRAWTEXT(CROSS(C1,C2)ANDC1>C3ANDC1>C2,C1,'买点'),COLORRED;  

N:=9;  

随机值:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;  

KSMA:=SMA(随机值,3,1);  

DSMA:=SMA(KSMA,3,1);  

M1:=N-1;  

F:=HHV(HIGH,M1)-LLV(LOW,M1);  

K:=KSMA/3*2+(CLOSE-LLV(LOW,M1))/F*100/3;  

D:=DSMA/3*2+K/3;  

J:=3*K-2*D;  

X1:=(J*9+DSMA*12-KSMA*14)*F/700+LLV(LOW,M1);  

X3:=IF(CLOSE&gt;500,100,1);  

X4:=IF(CLOSE&gt;500,1,10);  

高价:(F*80/100+LLV(LOW,M1)),LINETHICK2;  

现价:X1,COLORRED;  

KD:((DSMA*3-KSMA*2)*F/100+LLV(LOW,M1)),COLORFF00FF;  

低价:(F*20/100+LLV(LOW,M1)),LINETHICK2;  

MA13:=MA(X1,13);  

买1:=CROSS(现价,KD)ANDKDJ.J&lt;20;  

买2:=CROSS(现价,低价)ANDKDJ.J&lt;30;  

卖1:=CROSS(高价,现价)ANDKDJ.J&gt;80;  

卖2:=CROSS(KD,现价)ANDKDJ.J&gt;80;  

LIFE1:MA(C,13),COLORYELLOW,POINTDOT,LINETHICK5;  

LIFE2:MA(X1,55),CROSSDOT,LINETHICK2;  

DRAWTEXT(买2,L*0.99,'▲买1'),COLORRED;  

DRAWTEXT(买1,L*0.99,'△买2'),COLORYELLOW;  

DRAWTEXT(卖1,H*1.02,'◆卖1'),COLORGREEN;  

DRAWTEXT(卖2,H*1.02,'◇卖2'),COLORCYAN;  

bias1:=(C-MA(C,6))/MA(C,6)*100;  

BIAS2:=(C-MA(C,12))/MA(C,12)*100;  

BIAS3:=(C-MA(C,24))/MA(C,24)*100;  

BIAS:=(BIAS1+2*BIAS2+3*BIAS3)/6;  

乖离:=MA(BIAS,3);  

XG3:=CROSS(BIAS,乖离)AND乖离<-9.5;  

XG4:=MJ3ANDMJ1;  

XG5:=XG3ANDMJ1;  

WC1:=MJ3ANDXG3ANDXG;  

WC2:=MJ3ANDXG;  

WC3:=XG3ANDXG;  

WC4:=MJ3ANDXG3AND底背离;  

DRAWICON(XG4ORXG5ORWC1ORWC2ORWC3ORWC4,50,23);

image.png

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

输出XG:最近10日存在收盘价的30日简单移动平均上穿收盘价的60日简单移动平均

每日通达信公式解答:

  

选股条件  

股价下跌但K线收红且量增选股公式。  

编写源码  

C<REF(C,1)ANDC>OANDV>REF(V,1);

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