欧欧 欧欧量化 2023-09-21 08:00 发表于广西
一、指标说明: 1、左边的绿竖线是从高点至下的跌幅百分比 右边是黄金分割位和红竖线是上升幅度尺 2、参数可以自行调节测试: 二、黄金分割尺公式如下: 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)));CD:=INTPART(CC-(DT+GT)/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;DRAWTEXT_FIX(C>O,0.01,0.9,0,'微信公众号:欧欧量化'),COLORRED; STICKLINE(CURRBARSCOUNT=IF(DT<GT,DT,GT),SH,SL,0,-1),COLORRED;STICKLINE(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;
风险提示:本指标公式仅作为知识分享,模拟测试不构成任何投资建议,不作投资依据。
|