{使用说明:用黄金分割来把K线做成了金箍棒:金箍棒是上涨K线;银箍棒是下跌K线;38.2%到61.8%粉色芯是大资金流入;绿色芯是大资金流出;蓝色芯是无大单交易--当然,没有下载L2数据,也会显示蓝色芯。灰色部分是19.1%到80.9%,中间的横线是50%。}
{阻力支撑}
GJ:=(C+H+L+O)/4;
阻:=L+(GJ-L)+(C-L);
支:=L+(C-GJ);
压力:REF(阻 , 1),NODRAW,COLOR00FF00;
支撑:REF(支 , 1),NODRAW,COLORYELLOW;
{黄金分割}
N:=8;{你随意调整N的参数,看看效果如何:你可以发现更多级别的阻力和支撑点}
高:=IF (HIGH>PEAK(1,N,1),HHV(HIGH,N),PEAK(1,N,1)),COLORGREEN;{最高价}
低:=IF (LOW<TROUGH(2,N,1),LLV(LOW,N),TROUGH(2,N,1)),COLORMAGENTA;{最低价}
F0.191:=(高-低)*0.191+低,DOTLINE,COLORMAGENTA;
F0.382:=(高-低)*0.382+低,DOTLINE,COLORCYAN;
F0.500:=(高-低)*0.500+低,DOTLINE,COLORWHITE;
F0.618:=(高-低)*0.618+低,DOTLINE,COLORCYAN;
F0.809:=(高-低)*0.809+低,DOTLINE,COLORYELLOW;
DRAWBAND(低,RGB(0,0,0),F0.191,RGB(150,0,0));
DRAWBAND(F0.191,RGB(0,0,0),F0.382,RGB(150,0,150));
DRAWBAND(F0.382,RGB(0,0,0),F0.500,RGB(100,100,0));
DRAWBAND(F0.500,RGB(0,0,0),F0.618,RGB(0,100,100));
DRAWBAND(F0.618,RGB(0,0,0),F0.809,RGB(0,0,150));
DRAWBAND(F0.809,RGB(0,0,0),高,RGB(0,100,0));
{黄金分割点位}
波谷↑:=TROUGHBARS(2,N,1);{波谷起涨位}
波峰↓:=PEAKBARS(1,N,1);{波峰起跌位}
ZHSJ:=IF(波峰↓<波谷↑,BACKSET(ISLASTBAR,波峰↓),IF(波谷↑<波峰↓,BACKSET(ISLASTBAR,波谷↑),0));
DRAWTEXT(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),高*1.003,'高')COLORGREEN;
DRAWTEXT(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.191*1.002,' 80.9%'),COLORYELLOW;
DRAWTEXT(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.382*1.002,' 61.8%'),COLORCYAN;
DRAWTEXT(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.500*1.002,' 50.0%'),COLORWHITE;
DRAWTEXT(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.618*1.002,' 38.2%'),COLORGREEN;
DRAWTEXT(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.809*1.002,' 19.1%'),COLORRED;
DRAWTEXT(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),低*1.002,'低')COLORRED;
DRAWNUMBER(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),高,高)COLORGREEN;
DRAWNUMBER(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.809,F0.809)COLORMAGENTA;
DRAWNUMBER(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.618,F0.618)COLORCYAN;
DRAWNUMBER(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.500,F0.500)COLORWHITE;
DRAWNUMBER(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.382,F0.382)COLORCYAN;
DRAWNUMBER(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),F0.191,F0.191)COLORYELLOW;
DRAWNUMBER(波峰↓<波谷↑ AND CROSS(ZHSJ,0.1),低,低)COLORRED;
DRAWTEXT(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),高*1.003,'高')COLORGREEN;
DRAWTEXT(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.191*1.002,' 19.1%'),COLORRED;
DRAWTEXT(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.382*1.002,' 38.2%'),COLORGREEN;
DRAWTEXT(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.500*1.002,' 50.0%'),COLORWHITE;
DRAWTEXT(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.618*1.002,' 61.8%'),COLORCYAN;
DRAWTEXT(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.809*1.002,' 80.9%'),COLORYELLOW;
DRAWTEXT(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),低*1.002,'低')COLORRED;
DRAWNUMBER(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),高,高)COLORGREEN;
DRAWNUMBER(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.809,F0.809)COLORYELLOW;
DRAWNUMBER(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.618,F0.618)COLORCYAN;
DRAWNUMBER(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.500,F0.500)COLORWHITE;
DRAWNUMBER(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.382,F0.382)COLORCYAN;
DRAWNUMBER(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),F0.191,F0.191)COLORMAGENTA;
DRAWNUMBER(波峰↓>波谷↑ AND CROSS(ZHSJ,0.1),低,低)COLORRED;
{跌K线:艳蓝色}
XG2:=O>=C;
STICKLINE(XG2,L,H,0,0),COLORFF9900;
STICKLINE(XG2,CLOSE,OPEN,3,0),COLORFF5500;
STICKLINE(XG2,CLOSE,OPEN,2.8,0),COLORFF6600;
STICKLINE(XG2,CLOSE,OPEN,2.5,0),COLORFF7700;
STICKLINE(XG2,CLOSE,OPEN,2.2,0),COLORFF8800;
STICKLINE(XG2,CLOSE,OPEN,1.7,0),COLORFF9900;
STICKLINE(XG2,CLOSE,OPEN,1.2,0),COLORFFAA00;
STICKLINE(XG2,CLOSE,OPEN,0.7,0),COLORFFCC00;
STICKLINE(XG2,CLOSE,OPEN,0.2,0),COLORFFFF00;
{涨K线:黄色}
XG1:=C>O;
STICKLINE(XG1,L,H,0,0),COLOR0088EE;
STICKLINE(XG1,CLOSE,OPEN,3,0),COLOR0055AA;
STICKLINE(XG1,CLOSE,OPEN,2.8,0),COLOR0066BB;
STICKLINE(XG1,CLOSE,OPEN,2.5,0),COLOR0077CC;
STICKLINE(XG1,CLOSE,OPEN,2.2,0),COLOR0088DD;
STICKLINE(XG1,CLOSE,OPEN,1.7,0),COLOR0099EE;
STICKLINE(XG1,CLOSE,OPEN,1.2,0),COLOR00AAFF;
STICKLINE(XG1,CLOSE,OPEN,0.7,0),COLOR00CCFF;
STICKLINE(XG1,CLOSE,OPEN,0.2,0),COLOR00FFFF;
实体80.9%:=(MAX(O,C)-MIN(O,C))*0.809+MIN(O,C) ;
实体61.8%:=(MAX(O,C)-MIN(O,C))*0.618+MIN(O,C) ;
实体38.2%:=(MAX(O,C)-MIN(O,C))*0.382+MIN(O,C) ;
实体19.1%:=(MAX(O,C)-MIN(O,C))*0.191+MIN(O,C) ;
实体50.0%:=(O+C)/2,COLORWHITE NODRAW;
STICKLINE(O<>C,实体80.9%,实体19.1%,2,0),COLORGRAY;
STICKLINE(O<>C,实体61.8%,实体38.2%,1,0),COLORBLUE;
STICKLINE(O<>C,实体50.0%,实体50.0%,4,0),COLORYELLOW;
{资金流向}
超B:=L2_AMO(0,2)/10000.0;
大B:=L2_AMO(1,2)/10000.0;
超S:=L2_AMO(0,3)/10000.0;
大S:=L2_AMO(1,3)/10000.0;
超大单:=(超B)-(超S);
大单:=(大B)-(大S);
大资金流向:=超大单+大单 ;
STICKLINE(大资金流向>0,实体61.8%,实体38.2%,1.2,0),COLORBB00BB;
STICKLINE(大资金流向>0,实体61.8%,实体38.2%,0.7,0),COLORDD00DD;
STICKLINE(大资金流向>0,实体61.8%,实体38.2%,0.2,0),COLORFF33FF;
STICKLINE(大资金流向<0,实体61.8%,实体38.2%,1.2,0),COLOR00BB00;
STICKLINE(大资金流向<0,实体61.8%,实体38.2%,0.7,0),COLOR00DD00;
STICKLINE(大资金流向<0,实体61.8%,实体38.2%,0.2,0),COLOR00FF00;
{黄金率目标点位}
TL:=1000000+160526;DRAWTEXT(DATE=TL ,L*0.997,'DA')COLORCYAN;
TH:=1000000+160606;DRAWTEXT(DATE=TH ,H,'DB')COLORCYAN,DRAWABOVE;
TC:=1000000+160624;DRAWTEXT(DATE=TC ,L*0.997,'DC')COLORCYAN;
TO:=1000000+160413;DRAWTEXT(DATE=TO ,H,'DO')COLORCYAN DRAWABOVE;
IF(DATE=TO ,H,DRAWNULL),COLORCYAN,LINETHICK5,CIRCLEDOT;
IF(DATE=TC ,L,DRAWNULL),COLORRED,LINETHICK5,CIRCLEDOT;
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),COLORYELLOW;
DRAWLINE(DATE=TC,COP,DATE=TODAY,COP,1),DOTLINE,COLORYELLOW;
DRAWLINE(DATE=TC,OP,DATE=TODAY,OP,1),DOTLINE,COLORYELLOW;
DRAWLINE(DATE=TC,XOP,DATE=TODAY,XOP,1),DOTLINE,COLORYELLOW;
DRAWTEXT(DATE=TC,COP*1.002,'COP=0.618'),COLORYELLOW ;
DRAWTEXT(DATE=TC,OP*1.002,'OP=1.000'),COLORYELLOW;
DRAWTEXT(DATE=TC,XOP*1.002,'XOP=1.618'),COLORYELLOW ;
DRAWNUMBER(DATE=TC,COP,COP),COLORYELLOW;
DRAWNUMBER(DATE=TC,OP,OP),COLORYELLOW;
DRAWNUMBER(DATE=TC,XOP,XOP),COLORYELLOW;
DRAWLINE(DATE=TO,DJB,DATE=TL,AL,0) ,COLORYELLOW;
DRAWLINE(DATE=TL,AL,DATE=TH,BH,0) ,COLORYELLOW;
DRAWLINE(DATE=TH,BH,DATE=TC,CZF,0) ,COLORYELLOW;