缠论中枢源代码 下载本文

MA(CLOSE,5);

//福安赚差价的人,设计QQ624544691

//高低点一定是前6天和后6天的最高点和最低点//

BD1:=LOW<=LLV(LOW,6) AND REFX(LOW,1)>=LOW AND REFX(LOW,2)>=LOW AND REFX(LOW,3)>=LOW AND REFX(LOW,4)>=LOW AND REFX(LOW,5)>=LOW ;//笔高,粗选//

BG1:= HIGH>=HHV(HIGH,6) AND REFX(HIGH,1)<=HIGH AND REFX(HIGH,2)<=HIGH AND REFX(HIGH,3)<=HIGH AND REFX(HIGH,4)<=HIGH AND REFX(HIGH,5)<=HIGH ;//笔低,粗选//

BDQ:=(REFX(BD1,1)=1 AND BARSLAST(BG1)>=3)

OR (REFX(BD1,1)=1 AND COUNT(BD1,BARPOS)=0 AND COUNT(BG1,BARPOS)=0) ; BDQ1:=(BDQ AND COUNT(BDQ,BARSLAST(BG1))=1) OR ( BARSSINCE(BDQ)=0); BD2:=(BD1 AND BARSLAST(BG1)>3 AND LOW<=LLV(LOW,BARSLAST(BDQ1)) AND COUNT(BG1,BARSLAST(BDQ1))=0) OR (BD1 AND LOW<=LLV(LOW,BARSLAST(BDQ1)) AND COUNT(BG1,BARPOS)=0 ); BDDW:=BACKSET(BD2,BARSLAST(BDQ1)); //DRAWTEXT(BDDW,HIGH,'1');

//DRAWTEXT((BDDW AND REFX(BDDW,1)=0),LOW*0.94,'第二低点');//

BD3:=(BDDW AND REFX(BDDW,1)=0) OR (BDDW AND ISLASTBAR) OR (BD1 AND BARSLAST(BG1)<4);//修改过,去除高低点在同一根//

//笔高前一根//

BGQ:=(REFX(BG1,1)=1 AND BARSLAST(BD1)>=3)

OR (REFX(BG1,1)=1 AND COUNT(BD1,BARPOS)=0 AND COUNT(BG1,BARPOS)=0); //DRAWTEXT(BGQ ,HIGH,'前')COL OR YELLOW;//测试低点//

BGQ1:=(BGQ AND COUNT(BGQ,BARSLAST(BD1))=1) OR ( BARSSINCE(BGQ)=0); //DRAWTEXT(BGQ1 ,HIGH*1.03,'第一前')COL OR CYAN;//测试低点// //新笔高//

BG2:=(BG1 AND BARSLAST(BD1)>3 AND HIGH>=HHV(HIGH,BARSLAST(BGQ1)) AND COUNT(BD1,BARSLAST(BGQ1))=0 ) OR (BG1 AND HIGH>=HHV(HIGH,BARSLAST(BGQ1)) AND COUNT(BD1,BARPOS)=0 ); BGDW:=BACKSET(BG2,BARSLAST(BGQ1));

//DRAWTEXT((BGDW AND REFX(BGDW,1)=0),HIGH*1.03,'第二高');// BG3:=(BGDW AND REFX(BGDW,1)=0) OR (BG1 AND BARSLAST(BD1)<4) ;

//跟前面的笔高距离小于4,并且价格是最低的// //笔低前一根//

(BGDW AND ISLASTBAR) OR

BDQ30:=(REFX(BD1,1)=1 ) OR (REFX(BD1,1)=1 AND COUNT(BD1,BARPOS)=0 AND COUNT(BG1,BARPOS)=0) ; BDQ130:=(BDQ30 AND COUNT(BDQ30,BARSLAST(BG1))=1)

OR ( BARSSINCE(BDQ30)=0);

//DRAWTEXT(BDQ ,LOW*0.98,'前')COL OR YELLOW;//测试低点// //DRAWTEXT(BDQ1,LOW*0.96,'第一前')COL OR CYAN;//测试低点// //新BD2//

BD230:=(BD1 AND LOW<=LLV(LOW,BARSLAST(BDQ130)) AND COUNT(BG1,BARSLAST(BDQ130))=0 ) OR (BD1 AND LOW<=LLV(LOW,BARSLAST(BDQ130)) AND COUNT(BG1,BARPOS)=0 ); BDDW30:=BACKSET(BD230,BARSLAST(BDQ130)); BD4:=BDDW30 AND REFX(BDDW30,1)=0;

BD5:=BD3 OR (BD4 AND BARSLAST(BG1)<4 ) ;

//跟前面的笔低距离小于4,并且价格是最高的// //笔高前一根//

BGQ30:=(REFX(BG1,1)=1 )

OR (REFX(BG1,1)=1 AND COUNT(BD1,BARPOS)=0 AND COUNT(BG1,BARPOS)=0); //DRAWTEXT(BGQ ,HIGH,'前')COL OR YELLOW;//测试低点// BGQ130:=(BGQ30 AND COUNT(BGQ30,BARSLAST(BD1))=1) ( BARSSINCE(BGQ30)=0);

//DRAWTEXT(BGQ1 ,HIGH*1.03,'第一前')COL OR CYAN;//测试低点// //新笔高//

OR

BG230:=(BG1 AND HIGH>=HHV(HIGH,BARSLAST(BGQ130)) AND COUNT(BD1,BARSLAST(BGQ130))=0) OR (BG1 AND HIGH>=HHV(HIGH,BARSLAST(BGQ130)) AND COUNT(BD1,BARPOS)=0 ); BGDW30:=BACKSET(BG230,BARSLAST(BGQ130)); BG4:=BGDW30 AND REFX(BGDW30,1)=0;

BG5:=BG3 OR (BG4 AND BARSLAST(BD1)<4) ;

//去掉绝对错误低点//

BD6:=(BD5 AND LOW>=REF(HIGH,BARSLAST(BG5)) ) ;//最低价大于前笔高//

BD7:= BD5 AND REFX(HIGH,1)>=REF(HIGH,BARSLAST(BG5)) ;//笔低后面一根最高价大于前高//

//DRAWTEXT(BD7,HIGH,'错误低点');//

BD:=BD5 AND BD6=0 AND BD7=0;

//去掉绝对错误高点//

BG6:=BG5 AND HIGH<=REF(LOW,BARSLAST(BD5));

BG7:=BG5 AND REFX(LOW,1)<=REF(LOW,BARSLAST(BD5)) ; BG:= BG5 AND BG6=0 AND BG7=0;

//DRAWTEXT(BD5 ,LOW,'低点')COL OR RED;//测试低点// //DRAWTEXT(BG5,HIGH,'高点')COL OR GREEN;//测试高点// //DRAWTEXT(BD1 ,LOW,'低点') ;//测试低点// //DRAWTEXT(BG1,HIGH,'高点') ;//测试高点// //DRAWTEXT(BD,LOW ,'Y低点');//测试低点// //DRAWTEXT(BG,HIGH ,'Y高点') ;//测试高点//

JQD:=BARSLAST(BD);//距前低// JQG:=BARSLAST(BG);//距前高// //K线包含处理//

//前面顶部左侧K线第1根是否跟前一根重合//

DQBHGG:=(REF(LOW,JQG+1)<=REF(LOW,JQG+2) AND REF(HIGH,JQG+1)>=REF(HIGH,JQG+2)) OR (REF(LOW,JQG+1)>=REF(LOW,JQG+2) AND REF(HIGH,JQG+1)<=REF(HIGH,JQG+2));

//前面底部的左侧第一根K线是否跟前一根重合//

DDQQBBHH:=(REF(LOW,JQD+1)<=REF(LOW,JQD+2) AND REF(HIGH,JQD+1)>=REF(HIGH,JQD+2)) OR (REF(LOW,JQD+1)>=REF(LOW,JQD+2) AND REF(HIGH,JQD+1)<=REF(HIGH,JQD+2));

//当前位置左右侧跟前面高点点最高点是否包含判断//

ADQGYCA:=(REFX(LOW,1)<=REFX(LOW,2) AND REFX(HIGH,1)>=REFX(HIGH,2)) OR (REFX(LOW,1)>=REFX(LOW,2) AND REFX(HIGH,JQG+1)<=REFX(HIGH,2));

KAKDZC:=(REF(LOW,1)<=REF(LOW,2) AND REF(HIGH,1)>=REF(HIGH,2)) OR (REF(LOW,1)>=REF(LOW,2) AND REF(HIGH,JQG+1)<=REF(HIGH,2));

BKDQDYC:=(REFX(LOW,1)<=REFX(LOW,2) AND REFX(HIGH,1)>=REFX(HIGH,2)) OR (REFX(LOW,1)>=REFX(LOW,2) AND REFX(HIGH,JQG+1)<=REFX(HIGH,2));

JKDQDZCA:=(REF(LOW,1)<=REF(LOW,2) AND REF(HIGH,1)>=REF(HIGH,2)) OR (REF(LOW,1)>=REF(LOW,2) AND REF(HIGH,JQG+1)<=REF(HIGH,2)); //包含成立取最大值// //按前面顺序//

DZD:=MIN(REF(HIGH,JQD+1),REF(HIGH,JQD+2)); GZD:=MAX(REF(LOW,JQG+1),REF(LOW,JQG+2));

DQGYC:=MAX(REFX(LOW,1),REFX(LOW,2) );//当前是顶分型,取低点最大值// DQGZC:=MAX(REF(LOW,1),REF(LOW,2));

DQDYC:=MIN(REFX(HIGH,1),REFX(HIGH,2) );//当前是底分型,取高点最小值// DQDZC:=MIN(REF(HIGH,1),REF(HIGH,2)); //高低点包含关系//

BBDQBH:=LOW

//顶分型底分型包含判断//

BDB:=(BD AND LOW

>IFELSE(JKDQDZCA,DQDZC,REF(HIGH,1)) AND REF(HIGH,JQG)>IFELSE(BKDQDYC,DQDYC,REFX(HIGH,1))

AND LOW=REF(HIGH,JQG+1) AND REF(LOW,JQG)<=REF(LOW,JQG+1)),REF(LOW,JQG+2),REF(LOW,JQG+1)) AND LOW=REF(HIGH,JQG-1)

AND REF(LOW,JQG)<=REF(LOW,JQG-1),REF(LOW,JQG-2),REF(LOW,JQG-1)) AND REF(HIGH,JQG)>IFELSE(LOW<=REFX(LOW,1) AND HIGH>=REFX(HIGH,1) AND LOW<=REF(LOW,1) AND HIGH>=REF(HIGH,1),REFX(HIGH,2),REFX(HIGH,1))) OR (BARSSINCE(BD)=0 AND COUNT(BG ,BARPOS)=0) OR (BARSSINCE(BD)=0 AND COUNT(BG ,BARPOS)=1 AND BARSLAST(BG)>=4 AND LOW

; //当前底分型,最后一句包含缺口情况 AND LOW

BGB:=(BG AND REF(LOW,JQD)REF(CLOSE,JQD+2)

AND HIGH>IFELSE(DDQQBBHH,DZD,REF(HIGH,JQD+1))

AND REF(LOW,JQD)IFELSE(REF(LOW,JQD)<=REF(LOW,JQD+1)

AND REF(HIGH,JQD)>REF(HIGH,JQD+1),REF(HIGH,JQD+2),REF(HIGH,JQD+1)) AND HIGH>IFELSE(REF(LOW,JQD)<=REF(LOW,JQD-1)

AND REF(HIGH,JQD)>REF(HIGH,JQD-1),REF(HIGH,JQD-2),REF(HIGH,JQD-1)) AND REF(LOW,JQD)=REFX(HIGH,1) AND LOW<=REFX(LOW,1) AND HIGH>=REF(HIGH,1) AND LOW<=REF(LOW,1),REFX(LOW,2),REFX(LOW,1))) OR (BARSSINCE(BG)=0 AND COUNT(BD ,BARPOS)=0) OR (BARSSINCE(BG)=0 AND COUNT(BD ,BARPOS)=1 AND BARSLAST(BD)>=4 AND HIGH>REF(LOW,BARSLAST(BD)) AND HIGH>REF(HIGH,BARSLAST(BD)-1) AND REF(LOW,1)>REF(LOW,BARSLAST(BD)) AND REFX(LOW,1)>REF(LOW,BARSLAST(BD)))

;//当前顶分型,最后一句是包含缺口情况 AND HIGH>REF(HIGH,JQD)//

//DRAWTEXT(BDB,LOW*0.98,'低点')COL OR RED;//测试低点// //DRAWTEXT(BGB,HIGH,'高点')COL OR GREEN;//测试高点// //HIGH*1.05;//

//合并同向高低点//

JQD1:=BARSLAST(BDB);//距前低// JQG1:=BARSLAST(BGB);//距前高// //笔高前一根//

BBGQ:=(REFX(BGB,1)=1 AND BARSLAST(BDB)>=3 ) OR (REFX(BGB,1)=1 AND COUNT(BDB,BARPOS)=0 AND COUNT(BGB,BARPOS)=0);

//DRAWTEXT(BBGQ ,HIGH,'前')COL OR YELLOW;//测试低点//

BBGQ1:=(BBGQ AND COUNT(BBGQ,BARSLAST(BDB))=1) OR ( BARSSINCE(BBGQ)=0); //DRAWTEXT(BBGQ1 ,HIGH*1.05,'第一前')COL OR CYAN;//测试低点//

//新笔高////合并高点,只合并到距离前低5根K线部分//

GG2:=(BGB AND BARSLAST(BDB)>3 AND HIGH>=HHV(HIGH,BARSLAST(BBGQ1)) AND COUNT(BDB,BARSLAST(BBGQ1))=0);

GG:=BACKSET(GG2,BARSLAST(BBGQ1));

//DRAWTEXT(GG,HIGH,'1')COL OR YELLOW;//测试低点//

//DRAWTEXT((GG AND REFX(GG,1)=0),HIGH*1.03,'二高');//

XZBG1:=BGB AND BARSLAST(BDB)<4 ;//保留近高//

ZGD:=((GG AND REFX(GG,1)=0) OR XZBG1) OR (GG AND ISLASTBAR) (BARSSINCE(BGB)=0 AND COUNT(BDB,BARPOS)=0);//获取特殊高序列//

//新笔低// //笔低前一根//

BBDQ:=(REFX(BDB,1)=1 AND BARSLAST(BGB)>=3)

OR (REFX(BDB,1)=1 AND COUNT(BDB,BARPOS)=0 AND COUNT(BGB,BARPOS)=0); BBDQ1:=(BBDQ AND COUNT(BBDQ,BARSLAST(BGB))=1) OR ( BARSSINCE(BBDQ)=0); //DRAWTEXT(BBDQ ,LOW*0.98,'前')COL OR YELLOW;//测试低点// //DRAWTEXT(BBDQ1,LOW*0.96,'第一前')COL OR CYAN;//测试低点// //新BD2//

DD2:=(BDB AND BARSLAST(BGB)>3 AND LOW<=LLV(LOW,BARSLAST(BBDQ1)) AND COUNT(BGB,BARSLAST(BBDQ1))=0); DD:=BACKSET(DD2,BARSLAST(BBDQ1)); //DRAWTEXT(DD,HIGH,'1');

//DRAWTEXT((DD AND REFX(DD,1)=0),LOW*0.94,'第二低点');//

XZBD1:=BDB AND BARSLAST(BGB)<4;//保留近低//

ZDD:=((DD AND REFX(DD,1)=0) OR XZBD1) OR (DD AND ISLASTBAR) (BARSSINCE(BDB)=0 AND COUNT(BGB,BARPOS)=0);//获取特殊低序列//

//精选点//

//DRAWTEXT(ZGD,HIGH*1.03,'ZGD')COL OR WHITE DRAWABOVE; //DRAWTEXT(ZDD,LOW*0.97,'ZDD')COL OR YELLOW DRAWABOVE; //DRAWTEXT(BDB,LOW,'P低点')COL OR CYAN DRAWABOVE; //DRAWTEXT(BGB,HIGH,'P高点')COL OR RED DRAWABOVE;

OR

OR

//定义特征高低点后的,顶分型和底分型//

FXD:=LOW<=REF(LOW,1) AND REFX(LOW,1)>=LOW AND REFX(LOW,2)>=LOW AND REFX(LOW,3)>=LOW AND REFX(LOW,4)>=LOW AND REFX(LOW,5)>=LOW ; //DRAWTEXT(FXD,LOW,'FXD'); //找出特征低点//

TZD:=BACKSET(ZDD AND BARSLAST(ZGD)<4 ,BARSLAST(ZGD));//特征低点向前赋值// TZDD:=(TZD AND REFX(TZD,1)=0) OR (TZD AND ISLASTBAR);//定位特征低点// //DRAWTEXT(TZDD,HIGH,'特征低点');//

TZG:=BACKSET(ZGD AND BARSLAST(ZDD)<4 ,BARSLAST(ZDD)); TZGG:=(TZG AND REFX(TZG,1)=0) OR (TZG AND ISLASTBAR); ZQGD:= BARSSINCE(ZGD)=0 AND COUNT(ZDD,BARPOS)=0;

JZD:=(TZDD AND REF(TZGG,BARSLAST(ZGD))=0 AND REF(REF(TZDD,BARSLAST(ZDD)),1)=0) OR (TZDD AND REF(ZQGD,BARSLAST(ZGD))) ;//找出特征低点//

TZDQC:=BACKSET(JZD,BARSLAST(ZGD));//这地方等等再思考//

TZDDDDFZ:=(TZDQC AND REFX(TZDQC,1)=0) OR (TZDQC AND ISLASTBAR); //DRAWTEXT(TZDDDDFZ,LOW*0.98,'去除低点')COL OR MAGENTA ;

//找出符合条件底分型//

JQD9:=BARSLAST(ZDD);//距前低// JQG9:=BARSLAST(ZGD);//距前高//

//K线包含处理//

//前面顶部左侧K线第1根是否跟前一根重合//

DQBHGG9:=(REF(LOW,JQG9+1)<=REF(LOW,JQG9+2) AND REF(HIGH,JQG9+1)>=REF(HIGH,JQG9+2)) OR (REF(LOW,JQG9+1)>=REF(LOW,JQG9+2) AND REF(HIGH,JQG9+1)<=REF(HIGH,JQG9+2));

//前面底部的左侧第一根K线是否跟前一根重合//

DDQQBBHH9:=(REF(LOW,JQD9+1)<=REF(LOW,JQD9+2) AND REF(HIGH,JQD9+1)>=REF(HIGH,JQD9+2)) OR (REF(LOW,JQD9+1)>=REF(LOW,JQD9+2) AND REF(HIGH,JQD9+1)<=REF(HIGH,JQD9+2));

//当前位置左右侧跟前面高点点最高点是否包含判断//

ADQGYCA9:=(REFX(LOW,1)<=REFX(LOW,2) AND REFX(HIGH,1)>=REFX(HIGH,2)) OR (REFX(LOW,1)>=REFX(LOW,2) AND REFX(HIGH,JQG9+1)<=REFX(HIGH,2));

KAKDZC9:=(REF(LOW,1)<=REF(LOW,2) AND REF(HIGH,1)>=REF(HIGH,2)) OR (REF(LOW,1)>=REF(LOW,2) AND REF(HIGH,JQG9+1)<=REF(HIGH,2));

BKDQDYC9:=(REFX(LOW,1)<=REFX(LOW,2) AND REFX(HIGH,1)>=REFX(HIGH,2)) OR (REFX(LOW,1)>=REFX(LOW,2) AND REFX(HIGH,JQG9+1)<=REFX(HIGH,2));

JKDQDZCA9:=(REF(LOW,1)<=REF(LOW,2) AND REF(HIGH,1)>=REF(HIGH,2)) OR (REF(LOW,1)>=REF(LOW,2) AND REF(HIGH,JQG9+1)<=REF(HIGH,2)); //包含成立取最大值//

//按前面顺序//

DZD9:=MIN(REF(HIGH,JQD9+1),REF(HIGH,JQD9+2)); GZD9:=MAX(REF(LOW,JQG9+1),REF(LOW,JQG9+2));

DQGYC9:=MAX(REFX(LOW,1),REFX(LOW,2) );//当前是顶分型,取低点最大值// DQGZC9:=MAX(REF(LOW,1),REF(LOW,2));

DQDYC9:=MIN(REFX(HIGH,1),REFX(HIGH,2) );//当前是底分型,取高点最小值// DQDZC9:=MIN(REF(HIGH,1),REF(HIGH,2)); //高低点包含关系//

BBDQBH9:=LOW

//找出特征低点后符合条件的底分型//

FHFXD:= BARSLAST(ZDD)=4 AND FXD AND COUNT(ZDD,BARSLAST(ZGD))=1 AND REF(TZDDDDFZ,BARSLAST(ZDD)) AND HIGH

//DRAWTEXT(FHFXD,LOW,'底分型')COL OR RED; //顶分型底分型包含判断//

BDB9:=(FHFXD AND LOWIFELSE(JKDQDZCA9,DQDZC9,REF(HIGH,1)) AND REF(HIGH,JQG9)>IFELSE(BKDQDYC9,DQDYC9,REFX(HIGH,1))

AND LOW=REF(HIGH,JQG9+1)

AND REF(LOW,JQG9)<=REF(LOW,JQG9+1)),REF(LOW,JQG9+2),REF(LOW,JQG9+1)) AND LOW=REF(HIGH,JQG9-1)

AND REF(LOW,JQG9)<=REF(LOW,JQG9-1),REF(LOW,JQG9-2),REF(LOW,JQG9-1)) AND REF(HIGH,JQG9)>IFELSE(LOW<=REFX(LOW,1) AND HIGH>=REFX(HIGH,1) AND LOW<=REF(LOW,1) AND HIGH>=REF(HIGH,1),REFX(HIGH,2),REFX(HIGH,1)) ); //当前底分型,最后一句包含缺口情况 AND LOW

//DRAWTEXT(BDB9,LOW*0.98,'底分型')COL OR YELLOW;

//定位第一个底分型// //定位底分型左边一根//

DFXZC1:=REFX(BDB9,1)=1 ;

DFXZC:=DFXZC1 AND COUNT(DFXZC1,BARSLAST(ZGD))=1; //DRAWTEXT(BARSNEXT(BDB9)=1,LOW,'前')COL OR RED; //DRAWTEXT(DFXZC,HIGH,'第一前')COL OR GREEN;//

DWDFXZCFZ:=BACKSET(BDB9 AND LOW<=LLV(LOW,BARSLAST(DFXZC)) AND COUNT(ZGD,BARSLAST(DFXZC))=0,BARSLAST(DFXZC));

DWDYZC:=DWDFXZCFZ AND REFX(DWDFXZCFZ,1)=0;

//DRAWTEXT(DWDYZC,LOW*0.95,'Z底分型')COL OR CYAN;//

TZDQCHD1:=((ZDD AND TZDDDDFZ=0) OR DWDYZC) (DWDFXZCFZ AND ISLASTBAR)

(BARSSINCE(ZDD)=0 AND COUNT(ZGD,BARPOS)=0) ;//特征低去除后低点,产生新低点序列记为TZDQCHD//

//DRAWTEXT(TZDQCHD1,LOW*0.95,'新低序列')COL OR RED;//

//合并低点//

DDQ:=(REFX(TZDQCHD1,1)=1 ) OR

(REFX(TZDQCHD1,1)=1 AND COUNT(ZGD,BARPOS)=0 AND COUNT(TZDQCHD1,BARPOS)=0);

//DRAWTEXT(DDQ,LOW,'前');

DDQ1:=(DDQ AND COUNT(DDQ,BARSLAST(ZGD))=1) OR (BARSSINCE(DDQ)=0); //DRAWTEXT(DDQ1,LOW*0.98,'第一前')COL OR CYAN;//

TZDCJDW:=BACKSET(TZDQCHD1 AND LOW<=LLV(LOW,BARSLAST(DDQ1)) AND COUNT(ZGD,BARSLAST(DDQ1))=0,BARSLAST(DDQ1)); //DRAWTEXT(TZDCJDW ,HIGH,'1')COL OR GREEN;//

TZDQCHD:=(TZDCJDW AND REFX(TZDCJDW,1)=0) OR (TZDCJDW AND ISLASTBAR); //验证//

//DRAWTEXT(TZDQCHD,LOW*0.98,'新低') ; //合并高点//

GDQQ:=(REFX(ZGD,1)=1 )

OR (REFX(ZGD,1)=1 AND COUNT(ZGD,BARPOS)=0 AND COUNT(TZDQCHD,BARPOS)=0);//高点前一根//

GDQQ1:=(GDQQ AND COUNT(GDQQ,BARSLAST(TZDQCHD))=1) OR (BARSSINCE(GDQQ)=0);

FZXGD:=BACKSET(ZGD AND HIGH>=HHV(HIGH,BARSLAST(GDQQ1)) AND COUNT(TZDQCHD,BARSLAST(GDQQ1))=0 ,BARSLAST(GDQQ1) );//赋值新高点,合并,修改过,添加COUNT(ZDD,BARSLAST(GDQQ1))=0// //验证//

//DRAWTEXT(FZXGD,HIGH,'1');

//DRAWTEXT(GDQQ,HIGH,'前')COL OR MAGENTA;

//DRAWTEXT(GDQQ1,HIGH*0.95,'第一前')COL OR CYAN;//

//合并低点后形成的新高点//

TZDQCHG:=((FZXGD AND REFX(FZXGD,1)=0)) OR (FZXGD AND ISLASTBAR) ; //DRAWTEXT(TZDQCHG,HIGH,'新高') ;

OR OR

//找出特征高点//

TZD1:=BACKSET(TZDQCHD AND BARSLAST(TZDQCHG)<4 ,BARSLAST(TZDQCHG));//标记特征低点//

TZDD1:=(TZD1 AND REFX(TZD1,1)=0) OR (TZD1 AND ISLASTBAR);//区分特征低点序列//

TZG1:=BACKSET(TZDQCHG AND BARSLAST(TZDQCHD)<4 ,BARSLAST(TZDQCHD));//标记特征高点//

TZGG1:=(TZG1 AND REFX(TZG1,1)=0) OR (TZG1 AND ISLASTBAR);//区分特征高点序列//

ZQDD:=ZDD AND COUNT(ZGD,BARPOS)=0;//最前低点//

JZG1:=(TZGG1 AND REF(TZDD1,BARSLAST(TZDQCHD))=0 AND REF(REF(TZGG1,BARSLAST(TZDQCHG)),1)=0) OR (TZGG1 AND REF(ZQDD,BARSLAST(TZDQCHD)));//找出特征高点//

TZGQC1:=BACKSET(JZG1,BARSLAST(TZDQCHD));//去除特征高//

TZGQCFZ:=(TZGQC1 AND REFX(TZGQC1,1)=0) OR (TZGQC1 AND ISLASTBAR);//标记定位特征高//

//DRAWTEXT(TZGQCFZ,HIGH*1.05,'去除高点')COL OR MAGENTA;

//定义顶分型//

FXG:= HIGH>=REF(HIGH,1) AND REFX(HIGH,1)<=HIGH;

//找出符合条件底分型//

JQD10:=BARSLAST(TZDQCHD);//距前低// JQG10:=BARSLAST(TZDQCHG);//距前高//

//K线包含处理//

//前面顶部左侧K线第1根是否跟前一根重合//

DQBHGG10:=(REF(LOW,JQG10+1)<=REF(LOW,JQG10+2) AND REF(HIGH,JQG10+1)>=REF(HIGH,JQG10+2)) OR (REF(LOW,JQG10+1)>=REF(LOW,JQG10+2) AND REF(HIGH,JQG10+1)<=REF(HIGH,JQG10+2));

//前面底部的左侧第一根K线是否跟前一根重合//

DDQQBBHH10:=(REF(LOW,JQD10+1)<=REF(LOW,JQD10+2) AND REF(HIGH,JQD10+1)>=REF(HIGH,JQD10+2)) OR (REF(LOW,JQD10+1)>=REF(LOW,JQD10+2) AND REF(HIGH,JQD10+1)<=REF(HIGH,JQD10+2));

//当前位置左右侧跟前面高点点最高点是否包含判断//

ADQGYCA10:=(REFX(LOW,1)<=REFX(LOW,2) AND REFX(HIGH,1)>=REFX(HIGH,2)) OR (REFX(LOW,1)>=REFX(LOW,2) AND REFX(HIGH,JQG10+1)<=REFX(HIGH,2));

KAKDZC10:=(REF(LOW,1)<=REF(LOW,2) AND REF(HIGH,1)>=REF(HIGH,2)) OR (REF(LOW,1)>=REF(LOW,2) AND REF(HIGH,JQG10+1)<=REF(HIGH,2));

BKDQDYC10:=(REFX(LOW,1)<=REFX(LOW,2) AND REFX(HIGH,1)>=REFX(HIGH,2)) OR (REFX(LOW,1)>=REFX(LOW,2) AND REFX(HIGH,JQG10+1)<=REFX(HIGH,2));

JKDQDZCA10:=(REF(LOW,1)<=REF(LOW,2) AND REF(HIGH,1)>=REF(HIGH,2)) OR (R

EF(LOW,1)>=REF(LOW,2) AND REF(HIGH,JQG10+1)<=REF(HIGH,2)); //包含成立取最大值// //按前面顺序//

DZD10:=MIN(REF(HIGH,JQD10+1),REF(HIGH,JQD10+2)); GZD10:=MAX(REF(LOW,JQG10+1),REF(LOW,JQG10+2));

DQGYC10:=MAX(REFX(LOW,1),REFX(LOW,2) );//当前是顶分型,取低点最大值// DQGZC10:=MAX(REF(LOW,1),REF(LOW,2));

DQDYC10:=MIN(REFX(HIGH,1),REFX(HIGH,2) );//当前是底分型,取高点最小值// DQDZC10:=MIN(REF(HIGH,1),REF(HIGH,2)); //高低点包含关系//

BBDQBH10:=LOW

//找出特征高点后符合条件的顶分型//

FHFXG:=

BARSLAST(TZDQCHD)>BARSLAST(TZDQCHG) AND BARSLAST(TZDQCHD)>=4 AND FXG AND COUNT(TZDQCHG,BARSLAST(TZDQCHD))=1 AND REF(TZGQCFZ,BARSLAST(TZDQCHG)) AND HIGH>REF(HIGH,BARSLAST(TZDQCHD)); //DRAWTEXT(FHFXG,HIGH*1.03,'顶分型')COL OR YELLOW; //顶分型底分型包含判断//

BGB10:=(FHFXG AND HIGH>IFELSE(DDQQBBHH10,DZD10,REF(HIGH,JQD10+1)) AND REF(LOW,JQD10)REF(CLOSE,JQD10+2) AND HIGH>IFELSE(REF(LOW,JQD10)<=REF(LOW,JQD10+1)

AND REF(HIGH,JQD10)>REF(HIGH,JQD10+1),REF(HIGH,JQD10+2),REF(HIGH,JQD10+1)) AND HIGH>IFELSE(REF(LOW,JQD10)<=REF(LOW,JQD10-1) AND REF(HIGH,JQD10)>REF(HIGH,JQD10-1),REF(HIGH,JQD10-2),REF(HIGH,JQD10-1)) AND REF(LOW,JQD10)=REFX(HIGH,1) AND LOW<=REFX(LOW,1) AND HIGH>=REF(HIGH,1) AND LOW<=REF(LOW,1),REFX(LOW,2),REFX(LOW,1)));//当前顶分型,最后一句是包含缺口情况 AND HIGH>REF(HIGH,JQD)//

//DRAWTEXT(BGB10,HIGH,'顶分型')COL OR RED;//

//定位顶分型左边一根//

GFXZC1:=REFX(BGB10,1)=1;

GFXZC:=GFXZC1 AND COUNT(GFXZC1,BARSLAST(TZDQCHG))=1; //赋值第一个CFXZC//

//DRAWTEXT(BARSNEXT(BGB10)=1 ,LOW,'前')COL OR RED; //DRAWTEXT(GFXZC,HIGH,'第一前')COL OR GREEN;//

DWGFXZCFZ:=BACKSET(BGB10 AND HIGH>=HHV(HIGH,BARSLAST(GFXZC)) AND COUNT(TZDQCHD,BARSLAST(GFXZC))=0,BARSLAST(GFXZC)); //DRAWTEXT(DWGFXZCFZ,HIGH,'1');//

DWDYGZC:=(DWGFXZCFZ AND REFX(DWGFXZCFZ,1)=0) OR (DWGFXZCFZ AND ISLASTBAR);

//DRAWTEXT(DWDYGZC,HIGH*1.03,'Z顶分型')COL OR CYAN;//

TZGQCHGG1:=((TZDQCHG AND TZGQCFZ=0) OR DWDYGZC) OR (BARSSINCE(ZGD)=0 AND COUNT(TZDQCHD,BARPOS)=0);//特征高去除后低点,产生新高点序列记为TZGQCHG1//; //验证//

//DRAWTEXT(TZDQCHG AND TZGQCFZ=0,HIGH,'高点')COL OR MAGENTA;// //合并高点//

ZZGQ:=REFX(TZGQCHGG1,1)=1;

ZZGQ1:=(ZZGQ AND COUNT(ZZGQ,BARSLAST(TZDQCHD))=1) OR (BARSSINCE(ZZGQ)=0);

TZGDZZFZ:=BACKSET(TZGQCHGG1 AND HIGH>=HHV(HIGH,BARSLAST(ZZGQ1)) AND COUNT(TZDQCHD,BARSLAST(ZZGQ1))=0,BARSLAST(ZZGQ1)); //验证//

//DRAWTEXT(ZZGQ,HIGH,'前')COL OR MAGENTA;

//DRAWTEXT(ZZGQ1,HIGH*0.95,'第一前')COL OR CYAN;//

TZGQCHG1:=(TZGDZZFZ AND REFX(TZGDZZFZ,1)=0) (TZGDZZFZ AND ISLASTBAR)

(BARSSINCE(TZGQCHGG1)=0 AND COUNT(TZDQCHD,BARPOS)=0); //最新高//

//DRAWTEXT(TZGQCHG1,HIGH*0.98,'新高')COL OR MAGENTA;// //合并低点//

ZZDDQ:=REFX(TZDQCHD,1)=1;//相对上一新高点,合并低点,定义新低点//

OR OR

ZZDDQ1:=(ZZDDQ AND COUNT(ZZDDQ,BARSLAST(TZGQCHG1))=1) OR (BARSSINCE(ZZDDQ)=0);

FZXDD1:=BACKSET(TZDQCHD AND LOW<=LLV(LOW,BARSLAST(ZZDDQ1)) AND COUNT(TZGQCHG1,BARSLAST(ZZDDQ1))=0 ,BARSLAST(ZZDDQ1));//赋值新高点,合并// //验证//

//DRAWTEXT(ZZDDQ,HIGH,'前')COL OR MAGENTA;

//DRAWTEXT(ZZDDQ1,HIGH*0.95,'第一前')COL OR CYAN;//

TZGQCHD1:=(FZXDD1 AND REFX(FZXDD1,1)=0) OR (FZXDD1 AND ISLASTBAR) OR (BARSSINCE(TZDQCHD)=0 AND COUNT(TZGQCHG1,BARPOS)=0);//合并低点后形成的新低点//

//再次去除特征高低点//

BBD:=TZGQCHD1; BBG:=TZGQCHG1;

C1:=BBG OR BBD;

POLYLINE( C1,IFELSE(BBD,LOW,HIGH) COLORGREEN) ) ,POINTDOT;

, IFELSE(BBD,COLORRED,