高点:=50;
低点:=30;
GD:=CONST(FINDHIGH(H,0,高点*10,1));
DD:=CONST(FINDLOW(L,0,低点*10,1));
GT:=CONST(BArslAST(GD=H))+1;
DT:=CONST(BARSLAST(DD=L))+1;
SH:=CONST(IF(GT=1,H,REF(H,GT-1)));
SL:=CONST(IF(DT=1,L,REF(L,DT-1)));
CC:=IF(DT>GT,DT,GT);
CD:=INTPART(CC-(DT+GT)/2);
CG:=IF(高点>CD,CD/2,高点);
下跌周期:BARSLAST(GD=H),COLORWHITE,NODRAW;
下跌幅:IF(CURRBARSCOUNT<=GT,C/SH*100-100,DRAWNULL),NODRAW,COLORGREEN;
下跌均价:IF(CURRBARSCOUNT<=GT,SUM(AMOUNT,GT)/SUM(V,GT)/100,DRAWNULL),NODRAW,COLORLIGRAY;
跌换手%:IF(CURRBARSCOUNT<=GT,SUM(HSL.HSL,GT),DRAWNULL),COLORCYAN,NODRAW;
上涨周期:IF(CURRBARSCOUNT<=DT,BARSLAST(DD=L),DRAWNULL),COLORWHITE,NODRAW;
上涨幅:IF(CURRBARSCOUNT<=DT,C/SL*100-100,DRAWNULL),NODRAW,COLORRED;
上涨均价:IF(CURRBARSCOUNT<=DT,SUM(AMOUNT,DT)/SUM(V,DT)/100,DRAWNULL),NODRAW,COLORLIGRAY;
涨换手%:IF(CURRBARSCOUNT<=DT,SUM(HSL.HSL,DT),DRAWNULL),COLORLIMAGENTA,NODRAW;
星期:=VARCAT(VARCAT('(',IF(WEEkdAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五','')))))),')');
日期:=VARCAT('-',VARCAT(VARCAT(VARCAT(VARCAT(VARCAT(VARCAT(VAR2STR(YEAR,0),'年'),VAR2STR(MONTH,0)),'月'),VAR2STR(DAY,0)),'日'),星期));
{自动黄金分割 普通等系坐标}
DRAwrECTREL(990,1,382,1,RGB(250,250,0));
DRAWTEXT_FIX(C>0,0.382,0.00,0,'100%'),COLOR00CCCC;
DRAWRECTREL(990,188,382,188,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.189,0,'19.1%'),COLOR00CCCC;
DRAWRECTREL(990,375,382,375,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.376,0,'38.2%'),COLOR00CCCC;
DRAWRECTREL(990,491,382,491,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.492,0,'50.0%'),COLOR00CCCC;
DRAWRECTREL(990,607,382,607,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.608,0,'61.8%'),COLOR00CCCC;
DRAWRECTREL(990,794,382,794,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.795,0,'80.9%'),COLOR00CCCC;
DRAWRECTREL(990,982,382,982,RGB(250,250,0));
DRAWTEXT_FIX(C>0,0.382,0.936,0,'BASE'),COLOR00CCCC;
DRAWRECTREL(990,232,382,232,RGB(100,100,0));
DRAWRECTREL(990,144.6,382,144.6,RGB(100,100,0));
DRAWRECTREL(990,750,382,750,RGB(100,100,0));
DRAWRECTREL(990,839,382,839,RGB(100,100,0));
DRAWTEXT_FIX(C>0,0.01,0.01,0,'云枫添外 2016/10/10 绘'),COLORYELLOW;
{斐波那契周期}
DRAWTEXT(CURRBARSCOUNT=GT-2 ,L,'3'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-4 ,L,'5'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-7 ,L,'8'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-12 ,L,'13'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-20 ,L,'21'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-33 ,L,'34 '),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-54 ,L,'55'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-88 ,L,'89'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-143 ,L,'144'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-232 ,L,'233'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-376 ,L,'377'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=DT-2,H,'3'),DRAWAbovE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-4,H,'5'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-7,H,'8'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-12,H,'13'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-20,H,'21'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-33,H,'34'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-54,H,'55'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-88,H,'89'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-143,H,'144'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-232,H,'233'),DRAWABOVE,COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT-376,H,'377'),DRAWABOVE,COLORRED;
{幅度尺}
STICKLINE(CURRBARSCOUNT=DT,SL*20,SL,0,-1),COLORRED;
STICKLINE(CURRBARSCOUNT=GT,SH,SH-SH*0.9,0,-1),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=DT ,(SL+SL*1.2)/2,日期),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=GT ,GD*0.97,日期),COLORYELLOW;
{下跌尺}
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.14.6,STRCAT('-14.6% ',CON2STR(SH-SH*0.146,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.191,STRCAT('-19.1% ',CON2STR(SH-SH*0.191,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.236,STRCAT('-23.6% ',CON2STR(SH-SH*0.236,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.382,STRCAT('-38.2% ',CON2STR(SH-SH*0.382,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.5,STRCAT('-50.0% ',CON2STR(SH-SH*0.5,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.618,STRCAT('-61.8% ',CON2STR(SH-SH*0.618,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.764,STRCAT('-76.4% ',CON2STR(SH-SH*0.764,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.809,STRCAT('-80.9% ',CON2STR(SH-SH*0.809,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.854,STRCAT('-85.4% ',CON2STR(SH-SH*0.854,2))),COLORGREEN;
{上升尺}
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.191,STRCAT('-19.1% ',CON2STR(SL*1.191,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.382,STRCAT('-38.2% ',CON2STR(SL*1.382,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.5,STRCAT('-50.0% ',CON2STR(SL*1.5,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.618,STRCAT('-61.8% ',CON2STR(SL*1.618,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.809,STRCAT('-80.9% ',CON2STR(SL*1.809,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2,STRCAT('-100% ',CON2STR(SL*2,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*1.191,STRCAT('-138.2% ',CON2STR(SL*2*1.191,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*1.382,STRCAT('-176.4% ',CON2STR(SL*2*1.382,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*1.5,STRCAT('-200.0% ',CON2STR(SL*2*1.5,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*1.618,STRCAT('-223.6% ',CON2STR(SL*2*1.618,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*1.809,STRCAT('-261.8% ',CON2STR(SL*2*1.809,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*2,STRCAT('-300.0% ',CON2STR(SL*2*2,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*2.191,STRCAT('-338.2% ',CON2STR(SL*2*2.191,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*2.382,STRCAT('-376.4% ',CON2STR(SL*2*2.382,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*2.5,STRCAT('-400.0% ',CON2STR(SL*2*2.5,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*2.618,STRCAT('-423.6% ',CON2STR(SL*2*2.618,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*2.809,STRCAT('-461.8% ',CON2STR(SL*22.809,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*3,STRCAT('-500.0% ',CON2STR(SL*2*3,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*3.191,STRCAT('-538.2% ',CON2STR(SL*2*3.191,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*3.382,STRCAT('-576.4% ',CON2STR(SL*2*3.382,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*3.5,STRCAT('-600.0% ',CON2STR(SL*2*3.5,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*3.618,STRCAT('-623.6% ',CON2STR(SL*2*3.618,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*3.809,STRCAT('-661.8% ',CON2STR(SL*2*3.809,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*4,STRCAT('-700.0% ',CON2STR(SL*2*4,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*4.191,STRCAT('-738.2% ',CON2STR(SL*2*4.191,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*4.382,STRCAT('-776.4% ',CON2STR(SL*2*4.382,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*4.5,STRCAT('-800.0% ',CON2STR(SL*2*4.5,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*4.618,STRCAT('-823.6% ',CON2STR(SL*2*4.618,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*4.809,STRCAT('-861.8% ',CON2STR(SL*2*4.809,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2*5,STRCAT('-900.0% ',CON2STR(SL*2*5,2))),COLORGREEN;