通达信公式源码概况:

指标类别:通达信公式

授权方式: 免费版

指标评级: ★★★★★

指标分类: 策略

画线方法: 副图

1、头肩顶形态的波段操作

操作卖出的条件

股价经过一波大幅上涨,出现放量滞涨或缩量上涨的量价顶背离、钝化形态。股价与技术指标出现顶背离或顶部钝化形态。

(1)股价反弹至前高点或未到前高点时受阻反转向下,为卖出的第一时机。

(2)股价跌破头肩顶的颈线时为卖出的第二时机。

(3)股价跌破颈线后,反抽受颈线压制再次下跌,为卖出的第三时机。2、圆弧顶形态的波段操作

操作卖出条件

在一波大幅上涨的末期,上涨乏力,k线逐步变小,且量价顶背离、钝化,或出现天量成交。判断圆弧顶时要注意,前期的上涨是由急到缓,而且下跌时形成向下的跳空缺口,标志着圆弧顶形态完全形成。

(1)在圆弧的顶部出现放量下跌的反转K线时,为第一卖出时机。

(2)在圆弧顶右侧出现跳空缺口时,为第二卖出时机。

(3)股价反弹至圆弧顶形态缺口受阻下跌时,为第三卖出时机。

image.png

公式源码如下:

 

Var1:=COST(99999)*0;  

Var2:=COST(10)*0;  

Var3:=99999;  

短期:MA(CLOSE,5)-2*STD(CLOSE,14);  

中期:MA(CLOSE,34)-2*STD(CLOSE,60);  

长期:MA(CLOSE,89)-2*STD(CLOSE,155);  

MA5:MA(CLOSE,5);  

MA10:MA(CLOSE,10);  

MA20:MA(CLOSE,20);  

MA60:MA(CLOSE,60);  

CS:=(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8))*100;  

YJD:=(EMA(CS,3)-50)*2;  

STICKLINE(CROSS(YJD,-80),LOW*0.94,LOW*0.96,2,1),COLORYELLOW;  

DRAWTEXT(CROSS(YJD,-80),LOW*0.95,’波段抄底‘),COLORYELLOW;  

N:=9;  

M1:=3;  

M2:=3;  

RSV=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;  

a=SMA(RSV,M1,1);  

b=Sma(a,M2,1);  

e=3*a-2*b;  

IF(a<0)a=0;  

IF(a>100)a=100;  

IF(b<0)b=0;  

IF(b>100)b=100;  

IF(e<0)e=0;  

IF(e>100)e=100;  

K:a;  

D:b;  

J:e;  

N:=14;  

TYP:=(IF(ISNULL(HIGH),CLOSE,HIGH)+IF(ISNULL(LOW),CLOSE,LOW)+CLOSE)/3;  

cci:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));  

a:100;  

b:-100;  

VAR1:=REF(CLOSE,2);  

A2:=SMA(MAX(CLOSE-VAR1,0),7,1)/SMA(ABS(CLOSE-VAR1),7,1)*100,,COLOR00FF00;  

STICKLINE(A2<REF(A2,1)ANDA2>79,1.02*HIGH,1.01*HIGH,5,0),COLOR00FFFF;  

DRAWTEXT(A2<REF(A2,1)ANDA2>79,1.01*HIGH,’波段顶’),COLORF000F0;  

DIF:EMA(C,5)-EMA(C,30),COLORSTICK;  

M:=89;  

N:=14;  

TYP:=(IF(ISNULL(HIGH),CLOSE,HIGH)+IF(ISNULL(LOW),CLOSE,LOW)+CLOSE)/3;  

cci2:(TYP-ma(TYP,M))/(0.015*AVEDEV(TYP,M));  

CCI3:(TYP-MA(TYP,M))/(0.015*AVEDEV(TYP,M));  

CCI:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));  

a:100;  

b:-100;  

DEA:=EMA(DIF,5);  

DIF,COLORGREEN;  

DEA,COLORGREEN;  

零上金叉买:0,COLORBLUE,CROSSDOT,LINETHICK2;  

IF(DIF>DEA,DIF,DRAWNULL),COLORRED,LINETHICK2;  

IF(DEA>REF(DEA,1),DEA,DRAWNULL),COLORMAGENTA;  

DRAWICON(CROSS(DIF,DEA),DEA,1);  

DRAWICON(CROSS(DEA,DIF),DEA,2);  

Var1:=(CLOSE-LLV(LOW,36))/(HHV(HIGH,36)-LLV(LOW,36))*100;  

AAF:LLV(LOW,34),LINETHICK1,COLORFFFFCC;  

BBF:ma(AAF,4),LINETHICK1,COLORYELLOW;  

TYP:=(HIGH+LOW+CLOSE)/3;  

cci1:=(TYP-MA(TYP,6))/(0.015*AVEDEV(TYP,5));  

差值1:=Abs(REF(CCI1,1)-CCI1);  

CCI2:=(TYP-MA(TYP,10))/(0.015*AVEDEV(TYP,10));  

差值2:=ABS(REF(CCI2,1)-CCI2);  

CCI3:=(TYP-MA(TYP,20))/(0.015*AVEDEV(TYP,20));  

差值3:=ABS(REF(CCI3,1)-CCI3);  

CCI4:=(TYP-MA(TYP,30))/(0.015*AVEDEV(TYP,30));  

差值4:=ABS(REF(CCI4,1)-CCI4);  

CCI5:=(TYP-MA(TYP,60))/(0.015*AVEDEV(TYP,60));  

差值5:=ABS(REF(CCI5,1)-CCI5);  

CCI:=CCI1+CCI2+CCI3+CCI4+CCI5;  

AAA:=(3*C+H+L+O)/6;  

VAR1:=(8*AAA+7*REF(AAA,1)+6*REF(AAA,2)+5*REF(AAA,3)  

+4*REF(AAA,4)+3*REF(AAA,5)+2*REF(AAA,6)+REF(AAA,8))/36;  

VAR2:=(HHV(VAR1,5)+HHV(VAR1,10)+HHV(VAR1,20))/3;  

VAR3:=(LLV(VAR1,5)+LLV(VAR1,10)+LLV(VAR1,20))/3;  

VAR4:=(HHV(VAR2,5)+HHV(VAR2,10)+HHV(VAR2,20))/3;  

VAR5:=(LLV(VAR3,5)+LLV(VAR3,10)+LLV(VAR3,20))/3;  

VAR6:=(LLV(VAR1,2)+LLV(VAR1,4)+LLV(VAR1,6))/3;  

短线:VAR1,COLORWHITE;  

中线:VAR6,COLORYELLOW;  

下跌:IF(VAR1=VAR6,VAR6,0),COLORGREEN,LINETHICK0;  

PARTLINE(VAR6,VAR1=VAR6),COLORGREEN;  

TJ1:=CCI1>差值4;  

立桩量:=FILTER(TJ1,0){,NODRAW};  

TJ2:=IF(BArslAst(立桩量)=1,1,0);  

{STICKLINE(立桩量<>1,REF(HIGH,BARSLAST(立桩量)),  

REF(HIGH,BARSLAST(立桩量)),1,1),COLORCYAN;}  

成立1:=TJ2=1;  

条件成立1:=FILTER(成立1,5);  

DRAWTEXT(条件成立1,REF(HIGH,BARSLAST(立桩量)),’看跌’),COLORBLUE;  

TJ11:=CCI1<-差值4;  

立桩量2:=FILTER(TJ11,0){,NODRAW};  

TJ22:=IF(BARSLAST(立桩量2)=1ANDCLOSE>REF(HIGH,1),1,0);  

突破2:=TJ22=1;  

{STICKLINE(CLOSEAND(下跌<>VAR6),REF(LOW,BARSLAST(立桩量2)),  

REF(LOW,BARSLAST(立桩量2)),1,1),COLORYELLOW;}  

TJ:=IF(BARSLAST(立桩量2)=1ANDCLOSE>REF(LOW,1),1,0);  

成立2:=TJ=1;  

条件成立2:=FILTER(成立2,5);  

DRAWTEXT(条件成立2,REF(LOW,BARSLAST(立桩量2)),’看涨’),COLORMAGENTA;  

TJ111:=ABS(CCI1)>CCIANDABS(差值1)>ABS(差值5);  

立桩量3:=FILTER(TJ111,3);  

TJ3:=IF(BARSLAST(立桩量3)=1ANDCLOSE>REF(LOW,1),1,IF(BARSLAST(立桩量3)=2ANDCLOSE>REF(LOW,2),1,IF(BARSLAST(立桩量3)=3ANDCLOSE>REF(LOW,3),1,0)));  

成立:=TJ3=1;  

条件成立:=FILTER(成立,5);  

DRAWTEXT(条件成立AND下跌<>VAR6,L*0.97,’☆成立’);  

LC:=REF(CLOSE,1);  

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

FF:=EMA(CLOSE,3);  

MA15:=EMA(CLOSE,21);  

N:=5;  

Var1:=N;  

等待:1.00*Var1;  

1.073*Var1,POINTDOT;  

1.118*Var1,POINTDOT;  

返复:1.191*Var1;  

1.264*Var1,POINTDOT;  

1.309*Var1,POINTDOT;  

虎口:1.382*Var1;  

1.472*Var1,POINTDOT;  

1.528*Var1,POINTDOT;  

不宜:1.618*Var1;  

1.691*Var1,POINTDOT;  

1.736*Var1,POINTDOT;  

险峰:1.809*Var1;  

DRAWTEXT(crOSS(FF,MA15),BBF,’底背离’),COLORA6E500;  

DRAWTEXT(CROSS(88,RSI),(HIGH*1.02),’顶背离’),COLOR1880FF;  

X1:=(C+L+H)/3;  

BB13:=ATAN(EMA(X1,13)-REF(EMA(X1,13),1))*3.1416*10;  

EMA8:=EMA(C,8);  

DRAWTEXT(FILTER(BB13>1ANDEMA(X1,13)>REF(EMA(X1,8),1),10),  

EMA8,’∠45′),COLORWHITE;  

STICKLINE(C>O,C,O,6,0),COLOR0000FF;  

STICKLINE(C<O,C,O,6,0),COLOR666600;  

STICKLINE(立桩量,C,O,6,0),COLOR0000FF;  

STICKLINE(1,C,O,0,0),COLORCCCCCC;  

山还是山:SMA(C,125,1),COLORYELLOW;  

B1:=MA(C,1);  

B2:SMA(SMA(SMA(B1,2,1),2,1),2,1),COLORRED;  

SMA2:MA(B2,2),COLORCYAN;  

箱顶:HHV(MA(B2,2),58),COLOR00AAFF;  

IF(B2<SMA2,SMA2,DRAWNULL),COLORFFA93F,LINETHICK2;  

10:=EMA(CLOSE,10);  

25:EMA(CLOSE,25),COLORWHITE;  

40:EMA(CLOSE,40),COLOR00AA00;  

80:EMA(CLOSE,80),COLORFFFF00;  

125:SMA(C,125,1),COLORYELLOW;  

VAR1:=(100-((90*(HHV(HIGH,21)-CLOSE))/(HHV(HIGH,21)-LLV(LOW,21))));  

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

少爷分水岭:SMA(MA(C,5),430,1),COLORB48F33,LINETHICK2;  

买:DRAWTEXT(CROSS(VAR1,MA(VAR3,VAR1))ANDB2>SMA2,(LOW*0.97),’←⊙买’),COLORRED;  

DRAWTEXT(CROSS(C,10)ANDVAR3>1ANDB2>SMA2,L*0.99,’←※’),COLORWHITE,LINETHICK2;  

DRAWTEXT(CROSS(C,25)ANDVAR3>1ANDB2>SMA2,L*0.99,’←◇’),COLORGREEN,LINETHICK2;  

DRAWTEXT(CROSS(C,40)ANDVAR3>1ANDB2>SMA2,L*0.99,’←□’),COLORRED,LINETHICK2;  

DRAWTEXT(CROSS(C,80)ANDVAR3>1ANDB2>SMA2,L*0.99,’←○’),COLORCCFF66,LINETHICK2;  

DRAWTEXT(CROSS(C,125)ANDVAR1>1,L*0.99,’←△’),COLORYELLOW,LINETHICK2;  

{牛熊界:MA(CLOSE,49),LINETHICK2,COLORGRAY;};  

image.png

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

AA赋值:以收盘价计算的获利盘比例*100

输出XG:(AA-1日前的AA)>=20

image.png

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