【通达信】分割尺主图指标公式
2015.11.08 00:00
高点:=22;
低点:=10;
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,高点);
{黄金分割}
ZG:=IF(CURRBARSCOUNT<=CD,SH,DRAWNULL);
DRAWBAND(ZG,RGB(0,0,0),ZG,RGB(0,0,0)),DOTLINE,COLORLIRED;
ZD:=IF(CURRBARSCOUNT<=CD,SL,DRAWNULL);
DRAWBAND(ZD,RGB(0,0,0),ZD,RGB(0,0,0)),DOTLINE,COLORLIRED;
X191:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.191,DRAWNULL);
DRAWBAND(X191,RGB(0,0,0),X191,RGB(0,0,0)),DOTLINE,COLORLIRED;
X382:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.382,DRAWNULL);
DRAWBAND(X382,RGB(0,0,0),X382,RGB(0,0,0)),DOTLINE,COLORLIRED;
X500:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.500,DRAWNULL);
DRAWBAND(X500,RGB(0,0,0),X500,RGB(0,0,0)),DOTLINE,COLORRED;
X618:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.618,DRAWNULL);
DRAWBAND(X618,RGB(0,0,0),X618,RGB(0,0,0)),DOTLINE,COLORLIRED;
X809:=IF(CURRBARSCOUNT<=CD,SH-(SH-SL)*0.809,DRAWNULL);
DRAWBAND(X809,RGB(0,0,0),X809,RGB(0,0,0)),DOTLINE,COLORLIRED;
DRAWTEXT(CURRBARSCOUNT=CG,(ZD)*1.02,STRCAT(‘起点: ‘,CON2STR(ZD,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X191)*0.986,STRCAT(‘80.9% ‘,CON2STR(X191,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X382)*0.985,STRCAT(‘61.8% ‘,CON2STR(X382,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X500)*0.984,STRCAT(‘50% ‘,CON2STR(X500,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X618)*0.982,STRCAT(‘38.2% ‘,CON2STR(X618,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(X809)*0.98,STRCAT(‘19.1% ‘,CON2STR(X809,2))),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=CG,(ZG)*0.98,STRCAT(‘100% ‘,CON2STR(ZG,2))),COLORLIGRAY;
{斐波那契周期}
DRAWTEXT(CURRBARSCOUNT=GT-2 ,L*0.98,’3′),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-4 ,L*0.98,’5′),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-7 ,L*0.98,’8′),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-12 ,L*0.98,’13’),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-20 ,L*0.98,’21’),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-33 ,L*0.98,’34 ‘),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-54 ,L*0.98,’55’),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-88 ,L*0.98,’89’),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-143 ,L*0.98,’144′),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-232 ,L*0.98,’233′),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GT-376 ,L*0.98,’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=IF(DTSTICKLINE(CURRBARSCOUNT=IF(DT>GT,DT,GT),SH,SL,0,-1),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.1,STRCAT(‘一10% ‘,CON2STR(SH-SH*0.1,2))),COLORBLUE;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.15,STRCAT(‘一15% ‘,CON2STR(SH-SH*0.15,2))),COLORCYAN;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.2,STRCAT(‘一20% ‘,CON2STR(SH-SH*0.2,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.3,STRCAT(‘一30% ‘,CON2STR(SH-SH*0.3,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.4,STRCAT(‘一40% ‘,CON2STR(SH-SH*0.4,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.5,STRCAT(‘一50% ‘,CON2STR(SH-SH*0.5,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.6,STRCAT(‘一60% ‘,CON2STR(SH-SH*0.6,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.7,STRCAT(‘一70% ‘,CON2STR(SH-SH*0.7,2))),COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.8,STRCAT(‘一80% ‘,CON2STR(SH-SH*0.8,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=GT,SH-SH*0.9,STRCAT(‘一90% ‘,CON2STR(SH-SH*0.9,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.1,STRCAT(‘一10% ‘,CON2STR(SL*1.1,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.15,STRCAT(‘一15% ‘,CON2STR(SL*1.15,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.2,STRCAT(‘一20% ‘,CON2STR(SL*1.2,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.25,STRCAT(‘一25% ‘,CON2STR(SL*1.25,2))),COLORLIMAGENTA;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.3,STRCAT(‘一30% ‘,CON2STR(SL*1.3,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.4,STRCAT(‘一40% ‘,CON2STR(SL*1.4,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.5,STRCAT(‘一50% ‘,CON2STR(SL*1.5,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.6,STRCAT(‘一60% ‘,CON2STR(SL*1.6,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.7,STRCAT(‘一70% ‘,CON2STR(SL*1.7,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.8,STRCAT(‘一80% ‘,CON2STR(SL*1.8,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*1.9,STRCAT(‘一90% ‘,CON2STR(SL*1.9,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2,STRCAT(‘一100% ‘,CON2STR(SL*2,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2.25,STRCAT(‘一125% ‘,CON2STR(SL*2.25,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2.5,STRCAT(‘一150% ‘,CON2STR(SL*2.5,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*2.75,STRCAT(‘一175% ‘,CON2STR(SL*2.75,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*3,STRCAT(‘一200% ‘,CON2STR(SL*3,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*3.5,STRCAT(‘一250% ‘,CON2STR(SL*3.5,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*3.75,STRCAT(‘一275% ‘,CON2STR(SL*375,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*4,STRCAT(‘一300% ‘,CON2STR(SL*4,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=DT,SL*5,STRCAT(‘一400% ‘,CON2STR(SL*5,2))),COLORYELLOW;
申明:本文为作者投稿或转载,在概念股网 http://www.gainiangu.com/ 上发表,为其独立观点。不代表本网立场,不代表本网赞同其观点,亦不对其真实性负责,投资决策请建立在独立思考之上。