很久前写的帝纳波利的"黄金折返"送给需要的朋友.
参数设置见附图:
源码:
TL:=1000000+DA;
TH:=1000000+DB;
TC:=1000000+DC;
TO:=1000000+DO;
AL:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(HIGH,TL),REFDATE(LOW,TL));
BH:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(LOW,TH),REFDATE(HIGH,TH));
CZF:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(HIGH,TC),REFDATE(LOW,TC));
DJB:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(LOW,TO),REFDATE(HIGH,TO));
OP:=BH-AL+CZF;
COP:=0.618*(BH-AL)+CZF;
XOP:=IF((1.618*(BH-AL)+CZF)<0,OP,1.618*(BH-AL)+CZF);
TODAY:=DATE;
STICKLINE(DATE=TC,CZF,XOP,0,-1),LINETHICK3,COLORLIMAGENTA;
DRAWLINE(DATE=TC,COP,DATE=TODAY,COP,1),LINETHICK3,POINTDOT,COLORLIMAGENTA;
DRAWLINE(DATE=TC,OP,DATE=TODAY,OP,1),LINETHICK3,POINTDOT,COLORLIMAGENTA;
DRAWLINE(DATE=TC,XOP,DATE=TODAY,XOP,1),LINETHICK3,POINTDOT,COLORLIMAGENTA;
DRAWTEXT(DATE=TC,COP,'COP');
DRAWTEXT(DATE=TC,OP,'OP');
DRAWTEXT(DATE=TC,XOP,'XOP');
DRAWLINE(DATE=TO,DJB,DATE=TL,AL,0),LINETHICK3,POINTDOT,COLORWHITE;
DRAWLINE(DATE=TL,AL,DATE=TH,BH,0),COLORLIMAGENTA;
DRAWLINE(DATE=TH,BH,DATE=TC,CZF,0),COLORLIMAGENTA;
F3:=(BH-0.382*(BH-AL));
F5:=(BH-0.5*(BH-AL));
F6:=(BH-0.618*(BH-AL));
DRAWLINE(DATE=TH,F3,DATE=TODAY,F3,1),LINETHICK1,POINTDOT,COLORCYAN;
DRAWLINE(DATE=TH,F5,DATE=TODAY,F5,1),LINETHICK1,POINTDOT,COLORCYAN;
DRAWLINE(DATE=TH,F6,DATE=TODAY,F6,1),LINETHICK1,POINTDOT,COLORCYAN;
DRAWTEXT(DATE=TH,F3,'0.382');
DRAWTEXT(DATE=TH,F5,'0.5');
DRAWTEXT(DATE=TH,F6,'0.618');
FF3:=(AL-0.382*(AL-DJB));
FF5:=(AL-0.5*(AL-DJB));
FF6:=(AL-0.618*(AL-DJB));
DRAWLINE(DATE=TL,FF3,DATE=TODAY,FF3,1),LINETHICK1,POINTDOT,COLORWHITE;
DRAWLINE(DATE=TL,FF5,DATE=TODAY,FF5,1),LINETHICK1,POINTDOT,COLORWHITE;
DRAWLINE(DATE=TL,FF6,DATE=TODAY,FF6,1),LINETHICK1,POINTDOT,COLORWHITE;
DRAWTEXT(DATE=TL,FF3,'0.382');
DRAWTEXT(DATE=TL,FF5,'0.5');
DRAWTEXT(DATE=TL,FF6,'0.618');
DMA1:=REF(MA(CLOSE,3),3),COLORWHITE;
TL1:=1000000+DA1;
TH1:=1000000+DB1;
TC1:=1000000+DC1;
TO1:=1000000+DO1;
AL1:=IF(REFDATE(CLOSE,TL1)>REFDATE(CLOSE,TH1),REFDATE(HIGH,TL1),REFDATE(LOW,TL1));
BH1:=IF(REFDATE(CLOSE,TL1)>REFDATE(CLOSE,TH1),REFDATE(LOW,TH1),REFDATE(HIGH,TH1));
CZF1:=IF(REFDATE(CLOSE,TL1)>REFDATE(CLOSE,TH1),REFDATE(HIGH,TC1),REFDATE(LOW,TC1));
DJB1:=IF(REFDATE(CLOSE,TL1)>REFDATE(CLOSE,TH1),REFDATE(LOW,TO1),REFDATE(HIGH,TO1));
OP1:=BH1-AL1+CZF1;
COP1:=0.618*(BH1-AL1)+CZF1;
XOP1:=IF((1.618*(BH1-AL1)+CZF1)<0,OP1,1.618*(BH1-AL1)+CZF1);
STICKLINE(DATE=TC1,CZF1,XOP1,0,-1),LINETHICK3,COLORLIGREEN;
DRAWLINE(DATE=TC1,COP1,DATE=TODAY,COP1,1),LINETHICK3,POINTDOT,COLORLIGREEN;
DRAWLINE(DATE=TC1,OP1,DATE=TODAY,OP1,1),LINETHICK3,POINTDOT,COLORLIGREEN;
DRAWLINE(DATE=TC1,XOP1,DATE=TODAY,XOP1,1),LINETHICK3,POINTDOT,COLORLIGREEN;
DRAWTEXT(DATE=TC1,COP1,'COP');
DRAWTEXT(DATE=TC1,OP1,'OP');
DRAWTEXT(DATE=TC1,XOP1,'XOP');
DRAWLINE(DATE=TO1,DJB1,DATE=TL1,AL1,0),LINETHICK3,POINTDOT,COLORWHITE;
DRAWLINE(DATE=TL1,AL1,DATE=TH1,BH1,0),COLORLIGREEN;
DRAWLINE(DATE=TH1,BH1,DATE=TC1,CZF1,0),COLORLIGREEN;
F31:=(BH1-0.382*(BH1-AL1));
F51:=(BH1-0.5*(BH1-AL1));
F61:=(BH1-0.618*(BH1-AL1));
DRAWLINE(DATE=TH1,F31,DATE=TODAY,F31,1),LINETHICK1,POINTDOT,COLORCYAN;
DRAWLINE(DATE=TH1,F51,DATE=TODAY,F51,1),LINETHICK1,POINTDOT,COLORCYAN;
DRAWLINE(DATE=TH1,F61,DATE=TODAY,F61,1),LINETHICK1,POINTDOT,COLORCYAN;
DRAWTEXT(DATE=TH1,F31,'0.382');
DRAWTEXT(DATE=TH1,F51,'0.5');
DRAWTEXT(DATE=TH1,F61,'0.618');
FF31:=(AL1-0.382*(AL1-DJB1));
FF51:=(AL1-0.5*(AL1-DJB1));
FF61:=(AL1-0.618*(AL1-DJB1));
DRAWLINE(DATE=TL1,FF31,DATE=TODAY,FF31,1),LINETHICK1,POINTDOT,COLORWHITE;
DRAWLINE(DATE=TL1,FF51,DATE=TODAY,FF51,1),LINETHICK1,POINTDOT,COLORWHITE;
DRAWLINE(DATE=TL1,FF61,DATE=TODAY,FF61,1),LINETHICK1,POINTDOT,COLORWHITE;
DRAWTEXT(DATE=TL1,FF31,'0.382');
DRAWTEXT(DATE=TL1,FF51,'0.5');
DRAWTEXT(DATE=TL1,FF61,'0.618');
补充说明:对个股关键是选择4个时间点。以本贴图为例(这张图做了两个折返,只说近期的一个折返),DA是起涨点(一浪起点日期),DB是小高点(二浪回调的开始日期),DC波段低点(三浪起点日期),DO为前期重要高点(一般为五点高点,设置这个日期的目的,是要计算上一波段对当前波段的压力支撑位),这是判断以后的涨幅。同理DA若设为高点日期,则可判断以后的跌幅。若不明白原理,建议学习《帝那波利点位交易法》
|