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

    正文概述    2024-05-04 03:31:34  

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


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


    授权方式: 免费版


    指标评级: ★★★★


    指标分类: 策略


    画线方法: 副图



    一、黄紫绿三线主图指标公式

        a20:ma(c,20),colorwhite,linethick2;

        ma120:ma(c,120),colorffcccc,linethick2;

        ma250:ma(c,250),colorffcc66,linethick2;

        乖离线:=((c-ref(ma20,1))/20+ma20)*1.20;

        tt1:=cross(ma20,ma120)andcross(ma20,ma250)andv ref(v,1);

        tt2:=ma20 ref(ma20,2)andv ref(v,1)andcross(c,ma20);

        STICKLINE(TT1,l,l-0.09,4,0),coloryellow;

        DRAWTEXT(TT1,l-0.13, ),coloryellow;

        STICKLINE(cross(c,ma120)andcross(c,ma250)and

        cross(c,ma20),l,l-0.09,4,0),coloryellow;

        DRAWTEXT(cross(c,ma120)andcross(c,ma250)andcross(c,ma20),l-0.13, 并线开花

        ),coloryellow;

        STICKLINE(tt2,l,l-0.09,4,0),coloryellow;

        DRAWTEXT(tt2,l-0.13, 买点1 ),coloryellow;

        STICKLINE(cross(c,乖离线),h,h+0.09,4,0),color00ff00;

        DRAWTEXT(cross(c,乖离线),h+0.13, 卖点 ),color00ff00;

        STICKLINE(ma250 =ref(ma250,1)andma20 =ref(ma20,1)and

        cross(c,ma250),l,l-0.09,4,0),colorffcc66;

        DRAWTEXT(ma250 =ref(ma250,1)andma20 =ref(ma20,1)andcross(c,ma250),l-0.13,

        牛象 ),colorffcc66;

        STICKLINE(ma120 =ref(ma120,1)andcross(c,ma20)andcross(c,ma120)and

        v ref(v,1),l,l-0.09,4,0),colorff00ff;

        DRAWTEXT(ma120 =ref(ma120,1)andcross(c,ma20)andcross(c,ma120)and

        v ref(v,1),l-0.13, 买点2 ),colorff00ff;

        A1:=SUM(AMOUNT,3)/SUM(VOL,3)/100;

        A2:=SUM(AMOUNT,8)/SUM(VOL,8)/100;

        A3:=SUM(AMOUNT,21)/SUM(VOL,21)/100;

        DIFF:=(EMA(CLOSE,12)-EMA(CLOSE,26));

        DEA:=EMA(DIFF,9);

        :=2*(DIFF-DEA);

        V1:=c-(a1+ma(c,3))/2;

        V2:=c-(a2+ma(c,8))/2;

        V3:=c-(a3+ma(c,21))/2;

        Va1:=(C+v3-v1+macd);

        Va4:=(C+v2-v1+macd);

        :EMA(Va1,6),linethick2,Coloryellow;

        H1:=IF(RANGE(DATE,1150501,1150701),H,DRAWNULL);

        第一次:REF(H1,BARSLAST(FILTERX(H1=HHV(H1,0),BARSCOUNT(C)))),COLORRED;

        H2:=IF(RANGE(DATE,1150701,1150901),H,DRAWNULL);

        第二次:REF(H2,BARSLAST(FILTERX(H2=HHV(H2,0),BARSCOUNT(C)))),COLORYELLOW;

        H3:=IF(RANGE(DATE,1150901,1160201),H,DRAWNULL);

        第三次:REF(H3,BARSLAST(FILTERX(H3=HHV(H3,0),BARSCOUNT(C)))),COLORGREEN;

        H1:=IF(RANGE(DATE,1150501,1150701),H,DRAWNULL);

        G1:=REF(H1,BARSLAST(FILTERX(H1=HHV(H1,0),BARSCOUNT(C))));

        H2:=IF(RANGE(DATE,1150701,1150901),H,DRAWNULL);

        G2:=REF(H2,BARSLAST(FILTERX(H2=HHV(H2,0),BARSCOUNT(C))));

        H3:=IF(RANGE(DATE,1150901,1160201),H,DRAWNULL);

        G3:=REF(H3,BARSLAST(FILTERX(H3=HHV(H3,0),BARSCOUNT(C))));

        xg:CROSS(C,G1)ORCROSS(C,G2)ORCROSS(C,G3);

        STICKLINE(TIME2=94000AND

        REF(C,BARSLAST(TIME2=94000)) =REF(C,BARSLAST(TIME2=93000)),DYNAINFO(3)*1.

        1,DYNAINFO(3)*0.9,0.5,-1),COLORRED;

        STICKLINE(TIME2=94000AND

        REF(C,BARSLAST(TIME2=94000)) REF(C,BARSLAST(TIME2=93000)),DYNAINFO(3)*1.1,

        DYNAINFO(3)*0.9,0.5,-1),COLORGREEN;

        STICKLINE(TIME2=95000AND

        REF(C,BARSLAST(TIME2=95000)) =REF(C,BARSLAST(TIME2=94000)),DYNAINFO(3)*1.

        1,DYNAINFO(3)*0.9,0.5,-1),COLORRED;

        STICKLINE(TIME2=95000AND

        REF(C,BARSLAST(TIME2=95000)) REF(C,BARSLAST(TIME2=94000)),DYNAINFO(3)*1.1,

        DYNAINFO(3)*0.9,0.5,-1),COLORGREEN;

        STICKLINE(TIME2=100000AND

        REF(C,BARSLAST(TIME2=100000)) =REF(C,BARSLAST(TIME2=95000)),DYNAINFO(3)*1

        .1,DYNAINFO(3)*0.9,0.5,-1),COLORRED;

        STICKLINE(TIME2=100000AND

        REF(C,BARSLAST(TIME2=100000)) REF(C,BARSLAST(TIME2=95000)),DYNAINFO(3)*1.

        1,DYNAINFO(3)*0.9,0.5,-1),COLORGREEN;

        SJ1:=TIME2=93000;T1:=BARSLAST(SJ1);SJ2:=TIME2=94000;

        SJ4:=TIME2=95000;T2:=BARSLAST(SJ2);T4:=BARSLAST(SJ4);

        H1:=IF(TIME2=94000,REF(C,T2),DRAWNULL)=C;

        H2:=IF(TIME2=95000,REF(C,T4),DRAWNULL)=C;

        CS2:=CONST(REF(C,T2));

        CS4:=CONST(REF(C,T4));

        GL2:=FILTERX(H1,T2);

        GL4:=FILTERX(H2,T4);

        L1:=IF(TIME2=93000,REF(C,T1),DRAWNULL)=C;

        CS1:=CONST(REF(C,T1));

        GL1:=FILTERX(L1,T1);

        DA:=CONST(IF(REF(GL2,BARSLAST(GL2)),REF(BARSLAST(GL1),BARSLAST(GL2)),DRAW

        NULL));

        DA1:=CONST(IF(REF(GL4,BARSLAST(GL4)),REF(BARSLAST(GL2),BARSLAST(GL4)),DRAW

        NULL));

        A:=IF(BARSLAST(GL1) =0AND

        BARSLAST(GL1) =DA,((CS2-CS1)/DA)*BARSLAST(GL1)+CS1,DRAWNULL);

        B:=IF(BARSLAST(GL2) =0AND

        BARSLAST(GL2) =DA1,((CS4-CS2)/DA1)*BARSLAST(GL2)+CS2,DRAWNULL);

        IF(A =REF(A,1),A,DRAWNULL)COLORRED,LINETHICK3;

        IF(A REF(A,1),A,DRAWNULL)COLORGREEN,LINETHICK3;

        IF(B =REF(B,1),B,DRAWNULL)COLORRED,LINETHICK3;

        IF(B REF(B,1),B,DRAWNULL)COLORGREEN,LINETHICK3;

        XSJ1:=TIME2=95000;

        XT1:=BARSLAST(XSJ1);

        XSJ2:=TIME2=100000;

        XT2:=BARSLAST(XSJ2);

        XCS2:=CONST(REF(C,XT2));

        XL1:=IF(TIME2=95000,REF(C,XT1),DRAWNULL)=C;

        XH1:=IF(TIME2=100000,REF(C,XT2),DRAWNULL)=C;

        XCS1:=CONST(REF(C,XT1));

        XGL1:=FILTERX(XL1,XT1);

        XGL2:=FILTERX(XH1,XT2);

        XDA:=CONST(IF(REF(XGL2,BARSLAST(XGL2)),REF(BARSLAST(XGL1),BARSLAST(XGL2)),

        DRAWNULL));

        XA:=IF(BARSLAST(XGL1) =0AND

        BARSLAST(XGL1) =XDA,((XCS2-XCS1)/XDA)*BARSLAST(XGL1)+XCS1,DRAWNULL);

        IF(XA =REF(XA,1),XA,DRAWNULL)COLORRED,LINETHICK3;

        IF(XA REF(XA,1),XA,DRAWNULL)COLORGREEN,LINETHICK3;

        时间:=TIME2=100000;

        N:=BARSLAST(时间);

        C1:CONST(IF(N,MAX(REF(HHV(H,0),N+1),DYNAINFO(4)),HHV(H,0))),DOTLINE,COLORRE

        D;

        C2:CONST(IF(N,MIN(REF(LLV(L,0),N+1),DYNAINFO(4)),LLV(L,0))),DOTLINE,COLORGREE

        N;

        C3:(C1+C2)/2,DOTLINE,COLORYELLOW;

        VV:=HHV(V,0);

        Z,:=(C1/C2-1)*100;

        DRAWTEXT(CURRBARSCOUNT=30,C1*1.005,VARCAT(VARCAT(VARCAT(VARCAT( 上

        限: ,VAR2STR(C1,2)), 元, ),VARCAT( 振幅: ,VAR2STR(Z,,2))), % )),COLORRED;

        DRAWTEXT(CURRBARSCOUNT=30,C3*1.005,VARCAT(VARCAT( 中限: ,VAR2STR(C3,2)),

        元 )),COLORYELLOW;

        DRAWTEXT(CURRBARSCOUNT=30,C2*1.005,VARCAT(VARCAT( 下限: ,VAR2STR(C2,2)),

        元 )),COLORGREEN;

        DRAWTEXT(C1/C2=VV,C1*1.005, ★买入 )COLORRED;

        DRAWTEXT(C1/C2=VV,C2*0.998, ★卖出

        )COLORGREEN;

        STICKLINE(C1/C2=VV,C1,C2,1,0),COLORRED;


    image.png

    公式解读:

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


     X_37赋值:3*(收盘价-18日内最低价的最低值)/(18日内最高价的最高值-18日内最低价的最低值)*100的21日[1日权重]移动平均-2*(收盘价-18日内最低价的最低值)/(18日内最高价的最高值-18日内最低价的最低值)*100的20日[1日权重]移动平均的8日[1日权重]移动平均

    X_38赋值:20

    输出:如果X_37上穿X_38,返回50,否则返回0


    推荐阅读:三色主图指标

        MA5:eMA(CLOSE,5);

        MA20:eMA(CLOSE,20);

        DRAWGBK(C MA5,STRIP(rgb(0,0,200),rgb(0,140,0),0));

        PARTLINE(ma5,ma5 ma20,rgb(255,0,0),ma5 ma20,1,rgb(0,0,0)),LINETHICK2;

        DRAWICON(CROSS(ma5,ma20),l,1);

        DRAWICON(CROSS(ma20,ma5),h*1.03,2);

        {K线}

        STICKLINE(OPEN =CLOSE,CLOSE,OPEN,0,0),COLOR00FF00;

        STICKLINE(OPEN =CLOSE,CLOSE,OPEN,7,0),COLOR009900;

        STICKLINE(OPEN =CLOSE,CLOSE,OPEN,5,0),COLOR00BB00;

        STICKLINE(OPEN =CLOSE,CLOSE,OPEN,3,0),COLOR00DD00;

        STICKLINE(OPEN =CLOSE,CLOSE,OPEN,1,0),COLOR00FF00;

        STICKLINE(CLOSE OPEN,CLOSE,OPEN,0,0),COLORFFBBFF;

        STICKLINE(CLOSE OPEN,CLOSE,OPEN,7,0),COLORFF22FF;

        STICKLINE(CLOSE OPEN,CLOSE,OPEN,5,0),COLORFF66FF;

        STICKLINE(CLOSE OPEN,CLOSE,OPEN,3,0),COLORFF99FF;

        STICKLINE(CLOSE OPEN,CLOSE,OPEN,1,0),COLORFFBBFF;

        DRAWNUMBER(ISLASTBAR,C,C),COLORMAGENTA;

        SJTJ:=DATE 1590301;

        {主线:EMA(EMA(C,10),10),COLORBLUE,LINETHICK3;

        B:=主趋势线 REF(主趋势线,1);

        IF(B-1,主趋势线,DRAWNULL)COLORRED,LINETHICK3;}

        主趋势线:EMA(EMA(C,10),10),COLORRED,LINETHICK3;

        B:=主趋势线 REF(主趋势线,1);

        IF(B-1,主趋势线,DRAWNULL)COLORBLUE,LINETHICK3;

        AA:=EMA(C,5) EMA(C,20);

        BB:=EMA(C,5) EMA(C,20);

        CC:=EMA(C,5) EMA(C,10);

        CC1:=EMA(C,5) EMA(C,10);

        DD:=CLOSE OPEN;

        STICKLINE(AAANDSJTJ,H,L,0,0),COLORRED;

        STICKLINE(AAANDSJTJ,O,C,3,1),COLORRED;

        STICKLINE(AAANDSJTJANDDD,O,C,3,0),COLORRED;

        STICKLINE(BBANDSJTJ,H,L,0,0),COLORGREEN;

        STICKLINE(BBANDSJTJ,O,C,3,1),COLORGREEN;

        STICKLINE(BBANDSJTJANDDD,O,C,3,0),COLORGREEN;

        STICKLINE(BBANDSJTJANDCC,H,L,0,1),COLORWHITE;

        STICKLINE(BBANDSJTJANDCC,O,C,3,1),COLORWHITE;

        STICKLINE(BBANDSJTJANDCCANDDD,O,C,3,0),COLORWHITE;

        STICKLINE(AAANDSJTJANDCC1,H,L,0,0),COLORWHITE;

        STICKLINE(AAANDSJTJANDCC1,O,C,3,1),COLORWHITE;

        STICKLINE(AAANDSJTJANDCC1ANDDD,O,C,3,0),COLORWHITE;

        最新价:IF(SJTJ,C,DRAWNULL),LINETHICK0,COLORYELLOW;

        DD:=(H+L+2*C)/4;

        M3:EMA(DD,3);

        M8:EMA(DD,8);

        M21:EMA(DD,21);

        M55:EMA(DD,55),LINETHICK2,COLOR00FF00;

        TT:=BARSCOUNT(C);

        PT:=IF(TT 55,TT,55);

        上:M55+2.1*STD(C,PT),COLORRED;

        下:M55-2.1*STD(C,PT),COLOR00FF00;

        月涨幅:=(C-LLV(C,20))/LLV(C,20)*100;

        月跌幅:=(HHV(H,20)-C)/HHV(H,20)*100;

        DRAWTEXT(CROSS(上,M3),上, 抛 ),COLORYELLOW;

        DRAWTEXT(CROSS(M3,下),下, 抄 ),COLORYELLOW;

        HH:=MAX(MAX(MAX(M3,M8),M21),M55);

        LL:=MIN(MIN(MIN(M3,M8),M21),M55);

        SXZH:=HH/LLREF(M3,1)

        ANDM8 REF(M8,1)ANDM21 REF(M21,1)ANDM55 REF(M55,1);

        SXZL:=HH/LL =1.03ANDM3 REF(M3,1)

        ANDM8 REF(M8,1)ANDM21 REF(M21,1)ANDM55 REF(M55,1);

        向上:SXZHANDLHHAND月涨幅 月跌幅,NODRAW;

        向下:SXZLANDH LLANDC LLAND月涨幅 月跌幅,NODRAW;

        DRAWICON(向上,MIN(L,LL)*0.97,1);

        DRAWICON(向下,MAX(H,HH)*1.03,2);

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

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

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

        DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);

        DEA:=EMA(DIFF,9);

        MACD:=2*(DIFF-DEA);

        做多:=IF(K DANDMACD 0ANDV 1,2,0),COLORRED;

        做空:=IF(K1,-2,0),COLOR00FF00;

        强洗:=IF(MACD 0ANDK1,1,0),COLOR0099FF;

        弱升:=IF(MACDDANDV 1,-1,0),COLORFFFF00;

        CCI:= CCI.CCI

        DRAWICON(CCI 185ANDH 上,H*1.02,6);

        DRAWICON(CCI -185,L*0.98,5);

        STICKLINE(做多,L,H,0.5,0),COLORRED;

        STICKLINE(做多ANDC =O,C,O,3,1),COLORRED;

        STICKLINE(做多ANDC O,C,O,3,0),COLORRED;

        STICKLINE(做空,L,H,0.5,0),COLOR00FF00;

        STICKLINE(做空ANDC =O,C,O,3,1),COLOR00FF00;

        STICKLINE(做空ANDC O,C,O,3,0),COLOR00FF00;

        STICKLINE(强洗,L,H,0.5,0),COLOR0099FF;

        STICKLINE(强洗ANDC =O,C,O,3,1),COLOR0099FF;

        STICKLINE(强洗ANDC O,C,O,3,0),COLOR0099FF;

        STICKLINE(弱升,L,H,0.5,0),COLORFFFF00;

        STICKLINE(弱升ANDC =O,C,O,3,1),COLORFFFF00;

        STICKLINE(弱升ANDC O,C,O,3,0),COLORFFFF00;

        ZDF:=(C-REF(C,1))/REF(C,1)*100;

        STICKLINE(ZDF 9.8,O,C,2,0),COLORRED;

        STICKLINE(ZDF -9.8,O,C,2,0),COLORBLUE;

        IF(M3 M8,M3,DRAWNULL),COLORFFFF00;

        IF(M8 M21,M8,DRAWNULL),COLORFFFF00;

        IF(M21 M55,M21,DRAWNULL),COLORFFFF00;

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

    image.png


    每日公式解答:

        公式编写要求:

        前一日缩量板(不是一字板);第二日巨量长阴,跌幅不超过3%的公式。

        公式编写方法:

        ZT:=IF(NAMELIKE( ST )ORNAMELIKE( *ST ),C=ZTPRICE(REF(C,1),0.05),

        IF(CODELIKE( 688 )OR(CODELIKE( 300 )ANDDATE =1200824),C=ZTPRICE(REF(C,1),0.2),

        C=ZTPRICE(REF(C,1),0.1)));

        XG:REF(ZTANDH!=LANDVREF(V,1)*3ANDC=0.97;


    九毛八公式指标,一个优质的公式指标平台!
    九毛八公式指标 » 黄紫绿三线主图指标公式(红绿线指标公式) 加入收藏