主图源码
月开盘1:O#MONTH,NODRAW;
月收盘:=C#MONTH,NODRAW;
月最高:=H#MONTH,NODRAW;
月最低:=L#MONTH,NODRAW;
TJ:=NOT(月最低=REF(月最低,1)) OR NOT(月最高=REF(月最高,1)) OR NOT(月开盘1=REF(月开盘1,1))OR NOT(月收盘=REF(月收盘,1));
TX:=BARSLAST(TJ)+1;
TX1:=BACKSET(TJ,(REF(TX,1)/2)+1.6);
ZJ:=CROSS(TX1,0.5);
K1M:=月开盘1=REF(月开盘1,1) AND 月收盘=REF(月收盘,1) AND 月最高=REF(月最高,1) AND 月最低=REF(月最低,1);
K3M:=REF(C,1)=DYNAINFO(3) AND O=DYNAINFO(4) AND C=DYNAINFO(7) AND H=DYNAINFO(5) AND L=DYNAINFO(6);
DDM:=REF(BARSLAST(K1M=0)+1,1),LINETHICK0;
DD1M:=CROSS(BACKSET((K1M=0 OR K3M) AND DDM=5,4),0.5),LINETHICK0;
DD2M:=CROSS(BACKSET((K1M=0 OR K3M) AND (DDM=4 OR DDM=3),3),0.5),LINETHICK0;
DD3M:=CROSS(BACKSET((K1M=0 OR K3M) AND DDM<=2,2),0.5),LINETHICK0;
BK1M:=DD1M OR DD2M OR DD3M;
BK2M:=CROSS(BACKSET(K1M=0,2),0.5);
BK3M:=CROSS(BACKSET(K1M=0 AND REF(K1M=0,1),2),0.5);
月开盘:IF(BARSLAST(K1M=0)=0,O,REF(O,BARSLAST(K1M=0))),LINETHICK0;
K0M:=月收盘>月开盘 OR (月收盘=月开盘 AND 月收盘>REF(月收盘,BARSLAST(K1M=0)+1));
{STICKLINE(K0M AND BK1M,月最高,月收盘,0.2,0),COLORLIRED;}
STICKLINE(K0M AND ZJ,月最高,月最低,1,0),COLOR064264;
STICKLINE(K0M AND ((K1M AND BK2M=0 AND K3M=0) OR BK3M),月开盘,月收盘,8,0),COLOR064264;
{STICKLINE(NOT(K0M) AND BK1M,月最高,月最低,0.2,0),COLORLIGREEN;}
STICKLINE(NOT(K0M) AND ZJ,月最高,月最低,1,0),COLOR003400;
STICKLINE(NOT(K0M) AND ((K1M AND BK2M=0 AND K3M=0) OR BK3M),月开盘,月收盘,8,0),COLOR003400;
ZC:=C#WEEK;
ZO:=O#WEEK;
ZH:=H#WEEK;
ZL:=L#WEEK;
STICKLINE(WEEKDAY=3 AND ZC>ZO,ZH,ZL,1,0),COLOR002277;{此句与下一句可省略一句}
STICKLINE(WEEKDAY=3 AND ZC<ZO,ZH,ZL,1,0),COLOR665500;
STICKLINE(ZC>ZO,ZC,ZO,5,0),COLOR002277;
STICKLINE(ZC<ZO,ZC,ZO,5,0),COLOR665500;
DRAWKLINE(H,O,L,C);
{VAR444:=C;
操作:=MA(VAR444,5);
生命线:HHV(操作,13),LINETHICK2,COLORYELLOW;收盘破此线短逃}
愚公:=IF(1>10,HIGH*1.03,DRAWNULL),POINTDOT,LINETHICK9,COLORYELLOW;
买线:=EMA(C,4);
卖线:=EMA(SLOPE(C,20)*10+C,35);
STICKLINE(买线>=卖线,LOW,HIGH,0,0),COLORLIRED;
STICKLINE(买线>=卖线,CLOSE,OPEN,3,2),COLORLIRED;
STICKLINE(买线<卖线,LOW,HIGH,0,0),COLORCYAN;
STICKLINE(买线<卖线,CLOSE,OPEN,3,2),COLORCYAN;
STICKLINE(OPEN>CLOSE,CLOSE,OPEN,2.5,0),COLORCYAN;
GET:ZIG(3,5),COLOR999999;
PL5:=ZIG(3,5);
EN1:=ZIG(3,5)>REF(ZIG(3,5),1) AND REF(ZIG(3,5),1)<=REF(ZIG(3,5),2) AND REF(ZIG(3,5),2)<=REF(ZIG(3,5),3);
EX1:=ZIG(3,5)<REF(ZIG(3,5),1) AND REF(ZIG(3,5),1)>=REF(ZIG(3,5),2) AND REF(ZIG(3,5),2)>=REF(ZIG(3,5),3);
PL10:=ZIG(3,13);
EN2:=ZIG(3,10)>REF(ZIG(3,10),1) AND REF(ZIG(3,10),1)<=REF(ZIG(3,10),2) AND REF(ZIG(3,10),2)<=REF(ZIG(3,10),3);
EX2:=ZIG(3,10)<REF(ZIG(3,10),1) AND REF(ZIG(3,10),1)>=REF(ZIG(3,10),2) AND REF(ZIG(3,10),2)>=REF(ZIG(3,10),3);
PL20:=ZIG(3,26);
EN3:=ZIG(3,20)>REF(ZIG(3,20),1) AND REF(ZIG(3,20),1)<=REF(ZIG(3,20),2) AND REF(ZIG(3,20),2)<=REF(ZIG(3,20),3);
EX3:=ZIG(3,20)<REF(ZIG(3,20),1) AND REF(ZIG(3,20),1)>=REF(ZIG(3,20),2) AND REF(ZIG(3,20),2)>=REF(ZIG(3,20),3);
PL40:=ZIG(3,55);
走强一:=BARSLAST(PL5<REF(PL5,1));
走弱一:=BARSLAST(PL5>REF(PL5,1));
走强二 :=BARSLAST(PL10<REF(PL10,1));
走弱二:=BARSLAST(PL10>REF(PL10,1));
走强三:=BARSLAST(PL20<REF(PL20,1));
走弱三:=BARSLAST(PL20>REF(PL20,1));
ZTJZ5:=IF(PL10>REF(PL10,1),COUNT(EN1,走强二 ),0);
ZTJD5:=IF(PL10>REF(PL10,1),COUNT(EX1,走强二 ),0);
DTJZ5:=IF(PL10<REF(PL10,1),COUNT(EN1,走弱二),0);
DTJD5:=IF(PL10<REF(PL10,1),COUNT(EX1,走弱二),0);
ZTJZ10:=IF(PL20>REF(PL20,1),COUNT(EN2,走强三),0);
ZTJD10:=IF(PL20>REF(PL20,1),COUNT(EX2,走强三),0);
DTJZ10:=IF(PL20<REF(PL20,1),COUNT(EN2,走弱三),0);
DTJD10:=IF(PL20<REF(PL20,1),COUNT(EX2,走弱三),0);
DRAWTEXT(EN1 AND DTJZ5=1,LOW*0.98,'(Ⅰ)'),COLORFFFF00;
DRAWTEXT(EX1 AND DTJD5=2,HIGH*1.03,'(Ⅱ)'),COLORFFFF00;
DRAWTEXT(EN2 AND ZTJZ5=1,LOW*0.98,'(Ⅲ)'),COLORFFFF00;
DRAWTEXT(EX1 AND PL10>REF(PL10,1) AND ZTJD5=1,HIGH*1.02,'⑴'),COLOR0000FF;
DRAWTEXT(EN1 AND PL10>REF(PL10,1) AND ZTJZ5=2,LOW*0.98,'⑵'),COLOR0000FF;
DRAWTEXT(EX1 AND PL10>REF(PL10,1) AND ZTJZ5=2,HIGH*1.02,'⑶'),COLOR0000FF;
DRAWTEXT(EN1 AND PL10>REF(PL10,1) AND ZTJZ5=3,LOW*0.98,'⑷'),COLOR0000FF;
DRAWTEXT(EX2 AND PL20>REF(PL20,1) AND ZTJD10=1,HIGH*1.02,'⑸'),COLOR0000FF;
DRAWTEXT(EN2 AND DTJZ10=1,LOW*0.96,'【A】'),COLOR00FF00;
DRAWTEXT(EX2 AND DTJD10=2,HIGH*1.03,'【B】'),COLOR00FF00;
DRAWTEXT(EN3 AND ZTJZ10=1,LOW*0.96,'【C】'),COLOR00FF00;
DRAWTEXT(EX2 AND PL20>REF(PL20,1) AND ZTJD10=1,HIGH*1.04,'①'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EN2 AND PL20>REF(PL20,1) AND ZTJZ10=2,LOW*0.96,'②'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EX2 AND PL20>REF(PL20,1) AND ZTJD10=2 OR (ZTJD10=0 OR ZTJD10=2) AND EX2,HIGH*1.04,'③'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EN2 AND PL20>REF(PL20,1) AND ZTJZ10=3,LOW*0.96,'④'),LINETHICK3,COLOR00FFFF;
{波浪}
PL5H:=IF(PERIOD>=7,ZIG(3,1),IF(PERIOD=3,ZIG(1,2),ZIG(1,2)));
{S说明:如果周月以上的选5%转向,如果日线选3%转向,如果日线以下周期选2%转向 }
PL10H:=IF(PERIOD>=7,ZIG(3,30),IF(PERIOD=3,ZIG(1,10),ZIG(1,10)));
{S说明:如果周月以上的选10%转向,如果日线选5%转向,如果日线以下周期选4%转向 }
PL20H:=IF(PERIOD>=7,ZIG(1,10),IF(PERIOD=3,ZIG(1,30),ZIG(1,20)));
{S说明:如果周月以上的选15%转向,如果日线选8%转向,如果日线以下周期选7%转向 }
EN1H:=PL5H>REF(PL5H,1) AND REF(PL5H,1)<=REF(PL5H,2) AND REF(PL5H,2)<=REF(PL5H,3);
EX1H:=PL5H<REF(PL5H,1) AND REF(PL5H,1)>=REF(PL5H,2) AND REF(PL5H,2)>=REF(PL5H,3);
EN2H:=PL10H>REF(PL10H,1) AND REF(PL10H,1)<=REF(PL10H,2) AND REF(PL10H,2)<=REF(PL10H,3);
EX2H:=PL10H<REF(PL10H,1) AND REF(PL10H,1)>=REF(PL10H,2) AND REF(PL10H,2)>=REF(PL10H,3);
EN3H:=PL20H>REF(PL20H,1) AND REF(PL20H,1)<=REF(PL20H,2) AND REF(PL20H,2)<=REF(PL20H,3);
EX3H:=PL20H<REF(PL20H,1) AND REF(PL20H,1)>=REF(PL20H,2) AND REF(PL20H,2)>=REF(PL20H,3);
走强1:=BARSLAST(PL5H<REF(PL5H,1));
走弱1:=BARSLAST(PL5H>REF(PL5H,1));
走强2:=BARSLAST(PL10H<REF(PL10H,1));
走弱2:=BARSLAST(PL10H>REF(PL10H,1));
走强3:=BARSLAST(PL20H<REF(PL20H,1));
走弱3:=BARSLAST(PL20H>REF(PL20H,1));
ZTJZ5H:=IF(PL10H>REF(PL10H,1),COUNT(EN1H,走强2),0);
ZTJD5H:=IF(PL10H>REF(PL10H,1),COUNT(EX1H,走强2),0);
DTJZ5H:=IF(PL10H<REF(PL10H,1),COUNT(EN1H,走弱2),0);
DTJD5H:=IF(PL10H<REF(PL10H,1),COUNT(EX1H,走弱2),0);
ZTJZ10H:=IF(PL20H>REF(PL20H,1),COUNT(EN2H,走强3),0);
ZTJD10H:=IF(PL20H>REF(PL20H,1),COUNT(EX2H,走强3),0);
DTJZ10H:=IF(PL20H<REF(PL20H,1),COUNT(EN2H,走弱3),0);
DTJD10H:=IF(PL20H<REF(PL20H,1),COUNT(EX2H,走弱3),0);
DRAWTEXT(EN1H AND DTJZ5H=1,L*0.99,'(A)'),COLORCYAN;
DRAWTEXT(EX1H AND DTJD5H=2,H*1.02,'(B)'),COLORCYAN;
DRAWTEXT(EN2H AND ZTJZ5H=1,L*0.99,'(C)'),COLORCYAN;
VAR31:=HHVBARS(ZIG(3, 19)>REF(ZIG(3,19),1)
AND REF(ZIG(3,19), 1)<REF(ZIG(3,19), 2),0);
DRAWTEXT(VAR31=1,H*1.003,'2天'),COLORAAAAAA;
DRAWTEXT(VAR31=4,H*1.003,'5天'),COLOR666666;
DRAWTEXT(VAR31=7,L*0.99,'8天'),COLOR00CCCC;
DRAWTEXT(VAR31=12,H*1.003,'13天'),COLOR666666;
DRAWTEXT(VAR31=20,L*0.99,'21天'),COLOR666666;
DRAWTEXT(VAR31=32,L*1.03,'33天'),COLOR666666;
DRAWTEXT(VAR31=33,H*1.003,'34天'),COLOR666666;
DRAWTEXT(VAR31=49,H*1.003,'50T'),COLORAAAAAA;
DRAWTEXT(VAR31=54,L*0.99,'55天'),COLOR00CCCC;
DRAWTEXT(VAR31=60,H*1.003,'61天'),COLOR00CCCC;
DRAWTEXT(VAR31=88,H*1.003,'89天'),COLOR008888;
DRAWTEXT(VAR31=143,L*0.99,'144天'),COLOR008888;
副图1
DIF:=100*(EMA(CLOSE,12)-EMA(CLOSE,26));
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
死叉:=CROSS(DEA,DIF);
N1:=BARSLAST(死叉);{最近一次死叉的位置}
N2:=REF(BARSLAST(死叉),N1+1);{倒数第二次死叉与倒数第一次死叉的区间}
N3:=REF(BARSLAST(死叉),N2+N1+2);{倒数第三次死叉与倒数第二次死叉的区间}
CL1:=LLV(C,N1+1);{最近一次死叉后,最低收盘价}
DIFL1:=LLV(DIF,N1+1);
CL2:=REF(CL1,N1+1);{倒数第二次死叉与倒数第一次死叉之间的最低收盘价}
DIFL2:=REF(DIFL1,N1+1);
CL3:=REF(CL2,N1+1);{倒数第三次死叉与倒数第二次死叉之间的最低收盘价}
DIFL3:=REF(DIFL2,N1+1);
PDIFL2:=IF(DIFL2>0,INTPART(LOG(DIFL2))-1,INTPART(LOG(-DIFL2))-1);
MDIFL2:=INTPART(DIFL2/POW(10,PDIFL2));
PDIFL3:=IF(DIFL3>0,INTPART(LOG(DIFL3))-1,INTPART(LOG(-DIFL3))-1);
MDIFL3:=INTPART(DIFL3/POW(10,PDIFL3));
MDIFB2:=INTPART(DIF/POW(10,PDIFL2));
MDIFB3:=INTPART(DIF/POW(10,PDIFL3));
直接底背离:=(CL1<CL2 ) AND (MDIFB2>MDIFL2) AND (MACD<0 AND REF(MACD,1)<0) AND MDIFB2<=REF(MDIFB2,1);
隔峰底背离:=(CL1<CL3 AND CL3<CL2 ) AND (MDIFB3>MDIFL3) AND (MACD<0 AND REF(MACD,1)<0) AND MDIFB3<=REF(MDIFB3,1);
钝化:=直接底背离 OR 隔峰底背离;
BG:=((MDIFB2>REF(MDIFB2,1))*REF(直接底背离,1)) OR ((MDIFB3>REF(MDIFB3,1))*REF(隔峰底背离,1));
金矿结构形成:=TFILTER(BG,MACD>0,1);
XG:COUNT(金矿结构形成,5)>=1 AND CROSS(DIF,DEA);
STICKLINE(金矿结构形成,1.8,0.1,5,0),COLORYELLOW;
STICKLINE(金矿结构形成,1.9,0.1,3,0),COLOR008888;
STICKLINE(金矿结构形成,1.9,0.1,1.2,0),COLORYELLOW;
STICKLINE(金矿结构形成,2,0.3.1,0.3,0),COLORRED;
副图2
GUA:=(O+H+L+C)/4;
GUB:=MA(GUA,3);
GUC:=SUM(IF(GUA>REF(GUA,1),GUA*VOL,0),4)/SUM(IF(GUA<REF(GUA,1),GUA*VOL,0),4);
GUD:=REF(100-(100/(1+GUC)),1);
GUA1:=HHV(GUA,15);
GUA2:=LLV(GUA,15);
GUA3:=GUA1-GUA2;
GUA4:=EMA((GUA-GUA2)/GUA3,2)*100;
GUB1:=HHV(GUA,60);
GUB2:=LLV(GUA,60);
GUB3:=GUB1-GUB2;
GUB4:=EMA((GUA-GUB2)/GUB3,2)*100;
GUC1:=HHV(GUA,240);
GUC2:=LLV(GUA,240);
GUC3:=GUC1-GUC2;
GUC4:=EMA((GUA-GUC2)/GUC3,2)*100;
短线:=GUA4,COLORGREEN;
中线:=GUB4,COLORYELLOW;
长线:=GUC4,COLORFF00FF;
GUD1:=中线>REF(中线,1) AND 短线>REF(短线,1) AND 长线>REF(长线,1) AND 长线<8 AND 中线<10 AND 短线<15;
GUD2:=CROSS(短线,中线) AND 中线<8;
GUD3:=CROSS(短线,长线) AND 长线<8 AND 中线<20;
金矿中线抄底:FILTER((GUD1 OR GUD2 OR GUD3) AND GUD<15 AND C>REF(C,1),5)COLORFF00FF,LINETHICK2;
STICKLINE(金矿中线抄底,1.9,0.1,3,0),COLOR008888;
STICKLINE(金矿中线抄底,1.9,0.1,1.2,0),COLORYELLOW;
STICKLINE(金矿中线抄底,2,0.3.1,0.3,0),COLORRED;
副图3
M:=10000;
N1:=2;
B:=5;
X00:=C;
零轴基准线:=EMA(C,M);
X01:=0.7522406533*X00+0.3609454219*REF(X00,1)-0.03309329629*REF(X00,2)-0.04241822779*REF(X00,3)-0.026737249*REF(X00,4)-0.007010041271*REF(X00,5)-0.002652859952*REF(X00,6)-0.0008415042966*REF(X00,7)-0.0002891931964*REF(X00,8)-0.0000956265934*REF(X00,9)-0.0000321286052*REF(X00,10)-0.0000106773454*REF(X00,11)-0.0000035457562*REF(X00,12)-0.0000011670713*REF(X00,13);
X02:=0.7522406533*X01+0.3609454219*REF(X01,1)-0.03309329629*REF(X01,2)-0.04241822779*REF(X01,3)-0.026737249*REF(X01,4)-0.007010041271*REF(X01,5)-0.002652859952*REF(X01,6)-0.0008415042966*REF(X01,7)-0.0002891931964*REF(X01,8)-0.0000956265934*REF(X01,9)-0.0000321286052*REF(X01,10)-0.0000106773454*REF(X01,11)-0.0000035457562*REF(X01,12)-0.0000011670713*REF(X01,13);
X03:=0.7522406533*X02+0.3609454219*REF(X02,1)-0.03309329629*REF(X02,2)-0.04241822779*REF(X02,3)-0.026737249*REF(X02,4)-0.007010041271*REF(X02,5)-0.002652859952*REF(X02,6)-0.0008415042966*REF(X02,7)-0.0002891931964*REF(X02,8)-0.0000956265934*REF(X02,9)-0.0000321286052*REF(X02,10)-0.0000106773454*REF(X02,11)-0.0000035457562*REF(X02,12)-0.0000011670713*REF(X02,13);
AA:=((EMA((((EMA(X01,22)+EMA(X01,23))+EMA(X01,24))/3),2))+(EMA((((EMA(X01,24)+EMA(X01,25))+EMA(X01,26))/3),2))+(EMA((((EMA(X01,26)+EMA(X01,27))+EMA(X01,28))/3),2))+(EMA((((EMA(X01,28)+EMA(X01,29))+EMA(X01,30))/3),2))+(EMA((((EMA(X01,30)+EMA(X01,31))+EMA(X01,32))/3),2))+(EMA((((EMA(X01,32)+EMA(X01,33))+EMA(X01,34))/3),2)))/6,COLORGREEN;
BB1:=(X01*5+X02*3+X03*1)/9;
CC1:=EMA(EMA(EMA(C,N1),N1),N1);
DIF1:=(BB1-零轴基准线)/零轴基准线;
DEA11:=(CC1-零轴基准线)/零轴基准线;
DEA21:=(AA-零轴基准线)/零轴基准线;
{以下为1分钟周期:}
A_DIF:=POW((DIF1+1),55)*1000;
A_DEA1:=POW((DEA11+1),55)*1000;
A_DEA2:=POW((DEA21+1),55)*1000;
{以下为5分钟周期:}
B_DIF:=POW((DIF1+1),29)*1000;
B_DEA1:=POW((DEA11+1),29)*1000;
B_DEA2:=POW((DEA21+1),29)*1000;
{以下为15分钟周期:}
D_DIF:=POW((DIF1+1),17)*1000;
D_DEA1:=POW((DEA11+1),17)*1000;
D_DEA2:=POW((DEA21+1),17)*1000;
{以下为30分钟周期:}
E_DIF:=POW((DIF1+1),9)*1000;
E_DEA1:=POW((DEA11+1),9)*1000;
E_DEA2:=POW((DEA21+1),9)*1000;
{以下为60分钟周期:}
F_DIF:=POW((DIF1+1),5)*1000;
F_DEA1:=POW((DEA11+1),5)*1000;
F_DEA2:=POW((DEA21+1),5)*1000;
{以下为日周期:}
G_DIF:=POW((DIF1+1),3)*1000;
G_DEA1:=POW((DEA11+1),3)*1000;
G_DEA2:=POW((DEA21+1),3)*1000;
ZT:=C/REF(C,1)>=1.095 AND H=C;
GSX:IFF(PERIOD=0,A_DIF,IFF(PERIOD=1,B_DIF,IFF(PERIOD=2,D_DIF,IFF(PERIOD=3,E_DIF,IFF(PERIOD=4,F_DIF,IFF(PERIOD=5,G_DIF,DRAWNULL
)))))),COLORRED, LINETHICK1;
DEA1:=IFF(PERIOD=0,A_DEA1,IFF(PERIOD=1,B_DEA1,IFF(PERIOD=2,D_DEA1,IFF(PERIOD=3,E_DEA1,IFF(PERIOD=4,F_DEA1,IFF(PERIOD=5,G_DEA1,DRAWNULL
)))))),COLORWHITE, LINETHICK1;
DEA2:=IFF(PERIOD=0,A_DEA2,IFF(PERIOD=1,B_DEA2,IFF(PERIOD=2,D_DEA2,IFF(PERIOD=3,E_DEA2,IFF(PERIOD=4,F_DEA2,IFF(PERIOD=5,G_DEA2,DRAWNULL
)))))),COLORGREEN, LINETHICK1;
压力线:HHV(GSX,N1*100),COLORYELLOW,DOTLINE;