通达信江恩斐波主图
HDAY:=20;
LDAY:=20;
上角度:=70;
下角度:=70;
调点:=3;
CURR:=CURRBARSCOUNT;
TCH:=CONST(FINDHIGH(H,0,HDAY*10,1));
GTT:=CONST(BARSLAST(TCH=H))+1;
SX跌H:=CONST(IF(GTT=1,H,REF(H,GTT-1)));
BCL:=CONST(FINDLOW(L,0,LDAY*10,1));
DTT:=CONST(BARSLAST(BCL=L))+1;
SX涨L:=CONST(IF(DTT=1,L,REF(L,DTT-1)));
涨点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(L=SX涨L)+1));
跌点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H=SX跌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:=((SX跌H-SX涨L)/8-(SX跌H-SX涨L)/8);
GH跌X:=SX跌H+(SX跌H-SX涨L)/8;
DL涨X:=SX涨L-(SX跌H-SX涨L)/8;
GTHT:=IF(DTT>GTT,DTT,GTT);
R:=ABS(GTT-DTT);
DHH:DRAWBAND(IF(CURR<=GTHT,SX跌H,DRAWNULL),RGB(0,120,120),SX跌H,RGB(8,168,168));
DLL:DRAWBAND(IF(CURR<=GTHT,SX涨L,DRAWNULL),RGB(0,120,120),SX涨L,RGB(0,160,160));
STICKLINE(CURRBARSCOUNT=GTT,SX跌H,SX涨L,0,0),COLOR556600;
STICKLINE(CURRBARSCOUNT=DTT,SX跌H,SX涨L,0,0),COLOR666666;
STICKLINE(CURRBARSCOUNT=1,SX跌H,SX涨L,0,0),COLOR556600;
天线:=SX跌H;
地线:=SX涨L;
K:=(天线-地线)/(IF(跌点>=涨点,跌点,涨点)-IF(跌点>=涨点,涨点,跌点));
上斜线:=IF(地线+CONST(L斜率*4.00)*最低>=地线,地线+CONST(L斜率*4.00)*最低,DRAWNULL);
上斜线0:=IF(地线+CONST(L斜率*2.00)*最低>=地线,地线+CONST(L斜率*2.00)*最低,DRAWNULL);
上斜线1:=IF(地线+CONST(L斜率*1.5)*最低>=地线,地线+CONST(L斜率*1.5)*最低,DRAWNULL);
上斜线2:=IF(地线+CONST(L斜率*1.00)*最低>=地线,地线+CONST(L斜率*1.000)*最低,DRAWNULL);
上斜线3:=IF(地线+CONST(L斜率*0.70)*最低>=地线,地线+CONST(L斜率*0.70)*最低,DRAWNULL);
上斜线4:=IF(地线+CONST(L斜率*0.50)*最低>=地线,地线+CONST(L斜率*0.50)*最低,DRAWNULL);
上斜线5:=IF(地线+CONST(L斜率*0.365)*最低>=地线,地线+CONST(L斜率*0.365)*最低,DRAWNULL);
上斜线6:=IF(地线+CONST(L斜率*0.250)*最低>=地线,地线+CONST(L斜率*0.250)*最低,DRAWNULL);
上斜线7:=IF(地线+CONST(L斜率*0.165)*最低>=地线,地线+CONST(L斜率*0.165)*最低,DRAWNULL);
上斜线8:=IF(地线+CONST(L斜率*0.123)*最低>=地线,地线+CONST(L斜率*0.123)*最低,DRAWNULL);
上斜线9:=IF(地线+CONST(L斜率*0.06)*最低>=地线,地线+CONST(L斜率*0.06)*最低,DRAWNULL);
上9:IF(上斜线9<=天线*1.05,上斜线9,DRAWNULL),COLORAA00AA,DOTLINE;
上8:IF(上斜线8<=天线*1.05,上斜线8,DRAWNULL),COLORAA00AA,DOTLINE;
上7:IF(上斜线7<=天线*1.05,上斜线7,DRAWNULL),COLORAA00AA,DOTLINE;
上6:IF(上斜线6<=天线*1.05,上斜线6,DRAWNULL),COLORAA00AA,DOTLINE;
上5:IF(上斜线5<=天线*1.05,上斜线5,DRAWNULL),COLORAA00AA,DOTLINE;
上4:IF(上斜线4<=天线*1.05,上斜线4,DRAWNULL),COLOR0000FF,DOTLINE;
上3:IF(上斜线3<=天线*1.05,上斜线3,DRAWNULL),COLORAA00AA,DOTLINE;
上2:IF(上斜线2<=天线*1.05,上斜线2,DRAWNULL),COLORAA00AA,DOTLINE;
上1:IF(上斜线1<=天线*1.05,上斜线1,DRAWNULL),COLORAA00AA,DOTLINE;
上0:IF(上斜线0<=天线*1.05,上斜线0,DRAWNULL),COLORAA00AA,DOTLINE;
上:IF(上斜线<=天线*1.05,上斜线,DRAWNULL),COLORAA00AA,DOTLINE;
下斜线:=IF(天线-CONST(H斜率*4.00)*最高<=天线,天线-CONST(H斜率*4.00)*最高,DRAWNULL);
下斜线0:=IF(天线-CONST(H斜率*2.00)*最高<=天线,天线-CONST(H斜率*2.00)*最高,DRAWNULL);
下斜线1:=IF(天线-CONST(H斜率*1.500)*最高<=天线,天线-CONST(H斜率*1.500)*最高,DRAWNULL);
下斜线2:=IF(天线-CONST(H斜率*1.000)*最高<=天线,天线-CONST(H斜率*1.000)*最高,DRAWNULL);
下斜线3:=IF(天线-CONST(H斜率*0.70)*最高<=天线,天线-CONST(H斜率*0.70)*最高,DRAWNULL);
下斜线4:=IF(天线-CONST(H斜率*0.50)*最高<=天线,天线-CONST(H斜率*0.50)*最高,DRAWNULL);
下斜线5:=IF(天线-CONST(H斜率*0.365)*最高<=天线,天线-CONST(H斜率*0.365)*最高,DRAWNULL);
下斜线6:=IF(天线-CONST(H斜率*0.250)*最高<=天线,天线-CONST(H斜率*0.250)*最高,DRAWNULL);
下斜线7:=IF(天线-CONST(H斜率*0.165)*最高<=天线,天线-CONST(H斜率*0.165)*最高,DRAWNULL);
下斜线8:=IF(天线-CONST(H斜率*0.123)*最高<=天线,天线-CONST(H斜率*0.123)*最高,DRAWNULL);
下斜线9:=IF(天线-CONST(H斜率*0.06)*最高<=天线,天线-CONST(H斜率*0.06)*最高,DRAWNULL);
下9:IF(下斜线9>=地线*0.95,下斜线9,DRAWNULL),COLORAAAAAA,DOTLINE;
下8:IF(下斜线8>=地线*0.95,下斜线8,DRAWNULL),COLORAAAAAA,DOTLINE;
下7:IF(下斜线7>=地线*0.95,下斜线7,DRAWNULL),COLORAAAAAA,DOTLINE;
下6:IF(下斜线6>=地线*0.95,下斜线6,DRAWNULL),COLORAAAAAA,DOTLINE;
下5:IF(下斜线5>=地线*0.95,下斜线5,DRAWNULL),COLORAAAAAA,DOTLINE;
下4:IF(下斜线4>=地线*0.95,下斜线4,DRAWNULL),COLOR0000FF,DOTLINE;
下3:IF(下斜线3>=地线*0.95,下斜线3,DRAWNULL),COLORAAAAAA,DOTLINE;
下2:IF(下斜线2>=地线*0.95,下斜线2,DRAWNULL),COLORAAAAAA,DOTLINE;
下1:IF(下斜线1>=地线*0.95,下斜线1,DRAWNULL),COLORAAAAAA,DOTLINE;
下0:IF(下斜线0>=地线*0.95,下斜线0,DRAWNULL),COLORAAAAAA,DOTLINE;
下:IF(下斜线>=地线*0.95,下斜线,DRAWNULL),COLORAAAAAA,DOTLINE;
{黄金分割}
X146:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.146,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X146)*1.001,STRCAT(' 0.146%% ',CON2STR(X146,3))),COLOR889900;
X191:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.191,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X191)*1.001,STRCAT(' 0.191%% ',CON2STR(X191,3))),COLOR889900;
X236:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.236,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X236)*1.001,STRCAT(' 0.236%% ',CON2STR(X236,3))),COLOR889900;
X382:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.382,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X382)*1.001,STRCAT(' 0.382%% ',CON2STR(X382,3))),COLOR889900;
X500:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.500,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X500)*1.001,STRCAT(' 0.500%% ',CON2STR(X500,3))),COLOR889900;
X618:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.618,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X618)*1.001,STRCAT(' 0.618%% ',CON2STR(X618,3))),COLOR889900;
X764:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.764,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X764)*1.001,STRCAT(' 0.764%% ',CON2STR(X764,3))),COLOR889900;
X809:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.809,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X809)*1.001,STRCAT(' 0.809%% ',CON2STR(X809,3))),COLOR889900;
X854:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.854,DRAWNULL),DOTLINE,COLOR556600;
DRAWTEXT(CURR=GTHT,(X854)*1.001,STRCAT(' 0.854%% ',CON2STR(X854,3))),COLOR889900;
{斐波那契周期}
DRAWTEXT(CURRBARSCOUNT=GTT,SX跌H*1.02,'斐波那契下跌周期'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GTT,SX跌H*1.01,'1'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-2,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-2,SX跌H*1.01,'3'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-4,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-4,SX跌H*1.01,'5'),C
未来函数检测结果如下:
该公式包含未来函数:BACKSET
该公式包含未来函数:DHIGH
该公式包含未来函数:DLOW
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
HDAY赋值:20
LDAY赋值:20
上角度赋值:70
下角度赋值:70
调点赋值:3
CURR赋值:CURRBARSCOUNT
TCH赋值:CONST(FIND最高价(H,0,HDAY*10,1))
GTT赋值:CONST(上次TCH=H距今天数)+1
SX跌H赋值:CONST(IF(GTT=1,H,GTT-1日前的H))
BCL赋值:CONST(FIND最低价(L,0,LDAY*10,1))
DTT赋值:CONST(上次BCL=L距今天数)+1
SX涨L赋值:CONST(IF(DTT=1,L,DTT-1日前的L))
涨点赋值:BARSSINCE(BACKSET(ISLASTBAR,上次L=SX涨L距今天数+1))
跌点赋值:BARSSINCE(BACKSET(ISLASTBAR,上次H=SX跌H距今天数+1))
最低赋值:IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,涨点,跌点)))
如果C<300返回1000否则返回10
最高赋值:IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,跌点,涨点)))
如果C<300返回1000否则返回10
IM68赋值:((SX跌H-SX涨L)/8-(SX跌H-SX涨L)/8)
GH跌X赋值:SX跌H+(SX跌H-SX涨L)/8
DL涨X赋值:SX涨L-(SX跌H-SX涨L)/8
如果DTT>GTT返回DTT否则返回GTT
R赋值:GTT-DTT的绝对值
如果CURR<=GTHT返回SX跌H否则返回DRAWNULL
如果CURR<=GTHT返回SX涨L否则返回DRAWNULL
当满足条件CURRBARSCOUNT=GTT时,在SX跌H和SX涨L之间画柱状线
当满足条件CURRBARSCOUNT=DTT时,在SX跌H和SX涨L之间画柱状线
当满足条件CURRBARSCOUNT=1时,在SX跌H和SX涨L之间画柱状线
天线赋值:SX跌H
地线赋值:SX涨L
如果跌点>=涨点返回跌点否则返回涨点
上斜线赋值:IF(地线+CONST(L斜率*4.00)*最低>=地线,地线+CONST(L斜率*4.00)*最低,DRAWNULL)
上斜线0:=IF(地线+CONST(L斜率*2.00)*最低>=地线,地线+CONST(L斜率*2.00)*最低,DRAWNULL)
上斜线1:=IF(地线+CONST(L斜率*1.5)*最低>=地线,地线+CONST(L斜率*1.5)*最低,DRAWNULL)
上斜线2:=IF(地线+CONST(L斜率*1.00)*最低>=地线,地线+CONST(L斜率*1.000)*最低,DRAWNULL)
上斜线3:=IF(地线+CONST(L斜率*0.70)*最低>=地线,地线+CONST(L斜率*0.70)*最低,DRAWNULL)
上斜线4:=IF(地线+CONST(L斜率*0.50)*最低>=地线,地线+CONST(L斜率*0.50)*最低,DRAWNULL)
上斜线5:=IF(地线+CONST(L斜率*0.365)*最低>=地线,地线+CONST(L斜率*0.365)*最低,DRAWNULL)
上斜线6:=IF(地线+CONST(L斜率*0.250)*最低>=地线,地线+CONST(L斜率*0.250)*最低,DRAWNULL)
上斜线7:=IF(地线+CONST(L斜率*0.165)*最低>=地线,地线+CONST(L斜率*0.165)*最低,DRAWNULL)
上斜线8:=IF(地线+CONST(L斜率*0.123)*最低>=地线,地线+CONST(L斜率*0.123)*最低,DRAWNULL)
上斜线9:=IF(地线+CONST(L斜率*0.06)*最低>=地线,地线+CONST(L斜率*0.06)*最低,DRAWNULL)
如果上斜线9<=天线*1.05返回上斜线9否则返回DRAWNULL
如果上斜线8<=天线*1.05返回上斜线8否则返回DRAWNULL
如果上斜线7<=天线*1.05返回上斜线7否则返回DRAWNULL
如果上斜线6<=天线*1.05返回上斜线6否则返回DRAWNULL
如果上斜线5<=天线*1.05返回上斜线5否则返回DRAWNULL
如果上斜线4<=天线*1.05返回上斜线4否则返回DRAWNULL
如果上斜线3<=天线*1.05返回上斜线3否则返回DRAWNULL
如果上斜线2<=天线*1.05返回上斜线2否则返回DRAWNULL
如果上斜线1<=天线*1.05返回上斜线1否则返回DRAWNULL
如果上斜线0<=天线*1.05返回上斜线0否则返回DRAWNULL
如果上斜线<=天线*1.05返回上斜线否则返回DRAWNULL
下斜线赋值:IF(天线-CONST(H斜率*4.00)*最高<=天线,天线-CONST(H斜率*4.00)*最高,DRAWNULL)
下斜线0:=IF(天线-CONST(H斜率*2.00)*最高<=天线,天线-CONST(H斜率*2.00)*最高,DRAWNULL)
下斜线1:=IF(天线-CONST(H斜率*1.500)*最高<=天线,天线-CONST(H斜率*1.500)*最高,DRAWNULL)
下斜线2:=IF(天线-CONST(H斜率*1.000)*最高<=天线,天线-CONST(H斜率*1.000)*最高,DRAWNULL)
下斜线3:=IF(天线-CONST(H斜率*0.70)*最高<=天线,天线-CONST(H斜率*0.70)*最高,DRAWNULL)
下斜线4:=IF(天线-CONST(H斜率*0.50)*最高<=天线,天线-CONST(H斜率*0.50)*最高,DRAWNULL)
下斜线5:=IF(天线-CONST(H斜率*0.365)*最高<=天线,天线-CONST(H斜率*0.365)*最高,DRAWNULL)
下斜线6:=IF(天线-CONST(H斜率*0.250)*最高<=天线,天线-CONST(H斜率*0.250)*最高,DRAWNULL)
下斜线7:=IF(天线-CONST(H斜率*0.165)*最高<=天线,天线-CONST(H斜率*0.165)*最高,DRAWNULL)
下斜线8:=IF(天线-CONST(H斜率*0.123)*最高<=天线,天线-CONST(H斜率*0.123)*最高,DRAWNULL)
下斜线9:=IF(天线-CONST(H斜率*0.06)*最高<=天线,天线-CONST(H斜率*0.06)*最高,DRAWNULL)
如果下斜线9>=地线*0.95返回下斜线9否则返回DRAWNULL
如果下斜线8>=地线*0.95返回下斜线8否则返回DRAWNULL
如果下斜线7>=地线*0.95返回下斜线7否则返回DRAWNULL
如果下斜线6>=地线*0.95返回下斜线6否则返回DRAWNULL
如果下斜线5>=地线*0.95返回下斜线5否则返回DRAWNULL
如果下斜线4>=地线*0.95返回下斜线4否则返回DRAWNULL
如果下斜线3>=地线*0.95返回下斜线3否则返回DRAWNULL
如果下斜线2>=地线*0.95返回下斜线2否则返回DRAWNULL
如果下斜线1>=地线*0.95返回下斜线1否则返回DRAWNULL
如果下斜线0>=地线*0.95返回下斜线0否则返回DRAWNULL
如果下斜线>=地线*0.95返回下斜线否则返回DRAWNULL
输出{黄金分割}
X146:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.146,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X146)*1.001,STRCAT(' 0.146%% ',CON2STR(X146,3))),COLOR889900
输出X191:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.191,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X191)*1.001,STRCAT(' 0.191%% ',CON2STR(X191,3))),COLOR889900
输出X236:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.236,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X236)*1.001,STRCAT(' 0.236%% ',CON2STR(X236,3))),COLOR889900
输出X382:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.382,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X382)*1.001,STRCAT(' 0.382%% ',CON2STR(X382,3))),COLOR889900
输出X500:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.500,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X500)*1.001,STRCAT(' 0.500%% ',CON2STR(X500,3))),COLOR889900
输出X618:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.618,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X618)*1.001,STRCAT(' 0.618%% ',CON2STR(X618,3))),COLOR889900
输出X764:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.764,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X764)*1.001,STRCAT(' 0.764%% ',CON2STR(X764,3))),COLOR889900
输出X809:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.809,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X809)*1.001,STRCAT(' 0.809%% ',CON2STR(X809,3))),COLOR889900
输出X854:IF(CURR<=GTHT,SX跌H-(SX跌H-SX涨L)*0.854,DRAWNULL),DOTLINE,COLOR556600
DRAWTEXT(CURR=GTHT,(X854)*1.001,STRCAT(' 0.854%% ',CON2STR(X854,3))),COLOR889900
当满足条件CURRBARSCOUNT=GTT时,在SX跌H*1.02和'斐波那契下跌周期'位置书写文字
当满足条件CURRBARSCOUNT=GTT时,在SX跌H*1.01和'1'位置书写文字
当满足条件CURRBARSCOUNT=GTT-2时,在SX跌H和SX涨L之间画柱状线
当满足条件CURRBARSCOUNT=GTT-2时,在SX跌H*1.01和'3'位置书写文字
当满足条件CURRBARSCOUNT=GTT-4时,在SX跌H和SX涨L之间画柱状线
当满足条件CURRBARSCOUNT=GTT-4时,在SX跌H*1.01和'5'位置书写文字