通达信自编波段高点自动划线公式(主图)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
通达信自编波段高点自动划线公式(主图){高低点定自动连线}
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) AN D 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,LI NETHICK3;
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,BARSLAS T(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,GD
CL1-1),1),COLORM AGEN TA,LINETHICK2;
压力2:DRAWLINE(CURRBARSCOUNT=GDCL2,H,ISLASTBAR,REF(H,GD CL2-1),1),COLORYELLOW,LINETHICK2;
压力3:DRAWLINE(CURRBARSCOUNT=GDCL3,H,ISLASTBAR,REF(H,GD CL3-1),1),COLORWHITE,LINETHICK2;
{压力4:DRAWLINE(CURRBARSCOUNT=GDCL4,H,ISLASTBAR,REF(H,GD CL4-1),1),COLORBROWN,LINETHICK2;
压力5:DRAWLINE(CURRBARSCOUNT=GDCL5,H,ISLASTBAR,REF(H,GD CL5-1),1),COLORGRAY,LINETHICK2;
压力6:DRAWLINE(CURRBARSCOUNT=GDCL6,H,ISLASTBAR,REF(H,GD CL6-1),1),COLORBROWN,LINETHICK2;
压力7:DRAWLINE(CURRBARSCOUNT=GDCL7,H,ISLASTBAR,REF(H,GD CL7-1),1),COLORYELLOW,LINETHICK2;
压力8:DRAWLINE(CURRBARSCOUNT=GDCL8,H,ISLASTBAR,REF(H,GD CL8-1),1),COLORYELLOW,LINETHICK2;};。