MACD分时主图修订版通达信公式 主图 源码附图
DA:=YEAR AND MONTH AND DAY;
AA1:=STRCAT(CON2STR(YEAR,0),'年');
AA2:=STRCAT(CON2STR(MONTH,0),'月');
AA3:=STRCAT(CON2STR(DAY,0),'日');
AA4:=STRCAT('【',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF
(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))));
AA:=STRCAT(STRCAT(STRCAT(AA1,AA2),STRCAT(AA3,AA4)),'】');
DRAWTEXT_FIX(DA AND FROMOPEN<=120,0.88,0,0,AA),COLORBLUE;
DRAWTEXT_FIX(DA AND FROMOPEN>120,0,0,0,AA),COLORBLUE;
{分时MACD}
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=2*(DIF-DEA);
X:=CONST(HHV(ABS(C-DYNAINFO(3)),FROMOPEN))/CONST(HHV(ABS(DIF),FROMOPEN))*0.6;
DI:DIF*X+DYNAINFO(3),COLORCC00CC;
DE:DEA*X+DYNAINFO(3),COLOR00DD00;
MAC:=MACD*X;
STICKLINE(MAC>0,DYNAINFO( 3),MAC+DYNAINFO( 3),0,1),COLORRED;
STICKLINE(MAC<0,DYNAINFO( 3),MAC+DYNAINFO( 3),0,1),COLORCYAN;
{高点直线}
V1:=TIME;
T:=IF(V1<130000,(FLOOR(V1/10000)-9.5)*60+(FLOOR(V1/100)-100*FLOOR(V1/10000)),
(FLOOR(V1/10000)-11)*60+(FLOOR(V1/100)-100*FLOOR(V1/10000))),NODRAW;
KP30:=T<240;
KPGD:=H=HHV(H,0) AND KP30;
GDSJ:=BARSLAST(KPGD);
HHHH:REF(H,GDSJ),COLORYELLOW,POINTDOT,LINETHICK1;
{低点直线}
VQ1:=TIME;
TQ:=IF(VQ1<130000,(FLOOR(V1/10000)-9.5)*60+(FLOOR(VQ1/100)-100*FLOOR(VQ1/10000)),
(FLOOR(VQ1/10000)-11)*60+(FLOOR(VQ1/100)-100*FLOOR(VQ1/10000))),NODRAW;
KPQ30:=TQ<240;
KPGDQ:=L=LLV(L,0) AND KPQ30;
GDSJQ:=BARSLAST(KPGDQ);
HHHHQ:REF(L,GDSJQ),COLORCC00CC,POINTDOT,LINETHICK1;
{分时均价线和分时线}
最新:CLOSE,COLORWHITE;
AQA:=SUM(AMOUNT,BARSCOUNT(C))/SUM(VOL*100,BARSCOUNT(C));
DRAWTEXT( ISLASTBAR AND 最新>REF(最新,1),最新,STRCAT(' 涨▲',CON2STR(最新,2))),COLORMAGENTA;
DRAWTEXT( ISLASTBAR AND 最新<REF(最新,1),最新,STRCAT(' 跌▼',CON2STR(最新,2))),COLOR00FF00;
均价:SUM(V*C,0)/SUM(V,0),COLORGREEN,LINETHICK1;
IF(均价<=REF(均价,1),均价,DRAWNULL),COLORGREEN,LINETHICK3;
IF(均价>=REF(均价,1),均价,DRAWNULL),COLORYELLOW,LINETHICK3;
DRAWTEXT(CURRBARSCOUNT=8,均价,'均'),COLORYELLOW,LINETHICK3;
DRAWNUMBER(CURRBARSCOUNT=1,均价,均价),COLORYELLOW,LINETHICK3;
{板块概念}
DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.5,0,0,DYBLOCK),COLORWHITE;
DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.55,0,0,HYBLOCK),COLORYELLOW;
DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.6,0,0,GNBLOCK),COLORYELLOW;
DRAWTEXT_FIX(1 AND FROMOPEN>120,0.12,0,0,DYBLOCK),COLORWHITE;
DRAWTEXT_FIX(1 AND FROMOPEN>120,0.17,0,0,HYBLOCK),COLORYELLOW;
DRAWTEXT_FIX(1 AND FROMOPEN>120,0.21,0,0,GNBLOCK),COLORYELLOW;
未来函数检测结果如下:
该公式包含未来函数:DYNAINFO
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
DA赋值:YEAR AND MONTH AND DAY
AA1赋值:STRCAT(CON2STR(YEAR,0),'年')
AA2赋值:STRCAT(CON2STR(MONTH,0),'月')
AA3赋值:STRCAT(CON2STR(DAY,0),'日')
AA4赋值:STRCAT('【',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF
(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))))
AA赋值:STRCAT(STRCAT(STRCAT(AA1,AA2),STRCAT(AA3,AA4)),'】')
当满足条件DA AND FROM开盘价<=120时,在横轴0.88纵轴0位置书写文字
当满足条件DA AND FROM开盘价>120时,在横轴0纵轴0位置书写文字
{分时MACD}
DIF赋值:收盘价的12日指数移动平均-收盘价的26日指数移动平均
DEA赋值:DIF的9日指数移动平均
MACD赋值:2*(DIF-DEA)
X赋值:CONST(HHV(C-DYNAINFO(3的绝对值),FROM开盘价))/CONST(HHV(ABS(DIF),FROM开盘价))*0.6
输出DI:DIF*X+DYNAINFO(3),COLORCC00CC
输出DE:DEA*X+DYNAINFO(3),COLOR00DD00
MAC赋值:MACD*X
STICKLINE(MAC>0,DYNAINFO( 3),MAC+DYNAINFO( 3),0,1),画红色
STICKLINE(MAC<0,DYNAINFO( 3),MAC+DYNAINFO( 3),0,1),画青色
{高点直线}
V1赋值:TIME
T赋值:IF(V1<130000,(FLOOR(V1/10000)-9.5)*60+(FLOOR(V1/100)-100*FLOOR(V1/10000)),
(FLOOR(V1/10000)-11)*60+(FLOOR(V1/100)-100*FLOOR(V1/10000))),NODRAW
KP30赋值:T<240
KPGD赋值:H=0日内H最高值 AND KP30
GDSJ赋值:上次KPGD距今天数
输出HHHH:GDSJ日前的H,画黄色,POINTDOT,LINETHICK1
{低点直线}
VQ1赋值:TIME
TQ:=IF(VQ1<130000,(FLOOR(V1/10000)-9.5)*60+(FLOOR(VQ1/100)-100*FLOOR(VQ1/10000)),
(FLOOR(VQ1/10000)-11)*60+(FLOOR(VQ1/100)-100*FLOOR(VQ1/10000))),NODRAW
KPQ30赋值:TQ<240
KPGDQ:=L=0日内L最低值 AND KPQ30
GDSJQ:=上次KPGDQ距今天数
HHHHQ:GDSJQ日前的L,COLORCC00CC,POINTDOT,LINETHICK1
输出{分时均价线和分时线}
最新:收盘价,COLORWHITE
AQA赋值:SUM(AMOUNT,C的有效数据周期数)/SUM(成交量*100,C的有效数据周期数)
DRAWTEXT( ISLASTBAR AND 最新>1日前的最新,最新,STRCAT(' 涨▲',CON2STR(最新,2))),COLORMAGENTA
DRAWTEXT( ISLASTBAR AND 最新<1日前的最新,最新,STRCAT(' 跌▼',CON2STR(最新,2))),COLOR00FF00
输出均价:0的V*C日累和/0的V日累和,画绿色,LINETHICK1
IF(均价<=1日前的均价,均价,DRAWNULL),画绿色,LINETHICK3
IF(均价>=1日前的均价,均价,DRAWNULL),画黄色,LINETHICK3
当满足条件CURRBARSCOUNT=8时,在均价和'均'位置书写文字
DRAWNUMBER(CURRBARSCOUNT=1,均价,均价),画黄色,LINETHICK3
当满足条件1 AND FROM开盘价<=120时,在横轴0.5纵轴0位置书写文字
当满足条件1 AND FROM开盘价<=120时,在横轴0.55纵轴0位置书写文字
当满足条件1 AND FROM开盘价<=120时,在横轴0.6纵轴0位置书写文字
当满足条件1 AND FROM开盘价>120时,在横轴0.12纵轴0位置书写文字
当满足条件1 AND FROM开盘价>120时,在横轴0.17纵轴0位置书写文字
当满足条件1 AND FROM开盘价>120时,在横轴0.21纵轴0位置书写文字