• 网站首页
  • 股票知识
  • 股票公式
  • 散户炒股
  • 问答百科
  • 缠中说禅
  • 概念股
  • 【炒股方法】通达信源码精选:空间幅度分析,MACD狙击黑马,K线画三角形

    发布时间: 2022-05-03 13:26 首页:股票一点通>股票公式>通达信公式> 阅读()
    1、空间幅度分析

    最高点:REFDATE(CONST(REF(HHV(H,0),0)),DATE),DOTLINE,COLORMAGENTA;
    最低点:REFDATE(CONST(REF(LLV(L,0),0)),DATE),DOTLINE,COLORGREEN;


    GD:=CONST(FINDHIGH(H,0,最高点*10000,1));
    DD:=CONST(FINDLOW(L,0,最低点*10000,1));
    GT:=CONST(BARSLAST(GD=H))+1;
    DT:=CONST(BARSLAST(DD=L))+1;
    SH:=CONST(IF(GT=1,H,REF(H,GT-1)));
    SL:=CONST(IF(DT=1,L,REF(L,DT-1)));
    上涨周期:IF(CURRBARSCOUNT<=DT,BARSLAST(DD=L),DRAWNULL),COLORWHITE,NODRAW;
    上涨幅度:IF(CURRBARSCOUNT<=DT,C/SL*100-100,DRAWNULL),NODRAW,COLORRED;
    上涨均价:IF(CURRBARSCOUNT<=DT,SUM(AMOUNT,DT)/SUM(V,DT)/100,DRAWNULL),NODRAW,COLORLIGRAY;
    上涨换手%:IF(CURRBARSCOUNT<=DT,SUM(HSL.HSL,DT),DRAWNULL),COLORLIMAGENTA,NODRAW;

    下跌周期:BARSLAST(GD=H),COLORWHITE,NODRAW;
    下跌幅度:IF(CURRBARSCOUNT<=GT,C/SH*100-100,DRAWNULL),NODRAW,COLORGREEN;
    下跌均价:IF(CURRBARSCOUNT<=GT,SUM(AMOUNT,GT)/SUM(V,GT)/100,DRAWNULL),NODRAW,COLORLIGRAY;
    下跌换手%:IF(CURRBARSCOUNT<=GT,SUM(HSL.HSL,GT),DRAWNULL),COLORCYAN,NODRAW;

    星期:=VARCAT(VARCAT('(',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五','')))))),')');
    日期:=VARCAT(VARCAT(VARCAT(VARCAT(VARCAT(VARCAT(VAR2STR(YEAR,0),'年'),VAR2STR(MONTH,0)),'月'),VAR2STR(DAY,0)),'日'),星期);

    {黄金分割 普通 等系坐标}
    DRAWRECTREL(990,2,998,188,RGB(0,150,180)),NOFRAME;
    DRAWRECTREL(990,188,998,375,RGB(200,200,0)),NOFRAME;
    DRAWRECTREL(990,375,998,491,RGB(100,200,0)),NOFRAME;
    DRAWRECTREL(990,491,998,607,RGB(200,10,80)),NOFRAME;
    DRAWRECTREL(990,607,998,794,RGB(150,0,0)),NOFRAME;
    DRAWRECTREL(990,794,998,982,RGB(150,150,150)),NOFRAME;


    {等比数列周期}
    DRAWTEXT(CURRBARSCOUNT=GT-4 ,L,'5'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-9 ,L,'10'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-14 ,L,'15'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-19 ,L,'20'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-24 ,L,'25'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-29 ,L,'30 '),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-34 ,L,'35'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-39 ,L,'40'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-44 ,L,'45'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-49 ,L,'50'),COLOR00FF00;
    DRAWTEXT(CURRBARSCOUNT=GT-54 ,L,'55'),COLOR00FF00;

    DRAWTEXT(CURRBARSCOUNT=DT-4,H,'5'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-9,H,'10'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-14,H,'15'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-19,H,'20'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-24,H,'25'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-29,H,'30'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-34,H,'35'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-39,H,'40'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-44,H,'45'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-49,H,'50'),DRAWABOVE,COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT-54,H,'55'),DRAWABOVE,COLORRED;

    {幅度尺}
    A1:=ZTPRICE(REF(SL,1),0.1);
    A2:=ZTPRICE(REF(A1,1),0.1);
    A3:=ZTPRICE(REF(A2,1),0.1);
    A4:=ZTPRICE(REF(A3,1),0.1);
    A5:=ZTPRICE(REF(A4,1),0.1);
    A6:=ZTPRICE(REF(A5,1),0.1);
    A7:=ZTPRICE(REF(A6,1),0.1);
    A8:=ZTPRICE(REF(A7,1),0.1);
    A9:=ZTPRICE(REF(A8,1),0.1);
    A10:=ZTPRICE(REF(A9,1),0.1);
    A11:=ZTPRICE(REF(A10,1),0.1);
    A12:=ZTPRICE(REF(A11,1),0.1);
    A13:=ZTPRICE(REF(A12,1),0.1);
    A14:=ZTPRICE(REF(A13,1),0.1);
    A15:=ZTPRICE(REF(A14,1),0.1);
    A16:=ZTPRICE(REF(A15,1),0.1);
    A17:=ZTPRICE(REF(A16,1),0.1);
    A18:=ZTPRICE(REF(A17,1),0.1);
    A19:=ZTPRICE(REF(A18,1),0.1);
    A20:=ZTPRICE(REF(A19,1),0.1);
    A21:=ZTPRICE(REF(A20,1),0.1);
    A22:=ZTPRICE(REF(A21,1),0.1);
    A23:=ZTPRICE(REF(A22,1),0.1);
    A24:=ZTPRICE(REF(A23,1),0.1);
    A25:=ZTPRICE(REF(A24,1),0.1);
    A26:=ZTPRICE(REF(A25,1),0.1);
    A27:=ZTPRICE(REF(A26,1),0.1);
    A28:=ZTPRICE(REF(A27,1),0.1);
    A29:=ZTPRICE(REF(A28,1),0.1);
    A30:=ZTPRICE(REF(A29,1),0.1);
    A31:=ZTPRICE(REF(A30,1),0.1);
    A32:=ZTPRICE(REF(A31,1),0.1);

    STICKLINE(CURRBARSCOUNT=DT,SH,SL,3,0),COLORRED;
    STICKLINE(CURRBARSCOUNT=GT,SH,SL,3,0),COLORGREEN;

    DRAWTEXT(CURRBARSCOUNT=DT ,(SL+A1)/2,日期),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=GT ,GD*0.97,日期),COLORMAGENTA;
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.1,'一10%'),COLORBLUE;
    {DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.15,'一15%'),COLORCYAN;}
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.2,'一20%'),COLORGREEN;
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.3,'一30%'),COLORWHITE;
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.4,'一40%'),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.5,'一50%'),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.6,'一60%'),COLORLIMAGENTA;
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.7,'一70%'),COLORMAGENTA;
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.8,'一80%'),COLORWHITE;
    DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.9,'一90%'),COLORGREEN;

    区间1:SH-SH*0.1,DOTLINE;
    区间2:SH-SH*0.2,DOTLINE;
    区间3:SH-SH*0.3,DOTLINE;
    区间4:SH-SH*0.4,DOTLINE;
    区间5:SH-SH*0.5,DOTLINE;
    区间6:SH-SH*0.6,DOTLINE;
    区间7:SH-SH*0.7,DOTLINE;
    区间8:SH-SH*0.8,DOTLINE;
    区间9:SH-SH*0.9,DOTLINE;
    DRAWTEXT(CURRBARSCOUNT=DT,A1,STRCAT('一 ',CON2STR(A1,2)));
    DRAWTEXT(CURRBARSCOUNT=DT,A2,STRCAT('一 ',CON2STR(A2,2)));
    DRAWTEXT(CURRBARSCOUNT=DT,A3,STRCAT('一 ',CON2STR(A3,2)));
    DRAWTEXT(CURRBARSCOUNT=DT,A4,STRCAT('一 ',CON2STR(A4,2)));
    DRAWTEXT(CURRBARSCOUNT=DT,A5,STRCAT('一 ',CON2STR(A5,2)));
    DRAWTEXT(CURRBARSCOUNT=DT,A6,STRCAT('一 ',CON2STR(A6,2)));
    DRAWTEXT(CURRBARSCOUNT=DT,A7,STRCAT('一 ',CON2STR(A7,2)));
    DRAWTEXT(CURRBARSCOUNT=DT,A8,STRCAT('一 ',CON2STR(A8,2)));
    DRAWTEXT(CURRBARSCOUNT=DT,A9,STRCAT('一 ',CON2STR(A9,2))),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT,A10,STRCAT('一 ',CON2STR(A10,2))),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT,A11,STRCAT('一 ',CON2STR(A11,2))),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT,A12,STRCAT('一 ',CON2STR(A12,2))),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT,A13,STRCAT('一 ',CON2STR(A13,2))),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT,A14,STRCAT('一 ',CON2STR(A14,2))),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT,A15,STRCAT('一 ',CON2STR(A15,2))),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT,A16,STRCAT('一 ',CON2STR(A16,2))),COLORRED;
    DRAWTEXT(CURRBARSCOUNT=DT,A17,STRCAT('一 ',CON2STR(A17,2))),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=DT,A18,STRCAT('一 ',CON2STR(A18,2))),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=DT,A19,STRCAT('一 ',CON2STR(A19,2))),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=DT,A20,STRCAT('一 ',CON2STR(A20,2))),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=DT,A21,STRCAT('一 ',CON2STR(A21,2))),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=DT,A22,STRCAT('一 ',CON2STR(A22,2))),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=DT,A23,STRCAT('一 ',CON2STR(A23,2))),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=DT,A24,STRCAT('一 ',CON2STR(A24,2))),COLORYELLOW;
    DRAWTEXT(CURRBARSCOUNT=DT,A25,STRCAT('一 ',CON2STR(A25,2))),COLORGREEN;
    DRAWTEXT(CURRBARSCOUNT=DT,A26,STRCAT('一 ',CON2STR(A26,2))),COLORGREEN;
    DRAWTEXT(CURRBARSCOUNT=DT,A27,STRCAT('一 ',CON2STR(A27,2))),COLORGREEN;
    DRAWTEXT(CURRBARSCOUNT=DT,A28,STRCAT('一 ',CON2STR(A28,2))),COLORGREEN;
    DRAWTEXT(CURRBARSCOUNT=DT,A29,STRCAT('一 ',CON2STR(A29,2))),COLORGREEN;
    DRAWTEXT(CURRBARSCOUNT=DT,A30,STRCAT('一 ',CON2STR(A30,2))),COLORGREEN;
    DRAWTEXT(CURRBARSCOUNT=DT,A31,STRCAT('一 ',CON2STR(A31,2))),COLORGREEN;
    DRAWTEXT(CURRBARSCOUNT=DT,A32,STRCAT('一 ',CON2STR(A32,2))),COLORGREEN;


    {画K线}
    DRAWKLINE(HIGH,OPEN,LOW,CLOSE);

    DRAWTEXT_FIX(1,0.11,0.991,0,'左侧白色数字为建仓区'),COLORWHITE;
    DRAWTEXT_FIX(1,0.24,0.991,0,'左侧红色数字为拉升区'),COLORRED;
    DRAWTEXT_FIX(1,0.37,0.991,0,'左侧黄色数字为主升区'),COLORYELLOW;
    DRAWTEXT_FIX(1,0.50,0.991,0,'左侧绿色数字为出货区'),COLORGREEN;
    DRAWTEXT_FIX(1,0.63,0.991,0,'右侧彩色立柱为黄金分割'),COLORMAGENTA;
    DRAWTEXT_FIX(1,0.77,0.991,0,'本指标仅适用于近端次新股'),COLORCYAN;
    {股民学院 整理}



    2、MACD狙击黑马

    {MACD狙击黑马}

    XA_1:=EMA(EMA(EMA(CLOSE,5),5),5);
    XA_2:=EMA(EMA(EMA(CLOSE,7),7),7);
    XA_3:=EMA(EMA(EMA(CLOSE,12),12),12);
    峰谷1线:(XA_1-REF(XA_1,1))/REF(XA_1,1)*200,COLORMAGENTA,LINETHICK2;
    峰谷2线:(XA_2-REF(XA_2,1))/REF(XA_2,1)*250,COLORGREEN,LINETHICK2;
    议事线:(XA_3-REF(XA_3,1))/REF(XA_3,1)*300,COLOR99EEEE;
    门廷线:MA(议事线,9),COLORRED;
    DRAWBAND(议事线,RGB(255,0,0),门廷线,RGB(0,100,50));
    红蓝带:(XA_1-XA_2)*5,COLORSTICK;
    零轴线:0,DOTLINE,COLOR0099FF;



    3、K线画三角形

    A10304:=REF(HIGH,3)=HHV(HIGH,2*3+1);

    B10304:=FILTER(A10304,3);
    C10304:=BACKSET(B10304,3+1);
    D10304:=FILTER(C10304,3);{高点}
    A20304:=REF(LOW,3)=LLV(LOW,2*3+1);
    B20304:=FILTER(A20304,3);
    C20304:=BACKSET(B20304,3+1);
    D20304:=FILTER(C20304,3);{低点}
    E10304:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;
    E20304:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}
    H10304:=(D10304 AND NOT(D20304 AND E10304>=E20304)) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
    H20304:=D10304 AND NOT(D20304 AND E10304>=E20304);
    L10304:=D20304 AND NOT(D10304 AND E10304=E20304);
    X10304:=REF(BARSLAST(H10304),1)+1;
    F10304:=BACKSET(H10304 AND COUNT(L10304,X10304)>0,LLVBARS(IF(L10304,LOW,10000),X10304));
    G10304:=F10304>REF(F10304,1);
    I10304:=BACKSET(G10304,2);
    LD0304:=I10304>REF(I10304,1);{过滤后低点}
    L20304:=LD0304 OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
    X20304:=REF(BARSLAST(L20304),1)+1;
    F2:=BACKSET(L20304 AND COUNT(H20304,X20304)>0,HHVBARS(IF(H20304,HIGH,0),X20304));
    G20304:=F2>REF(F2,1); I2:=BACKSET(G20304,2);
    HD0304:=I2>REF(I2,1);{过滤后高点}
    J1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HD0304),BARSLAST(LD0304))+1);
    J2:=J1>REF(J1,1);
    A3:=H;
    B3:=REF(H,REF(BARSLAST(HD0304),1)+1)>REF(H,REF(BARSLAST(HD0304),1)+2+REF(BARSLAST(HD0304),REF(BARSLAST(HD0304),1)+2));
    D3:=A3 AND B3 AND HD0304;
    E3:=BACKSET(D3,REF(BARSLAST(HD0304),1)+2);
    HH:=E3>REF(E3,1);{找出全部长期高点}
    A4:=L>REF(L,REF(BARSLAST(LD0304),1)+1);
    B4:=REF(L,REF(BARSLAST(LD0304),1)+1);
    D4:=A4 AND B4 AND LD0304;
    E4:=BACKSET(D4,REF(BARSLAST(LD0304),1)+2);
    LL:=E4>REF(E4,1);{找出全部长期低点}
    H3:=HH OR ISLASTBAR OR BARSCOUNT(C)=1; {后面进行过滤,方法同前。只是不用考虑高低点出现在同一K线}
    X3:=REF(BARSLAST(H3),1)+1;
    F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF(LL,L,POW(10,20)),X3));
    G3:=F3>REF(F3,1);
    I3:=BACKSET(G3,2);
    LZ:=I3>REF(I3,1); {长期低点,也可供引用}
    L4:=LZ OR ISLASTBAR OR BARSCOUNT(C)=1;
    X4:=REF(BARSLAST(L4),1)+1;
    F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-POW(10,20)),X4));
    G4:=F4>REF(F4,1);
    I4:=BACKSET(G4,2);
    HZ:=I4>REF(I4,1);{长期高点,也可供引用}
    K1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HZ),BARSLAST(LZ))+1);
    K2:=K1>REF(K1,1);
    UU:=BACKSET(ISLASTBAR,BARSLAST(LD0304)+1);
    VV:=UU>REF(UU,1);
    WW:=BACKSET(VV,REF(BARSLAST(LD0304),1)+2);
    XX:=WW>REF(WW,1);
    UU2:=BACKSET(ISLASTBAR,BARSLAST(HD0304)+1);
    VV2:=UU2>REF(UU2,1);
    WW2:=BACKSET(VV2,REF(BARSLAST(HD0304),1)+2);
    XX20304:=WW2>REF(WW2,1);


    前一低:=REF(L,BARSLAST(VV)),COLOR99FF66,LINETHICK2;
    前二低:=REF(L,BARSLAST(XX)),COLORFF66FF,LINETHICK2;
    前一高:=REF(H,BARSLAST(VV2)),COLOR99FF66,LINETHICK2;
    前二高:=REF(H,BARSLAST(XX20304)),COLORFF66FF,LINETHICK2;
    短高:=REF(H,BARSLAST(VV2));短低:=REF(L,BARSLAST(VV));
    短比:=(C-短低)/(短高-短低),NODRAW;{以下语句为三角形部分}
    底:REF(L,BARSLAST(VV)),COLORRED,LINETHICK2;
    顶:REF(H,BARSLAST(VV2)),COLORGREEN,LINETHICK2;
    {下迭三角形}
    STICKLINE(VV,顶,底,0,0),COLORFF6633,LINETHICK3;
    DRAWLINE(VV2,H,VV,L,0),COLORBLUE,LINETHICK3;{斜}
    DRAWLINE(VV2,H,VV,顶,0),COLORFF6633,LINETHICK3;{顶}
    DRAWTEXT(ISLASTBAR,顶,STRCAT((''),CON2STR(顶,2))),COLORGREEN;
    DRAWTEXT(ISLASTBAR,底,STRCAT((''),CON2STR(底,2))),COLORRED;


    {上涨三角形}
    STICKLINE(VV2 ,顶,底,0,0),COLORRED,LINETHICK3;
    DRAWLINE(VV,L,VV2,H,0),COLORRED,LINETHICK3;{斜}
    DRAWLINE(VV,L,VV2,底,0),COLORRED,LINETHICK3;


    DRAWKLINE(HIGH,OPEN,LOW,CLOSE);


    特别声明:文章内容仅供参考,不造成任何投资建议。投资者据此操作,风险自担。

    网站首页-股票知识--股票公式-散户炒股-问答百科--缠中说禅-概念股

    未经本站书面特别授权,请勿转载或建立镜像

    Copyright @ 2020 All Rights Reserved.版权所有 XMl地图
    Baidu
    map