通达信公式源码概况:
指标类别:通达信公式
授权方式: 免费版
指标评级: ★★★★★
指标分类: 策略
画线方法: 副图
公式解读:
LONG:=26;
SHORT:=12;
M:=9;
DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:EMA(DIF,M),COLORBLUE,LINETHICK3;
MACD:2*(DIF-DEA),COLORSTICK;
A4:=BARSLAST(ref(cross(dif,dea),1));
B1:=ref(c,A4+1) candref(dif,A4+1) difandcross(dif,dea);
DRAWTEXT(FILTER(B1 0,5),dif+0.2, ),COLORyellow;
VAR1C:=(HIGH-MIN(OPEN,CLOSE));
VAR2C:=(CLOSE-OPEN);
VAR3C:=(MIN(OPEN,CLOSE)-LOW);
VAR4C:=(HIGH-LOW);
VAR5C:=((VOL*VAR1C)/VAR4C);
VAR6C:=((VOL*VAR2C)/VAR4C);
VAR7C:=((VOL*VAR3C)/VAR4C);
VAR8C:=((VAR5C-VAR6C)-VAR7C);
VAR4:=MA(CLOSE,5);
VAR5:=MA(CLOSE,10);
VAR6:=MA(CLOSE,30);
VAR7:=MA(CLOSE,60);
VAR8:=EMA(COST(85),7);
VAR9:=EMA(COST(15),7);
VARA:=(SUM(((CLOSE*VOL)*10),4)/SUM((VOL*200),4));
VARB:=(INTPART((VARA*10))/10);
VARC:=(SUM(((CLOSE*VOL)*10),7)/SUM((VOL*200),7));
VARD:=(INTPART((VARC*10))/10);
VARE:=(SUM(((CLOSE*VOL)*10),28)/SUM((VOL*200),28));
VARF:=(INTPART((VARE*10))/10);
:(EMA(CLOSE,5)-EMA(CLOSE,10)),COLORMAGENTA,LINETHICK2;
趋势:EMA(短线趋势,9),COLORMAGENTA,LINETHICK3;
VAR10:=((0-((10*(HHV(CLOSE,5)-CLOSE))/(HHV(CLOSE,5)-LLV(LOW,5))))+10);
VAR11:=((0-((10*(HHV(CLOSE,10)-CLOSE))/(HHV(CLOSE,10)-LLV(LOW,10))))+10);
VAR12:=((0-((10*(HHV(CLOSE,20)-CLOSE))/(HHV(CLOSE,20)-LLV(LOW,20))))+10);
VAR13:=((0-((10*(HHV(CLOSE,30)-CLOSE))/(HHV(CLOSE,30)-LLV(LOW,30))))+10);
VAR14:=REF(中线趋势,1);
VAR15:=中线趋势;
VAR16:=(VAR15-VAR14);
VAR17:=REF(短线趋势,1);
VAR18:=短线趋势;
VAR19:=(VAR18-VAR17);
VAR1A:=OPEN;
VAR1B:=CLOSE;
短线指标:IF(((((CROSS(短线趋势,中线趋势)AND(短线趋势 0))AND(中线趋势 (0-0.2)))and(var11 45))AND(VAR16 0)),0.3,0.1),COLOR66FF00;
{MACD}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),LINETHICK2,COLORWHITE;
D:SMA(K,3,1),LINETHICK2,COLOR00DDDD;
J:3*K-2*D,LINETHICK2,COLOR800080;
DIF:EMA(CLOSE,12)-EMA(CLOSE,26),LINETHICK0,COLOR0099FF;
DEA:EMA(DIF,9),LINETHICK0,COLORD89837;
MACD:2*(DIF-DEA),COLORFF9999,LINETHICK0;
YLZC:=IF(CLOSE=INDEXC,(INDEXC+INDEXH+INDEXL+INDEXO)/4,AMOUNT/(VOL+0.01)/100);
阻价:=IF(CLOSE=INDEXC,YLZC+INDEXC-INDEXL,YLZC+(CLOSE-LOW));
支价:=IF(CLOSE=INDEXC,INDEXL+INDEXC-YLZC,LOW+(CLOSE-YLZC));
今压:REF(阻价,1),LINETHICK0,COLORAA11BB;
今撑:REF(支价,1),LINETHICK0,COLOR009900;
明压:阻价,LINETHICK0;
明撑:支价,LINETHICK0;
RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;
KK:=SMA(RSV1,3,1);
DD:=SMA(KK,3,1);
JJ:=3*KK-2*DD;
:=IF(JJ =100,100,IF(JJ =0,0,JJ));
明天买:IF(买卖=100,0-10,0),COLOR00CCCC;
明天卖:IF(买卖=0,90,100),COLOR00FF00;
KX:=250;
KH:=HHV(K,KX);
DH:=HHV(D,KX);
JH:=HHV(J,KX);
KL:=LLV(K,KX);
DL:=LLV(D,KX);
JL:=LLV(J,KX);
HKMAX:=MAX(KH,MAX(DH,JH));
LKMIN:=MIN(KL,MIN(DL,JL));
KHLB:=(HKMAX+LKMIN)/2;
KHLC:=HKMAX-LKMIN;
MHF:=HHV(DIF,KX);
MHD:=HHV(DEA,KX);
MHM:=HHV(MACD,KX);
MLF:=LLV(DIF,KX);
MLD:=LLV(DEA,KX);
MLM:=LLV(MACD,KX);
HMAX:=MAX(MHF,MAX(MHD,MHM));
LMIN:=MIN(MLF,MIN(MLD,MLM));
FHLB:=(HMAX-LMIN)/100;
FHLC:=HMAX-LMIN;
SH:=(0-FHLB)*(KHLC/FHLC)+KHLB;
DIFA:=(DIF-FHLB)*(KHLC/FHLC)+KHLB;
DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;
MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;
CDA:=MACD REF(MACD,1)ANDMACD
CDB:=MACD =REF(MACD,1)ANDMACD
CDC:=MACD REF(MACD,1)ANDMACD
CDD:=MACD =REF(MACD,1)ANDMACD
STICKLINE(CDA,SH,MACDA,2,0),COLOR00AAFF;{黄色段}
STICKLINE(CDB,SH,MACDA,2,0),COLOR0000AA;{红色段}
STICKLINE(CDC,SH,MACDA,2,0),COLORAA00BB;{向上粉红}
TYP:=(HIGH+LOW+CLOSE)/3;
STICKLINE(DIF REF(DIF,1),20,20,2,0),COLORRED;
STICKLINE(DIF REF(DIF,1),20,20,2,0),COLORGREEN;
STICKLINE(K =REF(K,1)ORK DANDDIF REF(DIF,1),80,80,2,1),COLORRED;
STICKLINE(K REF(K,1),80,80,2,1),COLORGREEN;
MACD:=CROSS(MACD,DIF)ANDMACD =(0-0.05)ANDMACD =0.02;
DRAWTEXT(MACD金叉,MACDA*0.82, ▲MACD金叉 ),COLOR00FFFF;
XX:=EMA(MA(LOW,3)*0.96,30);
DIF金叉:=IF(CROSS(DIF,DEA)ANDXX-REF(XX,1) 0ANDMACD =REF(MACD,1)ANDDIF =0,1,0);
DRAWTEXT(DIF金叉=1,DIFA*1.68, DIF金叉 ),COLORCDFFBB;
低位金叉:=CROSS(DIF,DEA)ANDDIF -0.1;
DRAWTEXT(低位金叉,DEAA*0.99, ▲DIF低位金叉 ),COLOR0099DD;
DIFDEA:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA =0));
二次金叉:=CROSS(DIF,DEA)ANDDEA 0ANDCOUNT(DIFDEA=2,21)=1;
DRAWTEXT(二次金叉,DEAA*0.99-8, ▲DIF二次金叉 ),COLORFF00FF;
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,A1+1) CLOSEANDDIF REF(DIF,A1+1)ANDCROSS(DIF,DEA);
DRAWTEXT(底背离,DEAA*0.99-16, ▲DIF底背离 ),COLOR0099FF;
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶背离:=REF(CLOSE,A2+1) CLOSEANDREF(DIF,A2+1) DIFANDCROSS(DEA,DIF);
DRAWTEXT(FILTER(顶背离,5),DEAA*1.02, ▲DIF顶背离 ),COLORDDAAAA;
{周金叉,死叉}
周DIF:= MACD.DIF#WEEK
周DEA:= MACD.DEA#WEEK
周MACD:= MACD.MACD#WEEK
DIF周金叉:=CROSS(周DIF,周DEA);
DRAWTEXT(DIF周金叉,DEAA, DIF周金叉 ),COLOR0099FF;
DRAWTEXT(CROSS(周DEA,周DIF),DEAA+4, ▲DIF周死叉 ),COLORCDFFBB;
MACD周金叉:=CROSS(周MACD,周DIF)AND周MACD =(0-0.05)AND周MACD =0.02;
DRAWTEXT(MACD周金叉,MACDA-0.03, ▲MACD周金叉 ),COLOR00FFFF;
{月金叉,死叉}
月DIF:= MACD.DIF#MONTH
月DEA:= MACD.DEA#MONTH
DIF月金叉:=CROSS(月DIF,月DEA);
DRAWTEXT(DIF月金叉,DEAA*0.98, ★DIF月金叉 ),COLOR00FFCC;
DRAWTEXT(CROSS(月DEA,月DIF),DEAA*1.02, ★DIF月死叉
周K:= KDJ.K#WEEK (9,3,3);
周D:= KDJ.D#WEEK (9,3,3);
周J:= KDJ.J#WEEK (9,3,3);
月K:= KDJ.K#MONTH (9,3,3);
月D:= KDJ.D#MONTH (9,3,3);
月J:= KDJ.J#MONTH (9,3,3);
月金叉:=CROSS(月K,月D);
周金叉:=CROSS(周K,周D);
日金叉:=FILTER(CROSS(K,D)ANDK 20,4);
DRAWTEXT(月金叉,月D-2, ★ ),COLOR0022EE;
DRAWTEXT(月金叉,月D-2, .KD月金叉 ),COLORYELLOW;
DRAWTEXT(周金叉,周D, ★ ),COLOR0022EE;
DRAWTEXT(周金叉,周D, .KD周金叉 ),COLORGREEN;
DRAWICON(日金叉,K,1);
DRAWTEXT(日金叉,D-6, ★KD低位金叉 ),COLOR00CCCC;
DRAWTEXT(CROSS(周D,周K),周D*1.2, ★KD周死叉 ),COLOR00DDBB;
DRAWTEXT(CROSS(月D,月K),月D, ★KD月死叉 ),COLORFFFFFF;
KDB:=BARSLAST(REF(CROSS(K,D),1));
KDDB:=REF(CLOSE,KDB+1) CLOSEANDREF(K,KDB+1) KANDCROSS(K,D);
K底背:=IF(FILTER(KDDB 0,5),1,0);
DRAWTEXT(K底背=1,D*0.98, ★KD底背离 ),COLORDDDDDD;
KDD:=BARSLAST(REF(CROSS(D,K),1));
K顶背:=REF(CLOSE,KDD+1) CLOSEANDREF(K,KDD+1) KANDCROSS(D,K);
DRAWTEXT(FILTER(K顶背 0,5),D+8, ★KD顶背离 ),COLORFFAA22;
MD1:=MA(CLOSE,80)-MA(CLOSE,13)/3;
MD2:=MA((CLOSE-MD1)/MD1,3);
买点1:=CROSS(MD2,0)ANDLOW/REF(HIGH,1) 1.012ANDJ 75ANDJ REF(J,1);
MA12:=MA(CLOSE,12);
佳点:=IF(FILTER(MACD =REF(MACD,5)ANDOPEN =REF(CLOSE,1)ANDXX-REF(XX,1) 0ANDMACD =0ANDMA12-REF(MA12,1) =0,3)ANDJ 80ANDJ REF(J,1)ANDD REF(D,1)AND(DIF =REF(DIF,1)ORDEA =REF(DEA,1)),1,0);
DRAWTEXT(佳点=1,MACDA*0.98, ★佳点 ),COLOR0099FF;
DX0:=EMA(CLOSE,2)-EMA(OPEN,5);
DX1:=IF(CROSS(DX0,MACD)ANDLOW =XXANDMACD =(0-0.11)AND(J 20ORK 20),1,0);
DRAWTEXT(FILTER(DX1,3),0, ★短10% ),COLOR00CC00;{短线}
MA10:=MA(CLOSE,10);
SS:=EMA(MA(HIGH,3)*1.05,30);
LQS:=IF(FILTER(0.7*(CROSS(DIF,DEA)ANDCLOSE SSANDXX-REF(XX,1) 0ANDCROSS(MACD,0)ANDMACD =0ANDDIF 0ANDMA10-REF(MA10,1) 0ANDVOL REF(VOL,1)) =0.7AND(CLOSE SSANDXX-REF(XX,1) 0),5)ANDJ 80,1,0);
DRAWTEXT(LQS=1,MACDA*0.98, ★量价齐上 ),COLORCDFFDD;{量价齐上}
最佳点:=IF(COUNT(MD2 REF(MD2,1),3)=3ANDCOUNT(MD2 0,10)=10ANDREF(MD2,3)=LLV(MD2,10)ANDJ 80ANDJ REF(J,1),1,0);
DRAWTEXT(最佳点=1,J, ★最佳点 ),COLORFF00CC;
买点2:=REF(MD2,2)=LLV(MD2,20)ANDREF(MD2,2) 0.071ANDREF(MD2,2) REF(MD2,1)AND
NOT(REF(LOW,1) REF(HIGH,2)ANDLOW REF(HIGH,1))ANDCLOSE REF(CLOSE,1)ANDJ 75ANDJ REF(J,1);
DRAWTEXT(买点1OR买点2,D-1, 买 ),COLORFF00CC;
{预涨}
YZ:=(INTPART(SMA(RSV,3,1))+INTPART(SMA(K,3,1)))/2;
预涨:=CROSS(YZ,50)ANDJ 95ANDDIF REF(DIF,1)ANDLOW REF(CLOSE,1);
DRAWTEXT(预涨,D*0.6, ★预涨 ),COLORA52A2A;
ST:=STRFIND(stkname, ST ,1)
S:=STRFIND(stkname, S ,1)
停牌:=(DYNAINFO(4)=0);
AA:=C=HANDC/REF(C,1) 1.095;
放量:=HHV(V,20);
涨停:=REF(AA,1);
COUNT(涨停,4) =1ANDBARSLAST(放量) =5
ANDREF(C,2) REF(C,1)
ANDC/REF(C,1) 1.02and
not(ST)andnot(S)andnot(停牌)
andbarscount(close)
公式解读:
[源码注释]通达信公式动态公式解读
公式解读:
公式解读:
每日通达信公式解答:
编写条件:
每日上午11:30分以前任何时候涨停的公式。
编写方法:
ZTB:=IF(NAMELIKE( ST )ORNAMELIKE( *ST )ORNAMELIKE( SST )
ORNAMELIKE( S*ST )ORNAMELIKE( SST ),(C =ZTPRICE(REF(CLOSE,1),0.05)ANDC=H),
IF((CODELIKE( 688 )OR(CODELIKE( 300 )ANDDATE =1200824)),(C =ZTPRICE(REF(CLOSE,1),0.2)ANDC=H)
,(C =ZTPRICE(REF(CLOSE,1),0.1)ANDC=H)));
XG:ZTBANDFROMOPEN