波浪多空主图指标 通达信公式(附图)

[复制链接]
查看81 | 回复0 | 2021-8-20 18:57:07 | 显示全部楼层 |阅读模式

hday:=20;
lday:=20;
调点:=3;
上角度:=70;
下角度:=70;
{波浪}
PL5:=IF(PERIOD>=7,ZIG(3,1),IF(PERIOD=3,ZIG(1,2),ZIG(1,2)));
{S说明: 如果周月以上的选5%转向,如果日线选3%转向,如果日线以下周期选2%转向 }
PL10:=IF(PERIOD>=7,ZIG(3,30),IF(PERIOD=3,ZIG(1,10),ZIG(1,10)));
{S说明: 如果周月以上的选10%转向,如果日线选5%转向,如果日线以下周期选4%转向 }
PL20:=IF(PERIOD>=7,ZIG(1,10),IF(PERIOD=3,ZIG(1,30),ZIG(1,20)));
{S说明: 如果周月以上的选15%转向,如果日线选8%转向,如果日线以下周期选7%转向 }
EN1:=PL5>REF(PL5,1) AND REF(PL5,1)<=REF(PL5,2) AND REF(PL5,2)<=REF(PL5,3);
EX1:=PL5<REF(PL5,1) AND REF(PL5,1)>=REF(PL5,2) AND REF(PL5,2)>=REF(PL5,3);
EN2:=PL10>REF(PL10,1) AND REF(PL10,1)<=REF(PL10,2) AND REF(PL10,2)<=REF(PL10,3);
EX2:=PL10<REF(PL10,1) AND REF(PL10,1)>=REF(PL10,2) AND REF(PL10,2)>=REF(PL10,3);
EN3:=PL20>REF(PL20,1) AND REF(PL20,1)<=REF(PL20,2) AND REF(PL20,2)<=REF(PL20,3);
EX3:=PL20<REF(PL20,1) AND REF(PL20,1)>=REF(PL20,2) AND REF(PL20,2)>=REF(PL20,3);
走强1:=BARSLAST(PL5<REF(PL5,1));
走弱1:=BARSLAST(PL5>REF(PL5,1));
走强2:=BARSLAST(PL10<REF(PL10,1));
走弱2:=BARSLAST(PL10>REF(PL10,1));
走强3:=BARSLAST(PL20<REF(PL20,1));
走弱3:=BARSLAST(PL20>REF(PL20,1));
ZTJZ5:=IF(PL10>REF(PL10,1),COUNT(EN1,走强2),0);
ZTJD5:=IF(PL10>REF(PL10,1),COUNT(EX1,走强2),0);
DTJZ5:=IF(PL10<REF(PL10,1),COUNT(EN1,走弱2),0);
DTJD5:=IF(PL10<REF(PL10,1),COUNT(EX1,走弱2),0);
ZTJZ10:=IF(PL20>REF(PL20,1),COUNT(EN2,走强3),0);
ZTJD10:=IF(PL20>REF(PL20,1),COUNT(EX2,走强3),0);
DTJZ10:=IF(PL20<REF(PL20,1),COUNT(EN2,走弱3),0);
DTJD10:=IF(PL20<REF(PL20,1),COUNT(EX2,走弱3),0);
DRAWTEXT(EN1 AND DTJZ5=1,L*0.98,'(A)'),COLORFFFF00;
DRAWTEXT(EX1 AND DTJD5=2,H*1.02,'(B)'),COLORFFFF00;
DRAWTEXT(EN2 AND ZTJZ5=1,L*0.98,'(C)'),COLORFFFF00;
DRAWTEXT(EX1 AND PL10>REF(PL10,1) AND ZTJD5=1,H*1.02,'⑴'),COLOR0000FF;
DRAWTEXT(EN1 AND PL10>REF(PL10,1) AND ZTJZ5=2,L*0.98,'⑵'),COLOR0000FF;
DRAWTEXT(EX1 AND PL10>REF(PL10,1) AND ZTJZ5=2,H*1.02,'⑶'),COLOR0000FF;
DRAWTEXT(EN1 AND PL10>REF(PL10,1) AND ZTJZ5=3,L*0.98,'⑷'),COLOR0000FF;
DRAWTEXT(EX2 AND (PL10>REF(PL10,1) OR REF(PL10>REF(PL10,1),1) OR ZTJD10=1),H*1.08,'⑸'),,COLOR0000FF;
DRAWTEXT(EX2 AND PL20>REF(PL20,1) AND ZTJD10=1,H*1.06,'①'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EN2 AND PL20>REF(PL20,1) AND ZTJZ10=2,L*0.94,'②'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EX2 AND PL20>REF(PL20,1) AND ZTJD10=2,H*1.06,'③'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EN2 AND PL20>REF(PL20,1) AND ZTJZ10=3,L*0.94,'④'),LINETHICK3,COLOR00FFFF;
XG1:=EX2;
XG2:=PL20>REF(PL20,3);
XG3:=ZTJZ10=3;
DRAWTEXT(REF(XG2*XG3,1) AND XG1,H*1.06,'⑤'),LINETHICK3,COLORWHITE;
DRAWTEXT(REF(XG2*XG3,1) AND XG1,H*1.04,'●'),LINETHICK3,COLORFFFF00;
DRAWTEXT(REF(XG2*XG3,1) AND XG1,H*1.02,'●'),LINETHICK3,COLOR00FFFF;
买线:=EMA(C,2),COLORRED;
卖线:=EMA(SLOPE(C,21)*20+C,42),COLORYELLOW;
BU:=CROSS(买线,卖线);
SEL:=CROSS(卖线,买线);
STICKLINE(买线>=卖线,CLOSE,OPEN,3,0),COLORRED;
STICKLINE(买线>=卖线,LOW,HIGH,0,0),COLORRED;
STICKLINE(买线<卖线,CLOSE,OPEN,3,0),COLORGREEN;
STICKLINE(买线<卖线,LOW,HIGH,0,0),COLORGREEN;
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);
{黄金分割}
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'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-7,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-7,SX跌H*1.01,'8'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-12,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-12,SX跌H*1.01,'13'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-20,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-20,SX跌H*1.01,'21'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-33,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-33,SX跌H*1.01,'34 '),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-54,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-54,SX跌H*1.01,'55'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-67,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-67,SX跌H*1.01,'68'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-88,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-88,SX跌H*1.01,'89'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-109,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-109,SX跌H*1.01,'110'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-143,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-143,SX跌H*1.01,'144'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=DTT,SX涨L*0.96,'斐波那契上升周期'),COLOR0000FF;
DRAWTEXT(CURRBARSCOUNT=DTT,SX涨L*0.98,'1'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-2,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-2,SX涨L*0.98,'3'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-4,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-4,SX涨L*0.98,'5'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-7,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-7,SX涨L*0.98,'8'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-12,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-12,SX涨L*0.98,'13'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-20,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-20,SX涨L*0.98.01,'21'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-33,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-33,SX涨L*0.98,'34'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-54,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-54,SX涨L*0.98,'55'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-67,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-67,SX涨L*0.98,'68'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-88,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-88,SX涨L*0.98,'89'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-109,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-109,SX涨L*0.98,'110'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-143,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-143,SX涨L*0.98,'144'),COLOR0000FF;

14O61615P60-450b.jpg

14O61615P60-450b.jpg

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则