蝴蝶形态-下跌形态源码编写,黄金分割公式预测高点!
蝴蝶形态-下跌形态源码编写,黄金分割公式预测高点!
具体而言,蝴蝶形态分为上涨形态和下跌形态2种,
源码编写需要满足条件如下:
1、要想选定蝴蝶形态的X、A、B、C的位置,就需要先做出高低点
2、蝴蝶形态——上涨形态中X、A、B、C这4个点需要满足的条件是:A>C、B>X、C>B、0.382<XB<0.886
3、蝴蝶形态——下跌形态中X、A、B、C这4个点需要满足的条件是:X>B、C>A、B>C、0.382<XB<0.886
上期的文章基于蝴蝶形态编写了第1个和第2条件,本期按照第3个条件编写源码。
1、我们要基于条件1找到4个点X-A-B-C,需要手动输入K线序号标注,源码如下:
蝴蝶形态X:=243;{数值可调}
蝴蝶形态A:=165;{数值可调}
蝴蝶形态B:=138;{数值可调}
蝴蝶形态C:=126;{数值可调}
2、蝴蝶形态的下跌形态中X、A、B、C这4个点需要满足的条件是:X2>B2、C2>A2、B2>C2、0.382<XB2<0.886,源码如下:
3、找准蝴蝶形态的下跌形态中4个点X、A、B、C后,会自动生成绿色连接线和预测多个买点D1、D2、D3、D4(没有找准4个点就不会自动生成红色连接线和预测买点),源码如下:
4、完整的蝴蝶形态——下跌形态模型源码分享:(请先把源码复制到WORD文档排序,再从WORD文档中复制源码):
蝴蝶形态X:=243;{数值可调}
蝴蝶形态A:=165;{数值可调}
蝴蝶形态B:=138;{数值可调}
蝴蝶形态C:=126;{数值可调}
八戒趋势:=1;
AR1:=BARSCOUNT(C);
AR2:=CONST(AR1);
AR3:=AR2-AR1;
K线根数:AR3+1,NODRAW,COLORYELLOW;
AAG111:=REF(H,3)=HHV(H,2*6+1);
AB111:=FILTER(AAG111,3);
AC111:=BACKSET(AB111,3+1);
AD111:=FILTER(AC111,3+1);
AA112:=REF(L,3)=LLV(L,2*6+1);
AB112:=FILTER(AA112,3+1);
AC112:=BACKSET(AB112,3+1);
AD112:=FILTER(AC112,3);
AE111:=(REF(LLV(L,2*3),1)+REF(HHV(H,2*3),1))/2;
AE112:=(H+L)/2;
AH111:=(AD111 AND NOT(AD112 AND AE111>=AE112)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
AL111:=(AD112 AND NOT(AD111 AND AE111<AE112));
AH112:=AD111 AND NOT(AD112 AND AE111>=AE112);
AX111:=REF(BARSLAST(AH111),1)+1;
AF111:=BACKSET(AH111 AND COUNT(AL111,AX111)>0,LLVBARS(IF(AL111,LOW,10000),AX111));
AG111:=AF111>REF(AF111,1);
AI111:=BACKSET(AG111,2);
ALD:=AI111>REF(AI111,1);
AL112:=ALD OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
AX112:=REF(BARSLAST(AL112),1)+1;
AF112:=BACKSET(AL112 AND COUNT(AH112,AX112)>0,HHVBARS(IF(AH112,HIGH,0),AX112));
AG112:=AF112>REF(AF112,1);
AI112:=BACKSET(AG112,2);
AHD:=AI112>REF(AI112,1);
IF(八戒趋势=1,DRAWLINE(ALD,L,AHD,H,0),DRAWNULL)LINETHICK1,DOTLINE,COLOR0000FF;
IF(八戒趋势=1,DRAWLINE(AHD,H,ALD,L,0),DRAWNULL)LINETHICK1,DOTLINE,COLOR00FF00;
J111:=BACKSET(BARSTATUS=2 ,MIN(BARSLAST(AHD),BARSLAST(ALD))+1);
J112:=J111>REF(J111,1);
DRAWTEXT_FIX(1,0.95,0.01,1,'【伀|衆|号】游资八戒:“要想选定蝴蝶形态的X、A、B、C的位置,就需要先做出高低点,八戒做的“K线序号”主图可看到各高低点的K线序号值,由蓝色和咖啡色数字标注'),COLORYELLOW;
DRAWTEXT_FIX(1,0.75,0.04,1,'然后按ALT+F键,弹出参数调整窗,将各个点的K线根数值填进相应的【蝴蝶形态X-A-B-C栏】,填好后点关闭窗口即可。'),COLORYELLOW;
DRAWTEXT_FIX(1,0.55,0.07,1,'选点的要求: 反弹后的看跌形态符合X2>B2、C2>A2、B2>C2、0.382<XB2<0.886。'),COLORYELLOW;
预测走势:IF(八戒趋势=1,DRAWLINE(J112,IF(AHD,H,L),BARSTATUS=2,IF(BARSLAST(AHD)>BARSLAST(ALD),H,L),0),DRAWNULL),COLORYELLOW,DOTLINE;
K:=CURRBARSCOUNT,NODRAW;
DRAWNUMBER(八戒趋势=1 AND AHD,H,K),COLORLIRED,DRAWABOVE;
DRAWNUMBER(八戒趋势=1 AND ALD,L,K),COLORFFFF00;
QG2:=REF(H,蝴蝶形态X-1);
QL2:=REF(L,蝴蝶形态A-1);
HG2:=REF(H,蝴蝶形态B-1);
HL2:=REF(L,蝴蝶形态C-1);
XB2
HG2-QL2)/(QG2-QL2),COLORYELLOW,NODRAW; VVH5:=IF(QG2>=HG2 AND HG2>HL2 AND HL2>QL2 AND XB2>0.382 AND XB2<=0.886,QG2,DRAWNULL),NODRAW;
VVH6:=IF(QG2>=HG2 AND HG2>HL2 AND HL2>QL2 AND XB2>0.382 AND XB2<=0.886,QL2,DRAWNULL),NODRAW;
VVH7:=IF(QG2>=HG2 AND HG2>HL2 AND HL2>QL2 AND XB2>0.382 AND XB2<=0.886,HG2,DRAWNULL),NODRAW;
VVH8:=IF(QG2>=HG2 AND HG2>HL2 AND HL2>QL2 AND XB2>0.382 AND XB2<=0.886,HL2,DRAWNULL),NODRAW;
CL2:=VVH5 AND VVH6 AND VVH7 AND VVH8,NODRAW;
卖出成立:CL2,COLORGREEN,NODRAW;
QG2A:=IFC(CL2,QG2,DRAWNULL);
HG2A:=IFC(CL2,HG2,DRAWNULL);
QL2A:=IFC(CL2,QL2,DRAWNULL);
HL2A:=IFC(CL2,HL2,DRAWNULL);
VARB:=(HG2A-HL2A),NODRAW;
VAR5:=HL2A+(VARB*1.618),NODRAW;
VAR6:=HL2A+(VARB*2.000),NODRAW;
VAR7:=HL2A+(VARB*2.240),NODRAW;
VAR8:=HL2A+(VARB*2.618),NODRAW;
卖D1
RAWLINE(CURRBARSCOUNT=(蝴蝶形态C), CONST(VAR5), CURRBARSCOUNT=1,CONST(VAR5),1),COLORGREEN,DOTLINE; 卖D2
RAWLINE(CURRBARSCOUNT=(蝴蝶形态C), CONST(VAR6), CURRBARSCOUNT=1,CONST(VAR6),1),COLORGREEN,DOTLINE; 卖D3
RAWLINE(CURRBARSCOUNT=(蝴蝶形态C), CONST(VAR7), CURRBARSCOUNT=1,CONST(VAR7),1),COLORGREEN,DOTLINE; 卖D4
RAWLINE(CURRBARSCOUNT=(蝴蝶形态C), CONST(VAR8), CURRBARSCOUNT=1,CONST(VAR8),1),COLORGREEN,DOTLINE; DRAWTEXT(CURRBARSCOUNT=蝴蝶形态C,卖D1,VARCAT('卖D1=',VAR2STR(卖D1,3))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=蝴蝶形态C,卖D2,VARCAT('卖D2=',VAR2STR(卖D2,3))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=蝴蝶形态C,卖D3,VARCAT('卖D3=',VAR2STR(卖D3,3))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=蝴蝶形态C,卖D4,VARCAT('卖D4=',VAR2STR(卖D4,3))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=蝴蝶形态X,H,VARCAT('前高X2【XB2】=',VAR2STR(CONST(XB2),3))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=蝴蝶形态A,L,VARCAT('前低【A2】',VAR2STR(L,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=蝴蝶形态B,H,VARCAT('后高【B2】',VAR2STR(H,2))),COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=蝴蝶形态C,L,VARCAT('后低【C2】',VAR2STR(L,2))),COLORFF8800;
IFC(CL2,DRAWLINE(CURRBARSCOUNT=(蝴蝶形态X),H,CURRBARSCOUNT=(蝴蝶形态A),L,0),DRAWNULL)COLORGREEN,LINETHICK3;
IFC(CL2,DRAWLINE(CURRBARSCOUNT=(蝴蝶形态A),L,CURRBARSCOUNT=(蝴蝶形态B),H,0),DRAWNULL)COLORGREEN,LINETHICK3;
IFC(CL2,DRAWLINE(CURRBARSCOUNT=(蝴蝶形态B),H,CURRBARSCOUNT=(蝴蝶形态C),L,0),DRAWNULL)COLORGREEN,LINETHICK3;
IFC(CL2,DRAWLINE(CURRBARSCOUNT=(蝴蝶形态X),H,CURRBARSCOUNT=(蝴蝶形态B),H,0),DRAWNULL)COLORMAGENTA,DOTLINE;
IFC(CL2,DRAWLINE(CURRBARSCOUNT=(蝴蝶形态C),L,CURRBARSCOUNT=(蝴蝶形态C-8),卖D4,0),DRAWNULL)COLORMAGENTA,DOTLINE;
DRAWLINE(CURRBARSCOUNT=(蝴蝶形态B),H,CURRBARSCOUNT=(蝴蝶形态C),(卖D4),0),COLORMAGENTA,DOTLINE;
STICKLINE(CURRBARSCOUNT=(蝴蝶形态C),L,CONST(VAR8),0,-1),COLORMAGENTA;
DRAWICON(CURRBARSCOUNT=蝴蝶形态X,H,39);
DRAWICON(CURRBARSCOUNT=蝴蝶形态A,L,38);
DRAWICON(CURRBARSCOUNT=蝴蝶形态B,H,39);
DRAWICON(CURRBARSCOUNT=蝴蝶形态C,L,38);