内容导航:
1、指标公式
2、
3、
4、
公式解读:
通达信指标公式源码概况:
指标类别: 通达信指标公式
授权方式: 免费版
指标评级: ★★★★★
指标分类: 策略
画线方法: 副图
_K:= KDJ.K (39,3,3);KDJ_D:= KDJ.D (39,3,3);KDJ_J:= KDJ.J (39,3,3);
买1:=CROSS(KDJ_J,15)OR(CROSS(KDJ_J,KDJ_K)ANDKDJ_D
买2:=CROSS( .RSI1 (6,2,2),20)ORKDJ_D 50ANDCROSS( RSI.RSI1 (6,12,24), RSI.RSI2 (6,12,24));
买3:=CROSS( MACD.DIF , MACD.DEA )ANDKDJ_D 55ORCROSS( MACD.MACD ,0);
买0:=买1+买2+买3;
买:IF(买0 1,买0,0);
MID:=REF(H+C,1)/2;
CR:SUM(MAX(0,HIGH-MID),13)/SUM(MAX(0,MID-L),13)*233,COLORFFFFFF;
MA1:REF(MA(CR,8),3),COLOR00FFFF;
MA2:REF(MA(CR,13),5),COLORFF00FF;
MA3:REF(MA(CR,21),8),COLOR00FF00;
MA4:REF(MA(CR,34),13),COLOR0066CC;
N:=14;
M:=6;
ADXP:=1;
TR1:=SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),N);
HD:=HIGH-REF(HIGH,1);
LD:=REF(LOW,1)-LOW;
DMP:=SUM(IF(HD 0ANDHD LD,HD,0),N);
DMM:=SUM(IF(LD 0ANDLD HD,LD,0),N);
PDI:DMP*100/TR1;
MDI:DMM*100/TR1;
ADX:MA(ABS(MDI-PDI)/(MDI+PDI)*100,M);
ADXR:(ADX+REF(ADX,M))/2;
{传统MDI加进四条线两句话较好}
CD0:20;
CD1:40;
TD0:60;
TD1:80;
DRAWTEXT(CROSS(PDI,CD0),CD0, ●金 ),COLORMAGENTA;
DRAWTEXT(CROSS(TD0,PDI),PDI, ●死 ),COLORBLUE;
DRAWTEXT(CROSS(ADX,CD0),CD0, ●金 ),COLORMAGENTA;
DRAWTEXT(CROSS(TD0,ADX),ADX, ●死 ),COLORBLUE;
DRAWTEXT(CROSS(PDI,MDI),MDI, ★金 ),COLORYELLOW;
DRAWTEXT(CROSS(MDI,PDI),PDI, ★死 ),COLORGREEN;
DRAWTEXT(CROSS(ADX,ADXP),ADXP, ★金 ),COLOR000999;
DRAWTEXT(CROSS(ADXP,ADX),ADX, ★死 ),COLORCYAN;
DRAWTEXT(CURRBARSCOUNT=35,80.1, 梦的海洋友情提示: ),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=35,76, PDI线上穿20介入,下破60急出手 ),COLORBLUE;
DRAWTEXT(CURRBARSCOUNT=35,69.1, ADX线上穿20介入,下破60急出手 ),COLORCYAN;
DRAWTEXT(CURRBARSCOUNT=35,64.1, 如果回调幅度在0.618内属强势调整后市方向不会改变 ),COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=35,59.1, 如果回调超过在0.618后市方向可能逆转: ),COLORBLUE;
DRAWTEXT(CURRBARSCOUNT=35,54.1, 如果反弹高度在0.382内属反弹行情后市方向不会改变: ),COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=35,50, 如果反弹超过在0.382后市方向可能逆转: ),COLORBLUE;
DIF:(EMA(CLOSE,12)-EMA(CLOSE,26));
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK;
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
上0:=CROSS(CCI,0);
卖:=CROSS(100,CCI);
买:=CROSS(CCI,-100);
DRAWICON(上0,MACD*1.2,12);DRAWICON(卖,MACD*1.2,13);DRAWICON(买,MACD*1.2,7);
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),COLORSTICK;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1) CANDREF(DIFF,A1+1) DIFFANDCROSS(DIFF,DEA);
A2:=BARSLAST(REF(CROSS( KDJ.K (9,3,3), KDJ.D (9,3,3)),1));
B2:=REF(C,A2+1) CANDREF( KDJ.K (9,3,3),A2+1) KDJ.K (9,3,3)ANDCROSS( KDJ.K (9,3,3), KDJ.D (9,3,3));
A3:=BARSLAST(REF(CROSS( RSI.RSI1 (6,12,24), RSI.RSI2 (6,12,24)),1));
B3:=REF(C,A3+1) CANDREF( RSI.RSI1 (6,12,24),A3+1) RSI.RSI1 (6,12,24)ANDCROSS( RSI.RSI1 (6,12,24), RSI.RSI2 (6,12,24));
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1)DIFFANDCROSS(DEA,DIFF);
C2:=BARSLAST(REF(CROSS( KDJ.D (9,3,3), KDJ.K (9,3,3)),1));
D2:=REF(C,C2+1) KDJ.K (9,3,3)ANDCROSS( KDJ.D (9,3,3), KDJ.K (9,3,3));
C3:=BARSLAST(REF(CROSS( RSI.RSI2 (6,12,24), RSI.RSI1 (6,12,24)),1));
D3:=REF(C,C3+1) RSI.RSI1 (6,12,24)ANDCROSS( RSI.RSI2 (6,12,24), RSI.RSI1 (6,12,24));
MACD底背:IF(B1 0,-0.1,0),COLORRED,POINTDOT;
KDJ底背:IF(B2 0,-0.1,0),COLORFF00FF,POINTDOT;
RSI底背:IF(B3 0,-0.1,0),COLORYELLOW,POINTDOT;
MACD顶背:IF(D1 0,0.1,0),COLOR00FF00,POINTDOT;
KDJ顶背:IF(D2 0,0.1,0),COLORFFCC66,POINTDOT;
RSI顶背:IF(D3 0,0.1,0),COLORWHITE,POINTDOT;
STICKLINE(B1 0,-0.1,0,2,0),COLORRED;
STICKLINE(B2 0,-0.1,0,2,0),COLORFF00FF;
STICKLINE(B3 0,-0.1,0,2,0),COLORYELLOW;
STICKLINE(D1 0,0.1,0,2,0),COLOR00FF00;
STICKLINE(D2 0,0.1,0,2,0),COLORFFCC66;
STICKLINE(D3 0,0.1,0,2,0),COLORWHITE;
公式解读:
[源码注释]通达信公式动态公式解读SJ赋值:1
顶周期赋值:20
底周期赋值:20
上内赋值:顶周期日内最高价距今天数
上外赋值:顶周期日内最低价距今天数
下内赋值:底周期日内最低价距今天数
下外赋值:底周期日内最高价距今天数
上力度赋值:上内+1日内最低价的最高值 上内+1日内最高价的最低值
下力度赋值:下内+1日内最低价的最高值 下内+1日内最高价的最低值
上包含赋值:统计上外日中满足最低价 =1日前的最低价的天数 2 AND 统计上内日中满足最高价 =1日前的最高价的天数 2
下包含赋值:统计下外日中满足最高价 =1日前的最高价的天数 2 AND 统计下内日中满足最低价 =1日前的最低价的天数 2
顶0赋值: 上力度 AND 上包含 AND 上外 3
底0赋值: 下力度 AND 下包含 AND 下外 3
顶赋值:顶0 AND 最高价=上次底0距今天数日内最高价的最高值 AND 上次底0距今天数 3
底赋值:底0 AND 最低价=上次顶0距今天数日内最低价的最低值 AND 上次顶0距今天数 3
当满足条件若顶则将最近上次底距今天数+1周期置为1上穿0.5时,在最低价位置画直线起点,当满足条件若底则将最近上次顶距今天数+1周期置为1上穿0.5时,在最高价位置画直线终点,0表示是否延长.,画红色,线宽为3
当满足条件若底则将最近上次顶距今天数+1周期置为1上穿0.5时,在最高价位置画直线起点,当满足条件若顶则将最近上次底距今天数+1周期置为1上穿0.5时,在最低价位置画直线终点,0表示是否延长.,画绿色,线宽为2
SAT:=IF((AMOUNT/C)/(HHV(AMOUNT,20)/HHV(C,20))*100 100,100,(AMOUNT/C)/(HHV(AMOUNT,20)/HHV(C,20))*100);
AA10:MA(CLOSE,8),COLOR0000FF;AA12:MA(CLOSE,12),COLOR0000FF;BB10:=((ATAN((AA10-REF(AA10,1)))*3.1416)*10);
BB12:=((ATAN((AA12-REF(AA12,1)))*3.1416)*10);MA13:=MA(CLOSE,13);
STICKLINE((((AA12 =aa10)and(bb12 =1))AND(BB10 =1)),AA10,AA12,4,0),COLOR0080FF;
STICKLINE((((AA12 =AA10)AND(BB10 =1))AND(BB10 =1)),AA10,AA12,4,0),COLOR00FF00;
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;压力:MA(REF(HHV(C,30),1),2),COLOR9DFFFF;
支撑:MA(REF(LLV(C,30),1),2),COLORABFF46;AA1:=AMOUNT/V;BB1:=L AA1*0.9;
CC1:=(C-REF(C,1))/REF(C,1)*100 DD1:=L MA(C,5)*0.921;EE1:=V MA(V,5)*1.5;
A51:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1);
线:=EMA(A51,5);A54:=((C-LLV(L,21))/(HHV(H,21)-LLV(L,21)))*100;
趋势线:=(MA(3*SMA(A54,6,1)-2*SMA(SMA(A54,5,1),5,1),2));
LC:=REF(CLOSE,1);RSI:=((SMA(MAX((CLOSE-LC),0),3,1)/SMA(ABS((CLOSE-LC)),3,1))*100);
VAR2:=LLV(LOW,27);VAR3:=HHV(HIGH,34);VAR4:=EMA((CLOSE-VAR2)/(VAR3-VAR2)*4,4)*25;
MTM:=C-REF(C,1);DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);
趋势线:MA(C,30),DOTLINECOLORFF00CC;
IF(趋势线 =REF(趋势线,1),趋势线,DRAWNULL),DOTLINE,COLORYELLOW;
回归斜率线A:EMA(SLOPE(C,21)*20+C,42);
回归斜率线B:REF(回归斜率线A,2);
IF(回归斜率线A REF(回归斜率线A,1),回归斜率线A,DRAWNULL),COLORRED;
IF(回归斜率线A REF(回归斜率线A,1),回归斜率线A,DRAWNULL),COLORGREEN;
IF(回归斜率线B REF(回归斜率线B,1),回归斜率线B,DRAWNULL),COLORRED;
IF(回归斜率线B REF(回归斜率线B,1),回归斜率线B,DRAWNULL),COLORGREEN;
经典RL:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
经典K:=SMA(经典RL,3,1);经典D:=SMA(经典K,3,1);经典J:=3*经典K-2*经典D;
MAHL1:=100*((EMA((H+L)/2,3)-LLV(EMA((H+L)/2,5),30)-(EMA(H,20)-EMA(L,20)))/(LLV(EMA((H+L)/2,5),30)-(EMA(H,20)-EMA(L,20))));
MAHL2:=IF(EMA(C,2) 回归斜率线AANDMAHL1 0,EMA(C,3),LLV(EMA((H+L)/2,5),30));{A}
MAHL3:=IF(EMA(C,2) 回归斜率线AANDMAHL1 0,LLV(EMA((H+L)/2,5),30),EMA(C,5));{A}
{回归斜率带:DRAWBAND(回归斜率线A,RGB(235,0,230),REF(回归斜率线A,2),RGB(0,104,154));}
{C 昨C红K柱+C O红K柱C 昨C红K柱C=昨C是跟白色24线
C 昨c蓝k柱+c O红K柱C 昨C蓝K柱}
{STICKLINE(CLOSE REF(CLOSE,1),HIGH,LOW,0,0),COLORRED;
STICKLINE(CREF(C,1),C,O,3,0),COLORFFCC00;}
{STICKLINE(CLOSE REF(CLOSE,1)ANDC O,OPEN,CLOSE,2.1,0),COLOR000099;
STICKLINE(CLOSE REF(CLOSE,1),OPEN,CLOSE,1.5,0),COLOR0000BB;
STICKLINE(CLOSE REF(CLOSE,1),OPEN,CLOSE,0.9,0),COLOR0000DD;
STICKLINE(CLOSE REF(CLOSE,1),OPEN,CLOSE,0.3,0),COLOR0000FF;}
STICKLINE(CLOSE=REF(CLOSE,1),H,L,3,1),COLOR999999;
STICKLINE(CLOSE=REF(CLOSE,1),HIGH,LOW,0,0),COLORWHITE;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,3,0),COLOR555555;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,2.7,0),COLOR777777;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,2.1,0),COLOR999999;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,1.5,0),COLORBBBBBB;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,0.9,0),COLORDDDDDD;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,0.3,0),COLORFFFFFF;
{STICKLINE(CLOSE REF(CLOSE,1),HIGH,LOW,0,1),COLORCYAN;
STICKLINE(CO,C,O,3,0),COLORFFCC00;
STICKLINE(C REF(C,1)ANDC O,OPEN,CLOSE,3,0),COLOR990000;
STICKLINE(C REF(C,1)ANDC O,OPEN,CLOSE,2.7,0),COLORCC0000;
STICKLINE(CLOSE REF(C,1),OPEN,CLOSE,2.1,0),COLORFF4400;
STICKLINE(CLOSE REF(C,1),OPEN,CLOSE,1.5,0),COLORFF8800;
STICKLINE(CLOSE REF(C,1),OPEN,CLOSE,0.9,0),COLORFFCC00;}
{经典KDJ买:IF(CROSS(经典K,经典D),(L-(H-L)/2),DRAWNULL),POINTDOT,LINETHICK6,COLOR0000FF;
经典KDJ买:IF(CROSS(经典K,经典D),(L-(H-L)/2),DRAWNULL),POINTDOT,LINETHICK6,COLOR0000FF;}
DRAWICON(CROSS(经典K,经典D),L*0.96,26);
{高亮红}
回归斜率买:IF(CROSS(EMA(C,3),回归斜率线A),(L-(H-L)/3),DRAWNULL),POINTDOT,COLOR0000FF;{高亮红}
回归斜率买_:DRAWICON(CROSS(EMA(C,3),回归斜率线A),L*0.98,1),{买};
回归斜率卖:IF(CROSS(回归斜率线A,EMA(C,2)),(H+(H-L)/3),DRAWNULL),POINTDOT,COLOR00CF00;{中绿}
卖:DRAWICON(CROSS(回归斜率线A,EMA(C,2)),H*1.03,2);
经典KDJ卖:IF(CROSS(经典D,经典K),(H+(H-L)/2),DRAWNULL),CROSSDOT,LINETHICK3,COLOR00CF00;{中绿};
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,9,1);
D:=SMA(K,9,1);
J:=3*K-2*D;
X2:=LLV(J,2)=LLV(J,8);
{DRAWTEXT(CROSS(J,REF(J+0.01,1))ANDX2ANDJ 20,LOW*0.99, ★买 ),COLORYELLOW;}
DRAWICON(CROSS(J,REF(J+0.01,1))ANDX2ANDJ 20,LOW*0.99,23);
VAR6:=REF(C,1);
VAR7:=SMA(MAX(C-VAR6,0),6,1)/SMA(ABS(C-VAR6),6,1)*100;
DRAWTEXT(CROSS(84,VAR7),H*1.01, ),COLORYELLOW;
AA:=(REF(H,1)-MAX(REF(C,1),REF(O,1)))/(REF(H,1)-REF(L,1)) 0.6AND(MIN(O,C)-L)/(H-L) 0.6ANDVOL REF(VOL,1);
DRAWTEXT(AA,L*0.99, 揉搓 ),COLORRED;
C3:=REF(C,1);
跌停:=IF((C3-C)*100/C3 =(10-0.01*100/C3),1,0);
STICKLINE(跌停,OPEN,CLOSE,3,0),COLORBLUE;
STICKLINE(跌停,OPEN,CLOSE,2,0),COLORGREEN;
{DRAWTEXT(跌停,H+0.1, 跌停 ),COLORGREEN;}
:=IF(REF(C,1)*1.095-C 0.01,1,0);
STICKLINE(涨停,OPEN,CLOSE,3,0),COLORRED;
STICKLINE(涨停,OPEN,CLOSE,2,0),COLORYELLOW;
{DRAWTEXT(涨停,L-0.1, 板 ),COLORYELLOW;}
M1:=EMA(EMA(C,21),3);
M2:=EMA(EMA(C,34),3);
TT2:=CROSS(C,M1)ANDCROSS(C,M2);
DRAWTEXT(TT2,L*0.96, 阳
RSI6:SMA(MAX(C-REF(C,1),0),6,1)/SMA(ABS(C-REF(C,1)),6,1)*100,colorwhite;
DIFF:=EMA(C,6)-EMA(C,10);DEA:=EMA(DIFF,5);
MACD:800*(DIFF-DEA)/EMA(C,30),colorSTICK,linethick3;
RSV:=(C-LLV(L,20))/(HHV(H,20)-LLV(L,20))*100;
K20:SMA(RSV,5,1),COLORyellow;
D20:SMA(K20,5,1),COLORFF00ff;
20;50;80;
{80,COLORRED;20;VAR6:=(2*C+H+L)/4;
VAR8:=LLV(L,34);VAR11:=HHV(H,34);
VAR12:=EMA((VAR6-VAR8)/(VAR11-VAR8)*100,13);
VAR13:EMA(0.667*REF(VAR12,1)+0.333*VAR12,2),COLORRED;
STICKLINE(VAR12 VAR13,VAR12,VAR13,8,0),COLOR00FF0F;
STICKLINE(VAR12 VAR13,VAR12,VAR13,8,0),COLORRED;
差值:(VAR12-VAR13)*5,POINTDOT,COLOR33CC00;
STICKLINE(差值 =0,0,差值,3,0),COLORYELLOW;
STICKLINE(差值 =0,0,差值,4,0),COLORGREEN;
RSV:=(C-LLV(L,34))/(HHV(H,34)-LLV(L,34))*100;
K:SMA(RSV,3,1);D:SMA(K,3,1);};
股票公式编写要求:
今日MACD刚翻红,近3日任何一天有一根涨幅大于5%阳线的公式。
股票公式编写结果:
XG:CROSS(MACD.MACD 0,0.5)ANDEXIST((C/REF(C,1)-1)*100 5,3);