通达信指标公式源码概况:
指标类别: 通达信指标公式
授权方式: 免费版
指标评级: ★★★★★
指标分类: 策略
画线方法: 副图
一、通达信主图带箭头的指标公式
停损⽌盈
MTR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(MTR,12);
VAR1:=IF(C =HHV(C,24)ANDL LLV(L,12),1,0);VAR2:=IF(C =LLV(C,24)ANDH
VAR4:=LLV(MA(L,2),24)+N*ATR;
SSTOP:IF(VAR1,VAR3,REF(VAR3,BARSLAST(VAR1=1))),COLORGREEN;
XSTOP:IF(VAR2,VAR4,REF(VAR4,BARSLAST(VAR2=1))),COLORYELLOW;
{K线⾛向}
STICKLINE(1,H,L,0,1),COLORGRAY;
STICKLINE(C =O,O,C,-1,0),COLORGRAY;STICKLINE(C O,O,C,-1,1),COLORGRAY;
AH:=C REF(HHV(C,2),1);
STICKLINE(AH,H,L,0,1),COLORRED;
STICKLINE(AHANDC =O,O,C,-1,0),COLORRED;STICKLINE(AHANDC O,O,C,-1,1),COLORRED;BL:=C
STICKLINE(BL,H,L,0,1),COLORBLUE;
STICKLINE(BLANDC =O,O,C,-1,0),COLORBLUE;STICKLINE(BLANDC O,O,C,-1,1),COLORBLUE;
A1:=H =REF(H,1)ANDC
A2:=C
A3:=L
STICKLINE(A1,H,L,0,1),COLORGREEN;
STICKLINE(A1ANDC =O,O,C,-1,0),COLORGREEN;STICKLINE(A1ANDC O,O,C,-1,1),COLORGREEN;STICKLINE(A1AND
A2,H,L,0,1),COLORCYAN;
STICKLINE(A1ANDA2ANDC =O,O,C,-1,0),COLORCYAN;STICKLINE(A1ANDA2ANDC O,O,C,-1,1),COLORCYAN;
STICKLINE(A1ANDA2ANDA3,H,L,0,1),COLORBLUE;STICKLINE(A1ANDA2ANDA3ANDC =O,O,C,-1,0),COLORBLUE;
STICKLINE(A1ANDA2ANDA3ANDC O,O,C,-1,1),COLORBLUE;B1:=L =REF(L,1)ANDC REF(C,1);
B2:=C REF(C,2);
B3:=H REF(H,1);
STICKLINE(B1,H,L,0,1),COLORYELLOW;
STICKLINE(B1ANDC =O,O,C,-1,0),COLORYELLOW;STICKLINE(B1ANDC O,O,C,-1,1),COLORYELLOW;STICKLINE(B1
ANDB2,H,L,0,1),COLORMAGENTA;STICKLINE(B1ANDB2ANDC =O,O,C,-1,0),COLORMAGENTA;STICKLINE(B1ANDB2
ANDC O,O,C,-1,1),COLORMAGENTA;STICKLINE(B1ANDB2ANDB3,H,L,0,1),COLORRED;STICKLINE(B1ANDB2ANDB3
ANDC =O,O,C,-1,0),COLORRED;STICKLINE(B1ANDB2ANDB3ANDC O,O,C,-1,1),COLORRED;交易
线:MA(REF((C+O)/2,1),5),COLORDF00DF;
DRAWBAND(MA(CLOSE,5),RGB(100,0,0),MA(CLOSE,20),RGB(0,100,0));
DRAWKLINE(H,O,L,C);
PM:MA(C,5),COLORGRAY,LINETHICK1;
IF(PM
IF(PM =REF(PM,1),PM,DRAWNULL),COLORRED,LINETHICK2;
IF(PM=REF(PM,1),PM,DRAWNULL),COLORRED,LINETHICK2;
A:=MA(CLOSE,12)+ABS(MA(CLOSE,12)-REF(MA(CLOSE,12),1));
B:=MA(CLOSE,12)+MA(CLOSE,12)-REF(MA(CLOSE,12),1);
分⽔岭:=IF(MA(CLOSE,12)
操作线:=分⽔岭-(EMA(C,3)-分⽔岭);
AA:=CROSS(分⽔岭,操作线);
STICKLINE(AA,C,O,3,0),COLOR0000AA;
STICKLINE(AA,C,O,2,0),COLOR0033CC;
STICKLINE(AA,C,O,1,0),COLOR0055EE;
STICKLINE(AA,C,O,0.3,0),COLOR0099FF;
STICKLINE(AA,H,L,0,1),COLOR0099FF;
RR:=CROSS((MA(VOL,5)),(MA(VOL,10)))ANDMA(C,2) =MA(C,4);{ANDVOL =REF(VOL,1)}
STICKLINE(RR,C,O,3,0),COLOR0000AA;
STICKLINE(RR,C,O,2,0),COLOR0033CC;
STICKLINE(RR,C,O,1,0),COLOR0055EE;
STICKLINE(RR,C,O,0.3,0),COLOR0099EE;
STICKLINE(RR,H,L,0,1),COLOR0099FF;
MA5:MA(CLOSE,5),NODRAW;
MA20:MA(CLOSE,20),COLORFFCC66,LINETHICK2;
DRAWICON(CROSS(PM,MA20),L*0.9998,9);
MA5:MA(CLOSE,5),COLORCCCCCC,LINETHICK1;
MA10:MA(CLOSE,10),COLORGREEN,LINETHICK1;
MA20:MA(CLOSE,20),COLORLIBLUE,LINETHICK1;
MA30:MA(CLOSE,30),COLORMAGENTA,LINETHICK1;
MA60:MA(CLOSE,60),COLORFF8868,LINETHICK1;
MA120:MA(CLOSE,120),COLOR93DB70,LINETHICK1;
年:MA(CLOSE,250),COLORFF3399,LINETHICK2;
小99:EMA(C,99),POINTDOT,LINETHICK1,COLORYELLOW;
庄144:EMA(CLOSE,144),POINTDOT,LINETHICK1,COLORRED;
大318:MA(CLOSE,318),COLOR70DBDB,LINETHICK1;
超453:EMA(C,453),LINETHICK1,COLORCYAN;
底550:MA(CLOSE,550),COLORBLUE,LINETHICK2;
忙610:MA(CLOSE,610),COLOR777700,LINETHICK1;
奇730:MA(CLOSE,730),COLOREAADEA,LINETHICK1;
疯880:MA(CLOSE,880),COLOR781F87,LINETHICK2;
买线:=ZIG(3,10);
卖线:=MA(买线,2);
BU:=CROSS(买线,卖线);
SEL:=CROSS(卖线,买线);
DRAWTEXT(BU,L*0.99, ▲ ),LINETHICK3,COLORMAGENTA;
DRAWTEXT(SEL,H*1.0, ▼ ),LINETHICK3,COLORGREEN;
STICKLINE(CROSS(
STICKLINE(CROSS(
V10:=PEAKBARS(3,15,1)
V12:=IF(V10=1,50,0);
V9:=TROUGHBARS(3,15,1)
V11:=IF(V9=1,50,0);
DRAWTEXT(IF(IF(V11=50,50,0) REF(IF(V11=50,50,0),1),L,0),
L*0.96, ↖底 ),COLORMAGENTA;
卖线,买线),OPEN,CLOSE,7,0),COLORBLUE,LINETHICK3;
买线,卖线),OPEN,CLOSE,7,0),COLORMAGENTA,LINETHICK3;
VAREX:=MA(100*(CLOSE-LLV(CLOSE,34))/(HHV(HIGH,34)-
LLV(LOW,34)),5)-20;
VARFX:=100-3*SMA((CLOSE-LLV(LOW,75))/(HHV(HIGH,75)-
LLV(LOW,75))*100,20,1)+2*SMA(SMA
((CLOSE-LLV(LOW,75))/(HHV(HIGH,75)-
LLV(LOW,75))*100,20,1),15,1);
VAR10:=100-3*SMA((OPEN-LLV(LOW,75))/(HHV(HIGH,75)-
LLV(LOW,75))*100,20,1)+2*SMA(SMA
((OPEN-LLV(LOW,75))/(HHV(HIGH,75)-
LLV(LOW,75))*100,20,1),15,1);
VAR11:=VARFX REF(VAR10,1)ANDVOL REF(VOL,1)AND
CLOSE REF(CLOSE,1);
DRAWICON((ZIG(3,5) REF(ZIG(3,5),1))
(REF(ZIG(3,5),1) =REF(ZIG(3,5),2))
(REF(ZIG(3,5),2) =REF(ZIG(3,5),3)),LOW*0.98,1);
DRAWICON((ZIG(3,5) REF(ZIG(3,5),1))
(REF(ZIG(3,5),1) =REF(ZIG(3,5),2))
(REF(ZIG(3,5),2) =REF(ZIG(3,5),3)),HIGH*1.01,2);
VARE:=REF(LOW,1)*0.9;
VARF:=LOW*0.9;
AND
AND
AND
AND
VAR10X:=(VARF*VOL+VARE*(CAPITAL-VOL))/CAPITAL;
VAR11X:=EMA(VAR10,30);
VAR12:=CLOSE-REF(CLOSE,1);
VAR13:=MAX(VAR12,0);
VAR14:=ABS(VAR12);
VAR15:=SMA(VAR13,7,1)/SMA(VAR14,7,1)*100;
VAR16:=SMA(VAR13,13,1)/SMA(VAR14,13,1)*100;
VAR17:=BARSCOUNT(CLOSE);
VAR18:=SMA(MAX(VAR12,0),6,1)/SMA(ABS(VAR12),6,1)*100;
VAR19:=(-200)*(HHV(HIGH,60)-CLOSE)/(HHV(HIGH,60)-
LLV(LOW,60))+100;
VAR1A:=(CLOSE-LLV(LOW,15))/(HHV(HIGH,15)-
LLV(LOW,15))*100;
VAR1B:=SMA((SMA(VAR1A,4,1)-50)*2,3,1);
VAR1C:=(INDEXC-LLV(INDEXL,14))/(HHV(INDEXH,14)-
LLV(INDEXL,14))*100;
VAR1D:=SMA(VAR1C,4,1);
VAR1E:=SMA(VAR1D,3,1);
VAR1F:=(HHV(HIGH,30)-CLOSE)/CLOSE*100;
VAR20:=VAR18 =25ANDVAR19 -95ANDVAR1F 20AND
VAR1B -30ANDVAR1E 30ANDVAR11-CLOSE =-0.25AND
VAR15 22ANDVAR16 28ANDVAR17
VAR21:=(HIGH+LOW+CLOSE)/3;
VAR22:=(VAR21-MA(VAR21,14))/(0.015*AVEDEV(VAR21,14));
VAR23:=(VAR21-MA(VAR21,70))/(0.015*AVEDEV(VAR21,70));
VAR24:=IF(VAR22 =150
VAR25:=IF(VAR22 =-150ANDVAR22 -200ANDVAR23 =-
150ANDVAR23 -200,-10,VAR24);
DRAWTEXT(VAR20ANDCOUNT(VAR20,1)=1,H*0.99, $ ),
COLORMAGENTA;
DRAWTEXT(VAR24ANDCOUNT(VAR24,1)=1,L*1.1, $ ),
COLOR00FF00;
AAA2X:=EMA((H+C+O)/3,18);
STICKLINE(MA(C,13) OANDC MA(C,13)AND
ANDVAR22 200AND
VAR23 =150ANDVAR23 200,10,0);
O C,O,C,8,0),COLORYELLOW;
STICKLINE(MA(C,13) O
C MA(C,13),H,L,0.8,1),COLORYELLOW;
AAA2:=EMA((H+C+O)/3,18);
STICKLINE(MA(C,13) O
O C,O,C,8,0),COLORYELLOW;
STICKLINE(MA(C,13) O
C MA(C,13),H,L,0.8,1),COLORYELLOW;
A1:=REF(V,1);A2:=DVOL;A3:=A2/A1;
LNX:=A3-REF(A3,1),COLOR00CCCC,LINETHICK1;
E1:=REF(C,1);E2:=DCLOSE;E3:=(E2-E1)/E1*100;
QMX:=E3-REF(E3,1),COLOR00CCCC,LINETHICK2;
XG:=CROSS(LNX,500)ANDCROSS(QMX,10);
DRAWTEXT(XG=1,L*0.985, ↖↖∏ ),COLORFF8868;
20:=MA(CLOSE,20),COLORRED,LINETHICK1;
生命线:=MA(CLOSE,30),COLORWHITE,LINETHICK3;
多空趋势60:=MA(CLOSE,60),COLORLIBLUE,LINETHICK1;
AND
ANDC MA(C,13)AND
AND
半年线:=MA(CLOSE,120),COLORLIGREEN,LINETHICK1;
年线:=MA(CLOSE,250),COLORBLUE;
DRAWTEXT(CROSS(中线趋势20,生命线),生命线*0.98, ↖强
),COLORYELLOW,LINETHICK2;
DRAWTEXT(CROSS(生命线,多空趋势60),多空趋势60*0.98, ↖
牛 ),COLORYELLOW,LINETHICK2;
YF_DDI:=(AMOUNT/VOL);
YF_JJ:=((OPEN+CLOSE)/2);
YF_DDING:=EMA(CLOSE,6);
YF_MMD:=MA(YF_DDING,1);
YF_XXD:=EMA(CLOSE,18);
YF_YYZ:=REF(YF_MMD,1);
YF_XXD1:=REF(YF_XXD,1);
YF_YYZ1:=BARSCOUNT(CLOSE);
YF_TDCG:=IF((YF_YYZ1=1),0,(((YF_MMD-YF_YYZ)/YF_YYZ)*100));
YF_ZFD:=IF((YF_YYZ1=1),0,(((YF_XXD-YF_XXD1)/YF_XXD1)*100));
YF_JSD2:=REF(CLOSE,1);
CLOSE1:=IF((YF_YYZ1=1),0,(((CLOSE-YF_JSD2)/YF_JSD2)*100));
YF_JZDF:=IF((YF_YYZ1=1),((CLOSE+OPEN)/2),YF_YYZ);
JJ1:=REF(YF_MMD,2);
JJ2:=(((YF_MMD+YF_YYZ)+JJ1)/3);
JJ02:=(((ABS((YF_MMD-JJ2))+ABS((YF_YYZ-JJ2)))+ABS((JJ1-JJ2)))/3);
SY:=REF(YF_TDCG,1);
YF_ZFD1:=REF(YF_TDCG,2);
YF_ZFD2:=IF((YF_YYZ1 3),0,((JJ02/YF_MMD)*100));
YF_DHPXS:=IF((YF_YYZ1 3),0,IF((((YF_TDCG 0)AND(SY 0))AND(YF_ZFD1 0)),(0
-1),1));
SS:=REF(YF_TDCG,1);
YF_YZFZ:=IF((((YF_YYZ1 11)AND(SS 0))AND(YF_TDCG 0)),1,0);
YF_JSD21:=BARSLAST((YF_YZFZ=1));
YF_JSD:=REF(YF_JSD21,1);
A:=IF((((YF_YYZ1 11)AND(SS 0))AND(YF_TDCG 0)),(YF_JSD+1),YF_JSD);
YF_PJJ:=IF((((YF_YYZ1 11)AND(SS 0))AND(YF_TDCG 0)),1,0);
YF_JSD11:=YF_JZDF;
DMRJ:=YF_JZDF;
DMCJ:=IF(((YF_YYZ1 11)AND(YF_JSD11 OPEN)),OPEN,YF_JZDF);
YF_DMRJ:=IF(((YF_YYZ1 11)AND(DMRJ OPEN)),OPEN,YF_JZDF);
YF_DCG1:=REF(YF_JZDF,1);
YF_BDF5:=IF(((((YF_TDCG 0.5)AND((YF_ZFD2 0.215)OR(LOW YF_JZDF)))AND
(CLOSE =OPEN))AND((CLOSE =200)OR((CLOSE 200)AND(CLOSE1 11)))),1,0);
YF_DMRA:=IF((((YF_TDCG (0-0.3))AND((YF_ZFD2 0.2)OR(HIGH YF_JZDF)))AND
((OPEN =CLOSE)OR(CLOSE1 (0-1)))),1,0);
YF_DKS1:=BARSSINCE(YF_BDF5);
YF_TDMR:=BARSSINCE(YF_DMRA);
YF_DMRB:=(YF_DMRAORCONST(0));
YF_DCGJ1:=((COUNT(YF_BDF5,BARSLAST(YF_DMRB))=1)ANDYF_BDF5);
YF_DMRBUY:=((COUNT(YF_DMRB,BARSLAST(YF_BDF5))=1)ANDYF_DMRB);
YF_DMCSELL:=BARSLAST(YF_DMRBUY);
YF_DCG10:=BARSLAST(YF_DCGJ1);
YF_DCG11:=((SUM(YF_DMRBUY,YF_DCG10)=0)*YF_DCG10);
YF_DCGREAL:=REF(DMCJ,YF_DCG11);
YF_DMRJ11:=REF(YF_DCGREAL,1);
YF_DMRJ1:=IF((YF_DCGJ1=1),(((CLOSE-DMCJ)/DMCJ)*100),(((YF_DMRJ-
YF_DMRJ11)/YF_DMRJ11)*100));
YF_DCG:=IF((((YF_DCG11=0)AND(YF_DCGJ1=0))AND(YF_DMRBUY=
0)),0,YF_DMRJ1);
短买⼊:YF_DCGJ1,LINETHICK0;
短卖出:YF_DMRBUY,LINETHICK0;
短持股:YF_DCG11,LINETHICK0;
短买价:IF((短买⼊=1),YF_DCGREAL,IF(((短持股 0)OR(短卖出=
1)),YF_DMRJ11,0)),LINETHICK0;
短卖价:IF((短卖出=1),YF_DMRJ,0),LINETHICK0;
短操盘状态:IF((短买⼊=1),1,IF((短持股 0),2,IF((短卖出=1),9,0))),LINETHICK0;
明⽇空间点:EMA(CLOSE,6),LINETHICK0;
STICKLINE((短买⼊=1),OPEN,CLOSE,3,0),COLORMAGENTA;
DRAWICON((短买⼊=1),LOW*0.98,25);
STICKLINE((短持股 0),OPEN,CLOSE,3,0),COLORMAGENTA;
STICKLINE((短卖出=1),OPEN,CLOSE,3,0),COLORGREEN;
DRAWICON((短卖出=1),HIGH*1.02,27);