这个指标集MACD的短中长周期、支撑压力、画线、支撑压力价以及其他辅助判断。大彩带为长周期MACD,小彩带为短周期MACD,线条为我们平时在用的MACD。短周期加入了顶背离和底背离的提示。另外有W底的提示及止跌的信号。这样就很好地克服了传统MACD的滞后性(你可以看短周期的),同时大周期可以让我们看清大趋势。源码如下:
DIFF1:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA1:=EMA(DIFF1,9);
VARX2:=LLV(DEA1,43);
VARX3:=DEA1-(DIFF1-DEA1);
低点线:=IF(DIFF1<VARX2 AND DEA1=VARX2,MIN(HHV(VARX2,10),VARX3),VARX2);
VL:=REF(LOW,1);
VAR12:=(SMA(ABS(LOW-VL),13,1))/(SMA(MAX(LOW-VL,0),13,1))*100;
VAR14:=MA(VAR12,13);
VAR15:=LLV(LOW,34);
VAR18:=EMA(IF(LOW<=VAR15,VAR14,0),3);
VAR110:=SMA(SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,7,1),5,1);
VAR111:=SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,8,1)*15-VAR110*10.38;
T:=FILTER(IF(VAR111<=VAR110 AND VAR18>0,VAR18*8,0),5);
止跌:DRAWTEXT(T AND DIFF1<低点线,DIFF1*1.01,'止跌'),COLORYELLOW;
{大周期}
DIF55:=(EMA(CLOSE,55)-EMA(CLOSE,119))*0.55;
DEA55:=(EMA(DIF55,41));
DRAWBAND(DEA55,RGB(0,100,50),DIF55,RGB(155,50,50));
{小周期}
DIF3_6.5F:=(EMA(CLOSE,3)-(EMA(CLOSE,6)+EMA(CLOSE,7))/2);
DEA3_6.5F:=(EMA(DIF3_6.5F,3)+EMA(DIF3_6.5,2));
DRAWBAND(DEA3_6.5F,RGB(100,100,300),DIF3_6.5F,RGB(100,300,150));
AA:=REF(DIF3_6.5F,N)=HHV(DIF3_6.5F,2*N+1);
BB:=BACKSET(AA,N+1);
CC:=FILTER(BB,N) AND DIF3_6.5F=HHV(DIF3_6.5F,N+1);
A1:=BARSLAST(REF(CC,1));
顶背离:=REF(CLOSE,A1+1)<CLOSE AND REF(DIF3_6.5F,A1+1)>DIF3_6.5F AND CC;
DRAWTEXT(顶背离,DIF3_6.5F*1.2,'顶背离'),COLORGREEN;
DRAWLINE(CC,DIF3_6.5F,FILTER(顶背离>0,5),DIF3_6.5F,0),COLORWHITE,POINTDOT;
AA2:=REF(DIF3_6.5F,N)=LLV(DIF3_6.5F,2*N+1);
BB2:=BACKSET(AA2,N+1);
CC2:=FILTER(BB2,N) AND DIF3_6.5F=LLV(DIF3_6.5F,N+1);
A2:=BARSLAST(REF(CC2,1));
底背离:=REF(CLOSE,A2+1)>CLOSE AND REF(DIF3_6.5F,A2+1)<DIF3_6.5F AND CC2;
DRAWTEXT(底背离,DIF3_6.5F*1.2,'底背离'),COLORMAGENTA;
DRAWLINE(CC2,DIF3_6.5F,FILTER(底背离>0,5),DIF3_6.5F,0),COLORWHITE,POINTDOT;
{中周期}
DIFF: EMA(CLOSE,12) - EMA(CLOSE,26),COLORWHITE,LINETHICK2;
DEA:EMA(DIFF,9),COLORYELLOW,LINETHICK2;
MACD: 2*(DIFF-DEA),COLORSTICK;
{形态}
A:=IF(CROSS(0,DEA),1,0);
A11:=IF(DIFF<0 AND CROSS(DIFF,DEA),1,0);
SS:=IF(A,SUM(A11,0),0);
SSB:=HHV(SS,0);
SSS:=SUM(A11,0);
W底:=SSS-SSB=2 AND SSS>REF(SSS,1);
DRAWTEXT(W底,DIFF,'↖W底'),COLORYELLOW;
{画趋势线}
M:=INTPART(3*10/5);
A12:=REF(DIFF,M)=HHV(DIFF,2*M+1);
B12:=FILTER(A12,M);
C12:=BACKSET(B12,M+1);
D12:=FILTER(C12,M);{高点}
R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+1); S112:=R112>REF(R112,1);
短压:DRAWLINE(D12,DIFF,S112,DIFF,1),COLORFF9966;
M1:=INTPART(3*20/5);
A111:=REF(DIFF,M1)=HHV(DIFF,2*M1+1);
B111:=FILTER(A111,M1);
C111:=BACKSET(B111,M1+1);
D1:=FILTER(C111,M1);{高点}
R11:=BACKSET(ISLASTBAR,BARSLAST(D1)+1); S11:=R11>REF(R11,1);
长压:DRAWLINE(D1,DIFF,S11,DIFF,1),COLORFF99FF;
{支撑压力}
绿线天:=BARSLAST(CROSS(DEA,DIFF));
红线天:=BARSLAST(CROSS(DIFF,DEA));
压力:REF(H,绿线天),NODRAW;
支撑:REF(O,红线天),NODRAW;
{压力支撑价}
YLZC:=IF(CLOSE=INDEXC,(INDEXC+INDEXH+INDEXL+INDEXO)/4,AMOUNT/(VOL+0.01)/100);
阻价:=IF(CLOSE=INDEXC,YLZC+INDEXC-INDEXL,YLZC+(CLOSE-LOW));
支价:=IF(CLOSE=INDEXC,INDEXL+INDEXC-YLZC,LOW+(CLOSE-YLZC));
今压:REF(阻价,1),LINETHICK0,COLORAA11BB,NODRAW;
今撑:REF(支价,1),LINETHICK0,COLOR009900,NODRAW;
明压:阻价,LINETHICK0,NODRAW;
明撑:支价,LINETHICK0,NODRAW;
注意:参数N为 1 100 3 |