通达信高低点定自动连线指标公式通达信公式

2017-09-01    来源:网络    编辑:翔博软件
N:=10; M:=9; X1:=DRAW LINE (HIGH=HHV(HIGH,N),HIGH,LOW=LLV(LOW,M),LOW,0); X2:=DRAWLINE(LOW=LLV(LOW,M),LOW,HIGH=HHV(HIGH,N),HIGH,0); YDD1:=LOW=LLV(LOW,M) AND X1=X2; D
N:=10;
        M:=9;
        X1:=DRAW LINE (HIGH=HHV(HIGH,N),HIGH,LOW=LLV(LOW,M),LOW,0);
        X2:=DRAWLINE(LOW=LLV(LOW,M),LOW,HIGH=HHV(HIGH,N),HIGH,0);
        YDD1:=LOW=LLV(LOW,M) AND X1=X2;
        DDTS:=BARSLAST(YDD1);
        YGD1:=HIGH=HHV(HIGH,N) AND X1=X2;
        GDTS:=BARSLAST(YGD1);
        QDDD:=LOW=LLV(LOW,M) AND LOW=LLV(LOW,GDTS) AND GDTS>1;
        QDGD:=HIGH=HHV(HIGH,N) AND HIGH=HHV(HIGH,DDTS) AND DDTS>1;
        X3:=DRAWLINE(QDGD,HIGH,QDDD,LOW,0),CO LORL IGRAY,LINETHICK3;
        X4:=DRAWLINE(QDDD,LOW,QDGD,HIGH,0),COLORLIGRAY,LINETHICK3;
        YGD:=HIGH=HHV(HIGH,N) AND X3=X4;
        YDD:=LOW=LLV(LOW,M) AND X3=X4;
        {DRAW ICON (YGD,H,23);}
        {根据相邻阶段高点之间的涨跌差值确定目标高点:大于前高5或小于前高5个点取高点}
        M1:=5;
        M2:=3;{涨跌差值};
        预前高值:=IF(YGD=1,REF(H,REF(BARSLAST(YGD),1)+1),REF(H,BARSLAST(YGD))),NODRAW;{返回上次高点的值}
        预下高TS:=REFX(BARSNEXT(YGD),1)+1;
        预下高值:=REFX(H,REFX(BARSNEXT(YGD),1)+1);
        
        下预下高TS:=REFX(预下高TS,预下高TS)=DRAWNULL;
        XH0:=(YGD AND H>预前高值 AND (H-预前高值)/预前高值*100>=M1 AND 预下高TS=DRAWNULL);
        XH1:=(YGD AND H>预前高值 AND 预下高值>0 AND 下预下高TS=1)OR(YGD AND H0 AND 下预下高TS=1);
        XH2:=(YGD AND H>预前高值 AND H>预下高值);
        XH3:=(YGD AND H>预前高值 AND H=M1);
        XH4:=YGD AND H预下高值 AND (1-H/预前高值)*100>=M2;
        XH5:=YGD AND H=M2{ AND(预下高值-H)/H*100>=M1};
        GD:=XH0 OR XH1 OR XH2 OR XH3 OR XH4 OR XH5;
        
        {本次高点,高点值,本次高点周期内到最后交易日天数}
        BCGDTS:=BARSLAST(GD);{返回本次高点到当前天数}
        BCGDDZHTS:=IF(GD,CURRBARSCOUNT,0);{本次高点到最后交易日天数}
        高点值:=IF(BCGDTS,REF(H,BCGDTS),H);{本次高点值}
        TS:=IF(BCGDTS,REF(BCGDDZHTS,BCGDTS),BCGDDZHTS);{本次高点周期内到最后交易日天数等于本次高点到最后交易日天数}
        GDCL:=CONST(TS);{取本次高点到最后交易日天数的最后一个值为常量}
        
        {类推上一次高点,高点值,本次高点周期内到最后交易日天数}
        高点值1:=REF(高点值,BCGDTS+1);{上一高点值}
        TS1:=REF(TS,BCGDTS+1);{上一高点期间到最后交易日的天数}
        GDCL1:=CONST(TS1);
        
        {类推上上一次高点,高点值,本次高点周期内到最后交易日天数}
        高点值2:=REF(高点值1,BCGDTS+1);{上上一高点值}
        TS2:=REF(TS1,BCGDTS+1);{上一高点期间到最后交易日的天数}
        GDCL2:=CONST(TS2);
        
        {类推上N高点,高点值,本次高点周期内到最后交易日天数}
        高点值3:=REF(高点值2,BCGDTS+1);
        TS3:=REF(TS2,BCGDTS+1);
        GDCL3:=CONST(TS3);
        高点值4:=REF(高点值3,BCGDTS+1);
        TS4:=REF(TS3,BCGDTS+1);
        GDCL4:=CONST(TS4);
        高点值5:=REF(高点值4,BCGDTS+1);
        TS5:=REF(TS4,BCGDTS+1);
        GDCL5:=CONST(TS5);
        高点值6:=REF(高点值5,BCGDTS+1);
        TS6:=REF(TS5,BCGDTS+1);
        GDCL6:=CONST(TS6);
        高点值7:=REF(高点值6,BCGDTS+1);
        TS7:=REF(TS6,BCGDTS+1);
        GDCL7:=CONST(TS7);
        高点值8:=REF(高点值7,BCGDTS+1);
        TS8:=REF(TS7,BCGDTS+1);
        GDCL8:=CONST(TS8);
        
        压力:DRAWLINE(CURRBARSCOUNT=GDCL,H,ISLA STBA R,REF(H,GDCL-1),1),COLORGREEN,LINETHICK2;
        压力1:DRAWLINE(CURRBARSCOUNT=GDCL1,H,ISLASTBAR,REF(H,GDCL1-1),1),COLORM AGEN TA,LINETHICK2;
        压力2:DRAWLINE(CURRBARSCOUNT=GDCL2,H,ISLASTBAR,REF(H,GDCL2-1),1),COLORYELLOW,LINETHICK2;
        压力3:DRAWLINE(CURRBARSCOUNT=GDCL3,H,ISLASTBAR,REF(H,GDCL3-1),1),COLORWHITE,LINETHICK2;
        {压力4:DRAWLINE(CURRBARSCOUNT=GDCL4,H,ISLASTBAR,REF(H,GDCL4-1),1),COLORBROWN,LINETHICK2;
        压力5:DRAWLINE(CURRBARSCOUNT=GDCL5,H,ISLASTBAR,REF(H,GDCL5-1),1),COLORGRAY,LINETHICK2;
        压力6:DRAWLINE(CURRBARSCOUNT=GDCL6,H,ISLASTBAR,REF(H,GDCL6-1),1),COLORBROWN,LINETHICK2;
        压力7:DRAWLINE(CURRBARSCOUNT=GDCL7,H,ISLASTBAR,REF(H,GDCL7-1),1),COLORYELLOW,LINETHICK2;
        压力8:DRAWLINE(CURRBARSCOUNT=GDCL8,H,ISLASTBAR,REF(H,GDCL8-1),1),COLORYELLOW,LINETHICK2;};
1
3
点击进入翔博软件旗下官方微店--指标超市