最新公告
  • 欢迎您光临九毛八公式指标网www.9m8.cn,本站全新改版试运行,期间内容全部免费,欢迎下载!欢迎加入本站VIP
  • 变色kdj买卖指标公式(kdj主图指标公式)

    正文概述    2024-05-04 04:30:46  


    通达信指标公式源码概况:


    指标类别: 通达信指标公式


    授权方式: 免费版


    指标评级: ★★★★★


    指标分类: 策略


    画线方法: 副图



    一、变色指标公式


     

    LC := REF(CLOSE,1);

    R:SMA(MAX(CLOSE-LC,0),9,1)/SMA(ABS(CLOSE-LC),9,1)*10;

    K:=r-REF(r,1);

    STICKLINE(k REF(k,1) AND R 3 AND (k 0 OR REF(k,1) 0),3,5,2),colorred;

    STICKLINE(k REF(k,1)AND R 5.5,5,7,2),colorgreen;

    x:=(k REF(k,1) AND R 3.0 AND (k 0 OR REF(k,1) 0))*8;

    y:=((k REF(k,1)AND R 5.5) 0)*8; 

    N:=14; 

    M:=6; 

    MTR:=EXPMEMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),14); 

    HD:=HIGH-REF(HIGH,1); 

    LD:=REF(LOW,1)-LOW; 

    DMP:=EXPMEMA(IF(HD 0 amp; amp;HD LD,HD,0),14); 

    DMM:=EXPMEMA(IF(LD 0 amp; amp;LD HD,LD,0),14); 

    PDI:DMP*100/MTR,LINETHICK0; 

    MDI:DMM*100/MTR,LINETHICK0; 

    STICKLINE(PDI =MDI,50,50+(PDI-MDI),0.5,0),COLORRED; 

    STICKLINE(PDI MDI,50,50-(MDI-PDI),0.5,1),COLOR00FF00; 

    ADX:EXPMEMA(ABS(MDI-PDI)/(MDI+PDI)*100,6),COLORRED,LINETHICK0; 

    ADXR:EXPMEMA(ADX,6),COLORFF00FF,LINETHICK0; 

    DRAWBAND(ADX,RGB(220,0,0),ADXR,RGB(20,240,240)); 

    STICKLINE(C 0,100,105,3,1),COLORFFFF00; 

    STICKLINE(ADX =ADXR,100,105,3,0),COLOR0000FF; 

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

    K:SMA(RSV,3,1),LINETHICK0; 

    D:SMA(K,3,1),LINETHICK0; 

    J:3*K-2*D,COLOR00FF00,LINETHICK1; 

    DRAWBAND(K,RGB(220,0,220),D,RGB(180,140,140)); 

    STICKLINE(C 0,0,-5,3,1),COLORFFFF00; 

    STICKLINE(K =D,0,-5,3,0),COLORFF00FF; 

    DRAWTEXT(CURRBARSCOUNT=8,100, ADXADXR ),COLORFFFF00; 

    DRAWTEXT(CURRBARSCOUNT=7,-7, KDJ金叉 ),COLORFFFF00; 

    DRAWTEXT(CURRBARSCOUNT=6,55, PDI与MDI ),COLORFFFF00; 

    X_1:=IF(PERIOD=5,240,IF(PERIOD=4,60,IF(PERIOD=3,30,IF(PERIOD=2,15,IF(PERIOD=1,5,DRAWNULL))))); 

    X_2:=IF(ISLASTBAR,VOL*X_1/MOD(FROMOPEN,X_1),DRAWNULL); 

    STICKLINE(ISLASTBAR,X_2,0,(-1),(-1)),COLORDDDDDD; 

    STICKLINE(CLOSE REF(CLOSE,1),0,VOL,(-2),1),COLOR3030FF; 

    STICKLINE(CLOSE REF(CLOSE,1),0,VOL,(-2),0),COLORFFFF40; 

    STICKLINE(CLOSE=REF(CLOSE,1),0,VOL,(-2),1),COLORWHITE; 

    V5:MA(VOL,5),COLORGRAY; 

    PM:MA(VOL,5),COLORGRAY; 

    IF(PM REF(PM,1),PM,DRAWNULL),COLORGRAY,LINETHICK0; 

    IF(PM =REF(PM,1),PM,DRAWNULL),COLORRED,LINETHICK2; 

    IF(PM=REF(PM,1),PM,DRAWNULL),COLORRED,LINETHICK2; 

    V10:MA(VOL,10),COLORYELLOW; 

    PM1:MA(VOL,10),COLORYELLOW; 

    IF(PM1 REF(PM1,1),PM1,DRAWNULL),COLORYELLOW,LINETHICK0; 

    IF(PM1 =REF(PM1,1),PM1,DRAWNULL),COLORRED,LINETHICK2; 

    IF(PM1=REF(PM1,1),PM1,DRAWNULL),COLORRED,LINETHICK2; 

    V60:MA(VOL,60),COLORRED,LINETHICK2; 

    PM2:MA(VOL,60),COLORRED; 

    IF(PM2 REF(PM2,1),PM2,DRAWNULL),COLORRED,LINETHICK0; 

    IF(PM2 =REF(PM,1),PM2,DRAWNULL),COLORGREEN,LINETHICK2; 

    IF(PM2=REF(PM2,1),PM2,DRAWNULL),COLORGREEN,LINETHICK2; 

    量是肯定:VOL/V60; 

    {------K线-----------} 

    X1:=(2*CLOSE+LOW+HIGH+OPEN)/5; 

    XCLOSE:=EMA(X1,3); 

    XOPEN:=EMA((REF(OPEN,1)+REF(XCLOSE,1))/2,3); 

    STICKLINE(XOPEN XCLOSE,REFDATE(HHV(H,0),DATE),REFDATE(LLV(L,0),DATE),6,0),COLOR003303;{-------KD背景------}; 

    {买卖K线} 

    STICKLINE(XOPEN =XCLOSE,H,L,0,0),COLORCYAN; 

    STICKLINE(XOPEN =XCLOSE,C,O,3.5,0),COLORFF4400; 

    STICKLINE(XOPEN =XCLOSE,C,O,3,0),COLORFF8800; 

    STICKLINE(XOPEN =XCLOSE,C,O,2,0),COLORFFCC00; 

    STICKLINE(XOPEN =XCLOSE,C,O,1,0),COLORCYAN; 

    STICKLINE(XOPEN XCLOSE,H,L,0,0),COLOR00FFFF; 

    STICKLINE(XOPEN XCLOSE,C,O,3.5,0),COLOR009999; 

    STICKLINE(XOPEN XCLOSE,C,O,3,0),COLOR0099BB; 

    STICKLINE(XOPEN XCLOSE,C,O,2,0),COLOR0099DD; 

    STICKLINE(XOPEN XCLOSE,C,O,1,0),COLOR0099FF; 

    VAR9Q:=C=HHV(C,4)AND(REF(C,1) =REF(C,2)ORREF(C,1) =REF(C,3))ORREF(C,1)=HHV(C,4)ANDCLOSE =REF(C,2)ORREF(C,2)=HHV(C,4)ANDREF(C,3)=LLV(C,4)ANDC =REF(C,1)ORREF(C,3)=HHV(C,4)ANDC =REF(C,1)ANDC =REF(C,2); 

    STICKLINE(VAR9Q,H,L,0,0),COLOR0000FF; 

    STICKLINE(VAR9Q,C,O,3.5,0),COLOR0000CC; 

    STICKLINE(VAR9Q,C,O,3,0),COLOR0000DD; 

    STICKLINE(VAR9Q,C,O,2,0),COLOR0000EE; 

    STICKLINE(VAR9Q,C,O,1,0),COLOR0000FF; 

    VARCQ:=REF(C,1)=LLV(C,4)ANDC =REF(C,2)ORREF(C,2)=LLV(C,4)ANDREF(C,1) =REF(C,3)ANDREF(C,2) REF(C,4)ANDC =REF(C,1); 

    STICKLINE(VARCQ,H,L,0,0),COLOR00FF00; 

    STICKLINE(VARCQ,O,C,3.5,0),COLOR00CC00; 

    STICKLINE(VARCQ,O,C,3,0),COLOR00DD00; 

    STICKLINE(VARCQ,O,C,2,0),COLOR00EE00; 

    STICKLINE(VARCQ,O,C,1,0),COLOR00FF00; 

    VARDQ:=REF(C,1)=HHV(C,4)ANDC REF(C,2)OR(REF(C,2)=HHV(C,4)ANDREF(C,1) REF(C,3)ORREF(C,3)=HHV(C,4)ANDREF(C,1) REF(C,2))ANDREF(C,2) =REF(C,4)ANDC REF(C,1); 

    STICKLINE(VARDQANDC O,H,L,0,0),COLORFF9900; 

    STICKLINE(VARDQANDC O,O,C,3.5,0),COLORFF2200; 

    STICKLINE(VARDQANDC O,O,C,3,0),COLORFF4400; 

    STICKLINE(VARDQANDC O,O,C,2,0),COLORFF6600; 

    STICKLINE(VARDQANDC O,O,C,1,0),COLORFF8800; 

    {变色彩带} 

    VAR1:=(2*CLOSE+HIGH+LOW)/4; 

    A1:(EMA(VAR1,2)+EMA(VAR1,3)+EMA(VAR1,5)+EMA(VAR1,8)+EMA(VAR1,11)+EMA(VAR1,13))/6.4,COLORFF9900,LINETHICK3; 

    A2:EMA(A1,2),COLORFF9900; 

    A3:EMA(A2,2),COLORFF9900; 

    A4:EMA(A3,2),COLORFF9900; 

    A5:EMA(A4,2),COLORFF9900; 

    A6:EMA(A5,2),COLORFF9900; 

    A7:EMA(A6,2),COLORFF9900; 

    A8:EMA(A7,2),COLORFF9900; 

    A9:EMA(A8,2),COLORFF9900; 

    A10:EMA(A9,2),COLORFF9900; 

    IF(A1 REF(A1,1),A1,DRAWNULL),COLOR0FFFF0; 

    IF(A2 REF(A2,1),A2,DRAWNULL),COLOR0FFFF0; 

    IF(A3 REF(A3,1),A3,DRAWNULL),COLOR0FFFF0; 

    IF(A4 REF(A4,1),A4,DRAWNULL),COLOR0FFFF0; 

    IF(A5 REF(A5,1),A5,DRAWNULL),COLOR0FFFF0; 

    IF(A6 REF(A6,1),A6,DRAWNULL),COLOR0FFFF0; 

    IF(A7 REF(A7,1),A7,DRAWNULL),COLOR0FFFF0; 

    IF(A8 REF(A8,1),A8,DRAWNULL),COLOR0FFFF0; 

    IF(A9 REF(A9,1),A9,DRAWNULL),COLOR0FFFF0; 

    IF(A10 REF(A10,1),A10,DRAWNULL),COLOR0FFFF0; 

    IF(A1 REF(A1,1),A1,DRAWNULL),COLOR0000FF,LINETHICK3; 

    N:=9;M1:=3;M2:=3; 

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

    K:SMA(RSV,M1,1); 

    D:SMA(K,M2,1); 

    J:3*K-2*D; 

    BOLL:MA(J,20),LINETHICK3; 

    UPPER:BOLL+2*STD(J,20); 

    LOWER:BOLL-2*STD(J,20); 

    IF(J REF(J,1),J,DRAWNULL),COLORRED,LINETHICK2; 

    IF(J REF(J,1),J,DRAWNULL)COLOR00BB00,LINETHICK2;

    N:=5;M1:=3;M2:=3;T:=5;

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

    K:SMA(RSV,M1,1)*2-100;

    D:SMA(K,M2,1);

    J:3*K-2*D;

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

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


    image.png

    公式解读:

    [源码注释]通达信公式动态公式解读


    XA_1赋值:90

    XA_2赋值:XA_1+(100-XA_1)/2

    XA_3赋值:(100-XA_1)/2

    XA_4赋值:获利盘为XA_2%的分布

    XA_5赋值:获利盘为XA_3%的成本分布

    输出SCR1:(XA_4-XA_5)/(XA_4+XA_5/2)*100



    推荐阅读:变色kdj指标源码

     

    DRAWBAND(MA(CLOSE,10),RGB(80,0,0),MA(CLOSE,20),RGB(0,91,0)); 

    DRAWBAND(MA(CLOSE,5),RGB(155,50,50),MA(CLOSE,10),RGB(83,123,68)); 

    DRAWKLINE(H,O,L,C); 

    MA5:MA(CLOSE,5),COLORWHITE; 

    MA10:MA(CLOSE,10),COLORYELLOW; 

    MA20:MA(CLOSE,20),COLORMAGENTA; 

    MA60:MA(CLOSE,60),COLORGREEN,LINETHICK2; 

    MA120:MA(CLOSE,120),COLORLIMAGENTA,LINETHICK2; 

    MA250:MA(CLOSE,250),COLORBLUE,LINETHICK2; 

    RC1:=REF(C,1); 

    CS:=IF(C =1,10000,100000); 

    C10:=1.10*RC1-49/CS;{考虑到4舍5入} 

    C涨停5:=1.05*RC1-49/CS; 

    C跌停10:=0.90*RC1+51/CS; 

    C跌停5:=0.95*RC1+51/CS; 

    ST:=NAMELIKE( S )ORNAMELIKE( *S  

    涨停:=IF(ST,C =C涨停5,C =C涨停10); 

    跌停:=IF(ST,C =C跌停5,C =C跌停10); 

    盘中涨停:=IF(ST,H =C涨停5,H =C涨停10); 

    盘中跌停:=IF(ST,L =C跌停5,L =C跌停10); 

    STICKLINE(盘中涨停,H,MAX(C,O),0,0),COLORMAGENTA;{涨停后回落} 

    STICKLINE(盘中跌停,L,MIN(C,O),0,0),COLORLICYAN;{跌停后回升} 

    大阳线:=C OAND(C =C涨停5ORC (1.05*O-51/CS))OR(C 1000ANDC RC1*1.024); 

    STICKLINE(大阳线,OPEN,CLOSE,2.5,0),COLORMAGENTA; 

    大阴线:=C OAND(C =C跌停5ORC (0.95*O+49/CS))OR(C 1000ANDC RC1*0.976); 

    STICKLINE(大阴线,OPEN,CLOSE,2.5,0),COLORCYAN; 

    STICKLINE(涨停,OPEN,CLOSE,2.5,0),COLORYELLOW; 

    STICKLINE(跌停,OPEN,CLOSE,2.5,0),COLORGREEN; 

    假阴:=C OANDC REF(C,1); 

    STICKLINE(假阴,O,C,0.5,0),COLORRED;{假阴柱}; 

    假阳:=C OANDC REF(C,1); 

    STICKLINE(假阳,O,C,0.5,0),COLORGREEN;{假阳柱}; 

    NE:=IF(NAMELIKE( S )ORNAMELIKE( *S ),0.05,0.1);{通用个股/ST股} 

    涨停:=C/REF(C,1)-1 =NE-0.01/REF(C,1)ANDC=HANDPERIOD=5;{仅在日线上变色} 

    STICKLINE(涨停,C,O,-1,0),COLORFF00F5; 

    跌停:=REF(C,1)/C-1 =NE-0.01/REF(C,1)ANDL=CANDPERIOD=5; 

    STICKLINE(跌停,C,O,-1,0),COLOR00FF00; 

    {曾涨跌停K线变色} 

    曾涨停:=H/REF(C,1)-1 =NE-0.01/REF(C,1)ANDC HANDPERIOD=5; 

    STICKLINE(曾涨停,H-(H-MAX(O,C)),H,0,0),COLORFF00B5; 

    曾跌停:=REF(C,1)/L-1 =NE-0.01/REF(C,1)ANDL CANDPERIOD=5; 

    STICKLINE(曾跌停,L+(MIN(O,C)-L),L,0,0),COLOR00BB00; 

    {涨跌停开盘K线变色} 

    涨停开盘:=O/REF(C,1)-1 =NE-0.01/REF(C,1)ANDO=HANDPERIOD=5;{阴阳线的十分之一变色} 

    STICKLINE(涨停开盘,C+(O-C)*0.9,O,-1,0),COLORFF00F5; 

    跌停开盘:=REF(C,1)/O-1 =NE-0.01/REF(C,1)ANDL=OANDPERIOD=5; 

    STICKLINE(跌停开盘,C-(C-O)*0.9,O,-1,0),COLOR00FF00; 

    N:=9;M:=14;N1:=6; 

    {RSI-CCI-KDJ} 

    100,POINTDOT; 

    -100,POINTDOT; 

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

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

    C1:=SMA(CC1,3,1); 

    C2:=SMA(C1,3,1); 

    C3:=3*C1-2*C2; 

    CB1:=EMA(C3,5); 

    CB2:=REF(CB1,1); 

    DRAWBAND(CC1,RGB(0,244,244),0,RGB(255,200,90)); 

    DRAWBAND(100,0,-100,0); 

    100,POINTDOT; 

    -100,POINTDOT; 

    LC:=REF(CLOSE,1); 

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

    RSI:(RSI1-50)*5,LINETHICK2,COLORFFFFFF; 

    R1:=SMA(RSI,3,1); 

    D1:=SMA(R1,3,1); 

    J1:=3*R1-2*D1; 

    RR1:=EMA(J1,5); 

    RR2:=REF(RR1,1); 

    RR:=RR1 RR2; 

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

    K:=SMA(RSV,3,1); 

    K1:(K-50)*5,COLOR00FF00; 

    K2:=SMA(K1,3,1); 

    D2:=SMA(K2,3,1); 

    J2:=3*K2-2*D2; 

    BB1:=EMA(J2,5); 

    BB2:=REF(BB1,1); 

    买入:RRANDNOT(REF(RR,1))AND(RR1 -100ANDBB1 -100)ANDCB1 -100,LINETHICK0; 

    卖出:REF(RR,1)=1ANDNOT(RR)ANDCB1 100,LINETHICK0; 

    100,POINTDOT; 

    -100,POINTDOT,COLOR52F8FF; 

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


    image.png


    每日公式解答:

     

    公式编写要求: 

    百日最高量的选股公式。 

    公式编写方法: 

    XG:HHVBARS(H,100)=0;


    九毛八公式指标,一个优质的公式指标平台!
    九毛八公式指标 » 变色kdj买卖指标公式(kdj主图指标公式) 加入收藏