通达信斐波切纳+黄金分割+缠论笔画线 公式代码
MQ1:=12;MQ2:=50;MQ3:=60;
HDAY:=20;LDAY:=20;
上角度:=70;下角度:=70;
调点:=3;DRAWKLINE(H,O,L,C);
CURR:=CURRBARSCOUNT;
TCH:=CONST(FINDHIGH(H,0,HDAY*10,1));
GTT:=CONST(BARSLAST(TCH=H))+1;
下跌:=CONST(IF(GTT=1,H,REF(H,GTT-1)));
BCL:=CONST(FINDLOW(L,0,LDAY*10,1));
DTT:=CONST(BARSLAST(BCL=L))+1;
上涨:=CONST(IF(DTT=1,L,REF(L,DTT-1)));
涨点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(L=上涨)+1));
跌点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H=下跌)+1));
最低:=IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,涨点,跌点)));
L斜率:=下角度/IF(C<300,1000,10);
最高:=IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,跌点,涨点)));
H斜率:=上角度/IF(C<300,1000,10);
IM68:=((下跌-上涨)/8-(下跌-上涨)/8);
GH跌X:=下跌+(下跌-上涨)/8;
DL涨X:=上涨-(下跌-上涨)/8;
GTHT:=IF(DTT>GTT,DTT,GTT);
R:=ABS(GTT-DTT);
DHH:DRAWBAND(IF(CURR<=GTHT,下跌,DRAWNULL),RGB(0,120,120),下跌,RGB(8,168,168));
DLL:DRAWBAND(IF(CURR<=GTHT,上涨,DRAWNULL),RGB(0,120,120),上涨,RGB(0,160,160));
STICKLINE(CURRBARSCOUNT=GTT,下跌,上涨,0,0),COLOR556600;
STICKLINE(CURRBARSCOUNT=DTT,下跌,上涨,0,0),COLOR666666;
STICKLINE(CURRBARSCOUNT=1,下跌,上涨,0,0),COLOR556600;
天线:=下跌;
地线:=上涨;
K:=(天线-地线)/(IF(跌点>=涨点,跌点,涨点)-IF(跌点>=涨点,涨点,跌点));
X146:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.146,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X146)*1.001,STRCAT(' 0.146%% ',CON2STR(X146,3))),COLOR889900;
X191:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.191,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X191)*1.001,STRCAT(' 0.191%% ',CON2STR(X191,3))),COLOR889900;
X236:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.236,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X236)*1.001,STRCAT(' 0.236%% ',CON2STR(X236,3))),COLOR889900;
X382:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.382,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X382)*1.001,STRCAT(' 0.382%% ',CON2STR(X382,3))),COLOR889900;
X500:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.500,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X500)*1.001,STRCAT(' 0.500%% ',CON2STR(X500,3))),COLOR889900;
X618:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.618,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X618)*1.001,STRCAT(' 0.618%% ',CON2STR(X618,3))),COLOR889900;
X764:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.764,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X764)*1.001,STRCAT(' 0.764%% ',CON2STR(X764,3))),COLOR889900;
X809:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.809,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X809)*1.001,STRCAT(' 0.809%% ',CON2STR(X809,3))),COLOR889900;
X854:IF(CURR<=GTHT,下跌-(下跌-上涨)*0.854,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X854)*1.001,STRCAT(' 0.854%% ',CON2STR(X854,3))),COLOR889900;
DRAWTEXT(CURRBARSCOUNT=GTT,下跌*1.02,'斐波那契下跌周期'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GTT,下跌*1.01,'1'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-2,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-2,下跌*1.01,'3'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-4,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-4,下跌*1.01,'5'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-7,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-7,下跌*1.01,'8'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-12,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-12,下跌*1.01,'13'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-20,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-20,下跌*1.01,'21'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-33,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-33,下跌*1.01,'34 '),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-54,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-54,下跌*1.01,'55'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-67,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-67,下跌*1.01,'68'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-88,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-88,下跌*1.01,'89'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-109,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-109,下跌*1.01,'110'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-143,下跌,上涨,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-143,下跌*1.01,'144'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=DTT,上涨*0.96,'斐波那契上升周期'),COLOR0000FF;
DRAWTEXT(CURRBARSCOUNT=DTT,上涨*0.98,'1'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-2,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-2,上涨*0.98,'3'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-4,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-4,上涨*0.98,'5'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-7,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-7,上涨*0.98,'8'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-12,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-12,上涨*0.98,'13'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-20,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-20,上涨*0.98.01,'21'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-33,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-33,上涨*0.98,'34'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-54,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-54,上涨*0.98,'55'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-67,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-67,上涨*0.98,'68'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-88,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-88,上涨*0.98,'89'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-109,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-109,上涨*0.98,'110'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-143,下跌,上涨,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-143,上涨*0.98,'144'),COLOR0000FF;
EXP1:=EXPMA(CLOSE,MQ1);
EXP2:=EXPMA(CLOSE,MQ2);
EXP3:=EXPMA(CLOSE,MQ3);
AB:=EMA(((2*C+H+L)/4-LLV(LOW,30))/(HHV(HIGH,30)-LLV(LOW,30))*100,8);
BA:=EMA(AB,5);
A1:=REFDATE(REF(HHV(H,96),5),DATE);
B1:=REFDATE(REF(LLV(L,96),5),DATE);
DY:=((A1)+(B1))/2;
箱顶:=IF(AB>0 AND AB-BA<=0,A1,A1),LINETHICK3,COLOR00FF00;
箱腰:=IF(AB>0 AND AB-BA<=0,DY,DY),LINETHICK3,COLOR00FF00;
箱低:=IF(AB>0 AND AB-BA<=0,B1,B1),LINETHICK3,COLOR00FF00;
高1:=IF(AB>0 AND AB-BA>0,A1,DRAWNULL),LINETHICK3,COLORRED;
中1:=IF(AB>0 AND AB-BA>0,DY,DRAWNULL),LINETHICK3,COLORRED;
低1:=IF(AB>0 AND AB-BA>0,B1,DRAWNULL),LINETHICK3,COLORRED;
顶周期:=TOPRANGE(H);底周期:=LOWRANGE(L);
上内:=LLVBARS(H,顶周期);上外:=LLVBARS(L,顶周期);
下内:=HHVBARS(L,底周期);下外:=HHVBARS(H,底周期);
上力度:=HHV(L,上内+1)>LLV(H,上内+1);
下力度:=HHV(L,下内+1)>LLV(H,下内+1);
上包含:=COUNT(L>=REF(L,1),上外)>2 AND COUNT(H>=REF(H,1),上内)>2;
下包含:=COUNT(H<=REF(H,1),下外)>2 AND COUNT(L<=REF(L,1),下内)>2;
顶0:=顶周期 AND 上力度 AND 上包含 AND 上外>3;
底0:=底周期 AND 下力度 AND 下包含 AND 下外>3;
顶分天数:=BARSLAST(顶0);
底分天数:=BARSLAST(底0);
含中间K线:=IF(顶分天数=0,底分天数,顶分天数)>=3;
顶:=顶0 AND 含中间K线 AND H=HHV(H,BARSLAST(底0));
底:=底0 AND 含中间K线 AND L=LLV(L,BARSLAST(顶0));
NOTEXT上笔划线:DRAWLINE(底,L,顶,H,0),COLORMAGENTA,LINETHICK3;
NOTEXT下笔划线:DRAWLINE(顶,H,底,L,0),COLORLIGREEN,LINETHICK3;
分界点:=NOTEXT上笔划线 AND NOTEXT下笔划线 ;