大智慧自动趋势线主图指标公式,大智慧漂亮的MACD指标公式

股票公式 | 发布于2021-09-15

大智慧自动趋势线主图指标公式

P1:=5;

P2:=10;

P3:=20;

P4:=30;

P5:=60;

P6:=120;

A1:=REF(HIGH,3)=HHV(HIGH,2*3+1);

 B1:=FILTER(A1,3); 

C1:=BACKSET(B1,3+1);

 D1:=FILTER(C1,3);

{高点}A2:=REF(LOW,3)=LLV(LOW,2*3+1);

 B2:=FILTER(A2,3);

 C2:=BACKSET(B2,3+1);

 D2:=FILTER(C2,3);

{低点}E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;

 E2:=(HIGH+LOW)/2;

{高低点出现在同一K线上时可作取舍}H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;

H2:=D1 AND NOT(D2 AND E1>=E2);

L1:=D2 AND NOT(D1 AND E1=E2);

X1:=REF(BARSLAST(H1),1)+1;

 F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));

G1:=F1>REF(F1,1);

 I1:=BACKSET(G1,2);

 LD:=I1>REF(I1,1);

{过滤后低点}L2:=LD OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;

X2:=REF(BARSLAST(L2),1)+1;

 F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));

G2:=F2>REF(F2,1);

 I2:=BACKSET(G2,2);

 HD:=I2>REF(I2,1);

{过滤后高点}J1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HD),BARSLAST(LD))+1); 

J2:=J1>REF(J1,1);

A3:=H;

 B3:=REF(H,REF(BARSLAST(HD),1)+1)>REF(H,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));

D3:=A3 AND B3 AND HD;

 E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2);

 HH:=E3>REF(E3,1);

{找出全部长期高点}A4:=L>REF(L,REF(BARSLAST(LD),1)+1);

B4:=REF(L,REF(BARSLAST(LD),1)+1);

 D4:=A4 AND B4 AND LD;

 E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2);

 LL:=E4>REF(E4,1);

{找出全部长期低点}DRAWICON(HH,H,5),ALIGN1;

 DRAWICON(LL,L,4),ALIGN1;

H3:=HH OR BARSTATUS=2 OR BARSCOUNT(C)=1;

 {后面进行过滤,方法同前。只是不用考虑高低点出现在同一K线}X3:=REF(BARSLAST(H3),1)+1; 

F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF(LL,L,POW(10,20)),X3));

G3:=F3>REF(F3,1);

 I3:=BACKSET(G3,2); 

LZ:=I3>REF(I3,1);

 {长期低点,也可供引用}L4:=LZ OR BARSTATUS=2 OR BARSCOUNT(C)=1;

X4:=REF(BARSLAST(L4),1)+1;

 F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-POW(10,20)),X4));

G4:=F4>REF(F4,1);

 I4:=BACKSET(G4,2); 

HZ:=I4>REF(I4,1);

{长期高点,也可供引用}K1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HZ),BARSLAST(LZ))+1); 

K2:=K1>REF(K1,1);

UU:=BACKSET(BARSTATUS=2,BARSLAST(LD)+1);

VV:=UU>REF(UU,1);

WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);

XX:=WW>REF(WW,1);

DRAWLINE(XX,L,VV,L,1),COLORMAGENTA,LINETHICK2;

UU2:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1);

VV2:=UU2>REF(UU2,1);

MA1:MA(CLOSE,P1);

MA2:MA(CLOSE,P2);

MA3:MA(CLOSE,P3);

MA4:MA(CLOSE,P4);

MA5:MA(CLOSE,P5);

MA6:MA(CLOSE,P6);

WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);

XX2:=WW2>REF(WW2,1);

DRAWLINE(XX2,H,VV2,H,1),COLORMAGENTA,LINETHICK2;

前一低:REF(L,BARSLAST(VV)),COLOR99FF66,POINTDOT,LINETHICK1;

前二低:REF(L,BARSLAST(XX)),COLORFF66FF,POINTDOT,LINETHICK1;

前一高:REF(H,BARSLAST(VV2)),COLOR99FF66,POINTDOT,LINETHICK1;

前二高:REF(H,BARSLAST(XX2)),COLORFF66FF,POINTDOT,LINETHICK1;  

大智慧漂亮的MACD指标公式

long:=26;

short:=12;

m:=9;

OBV:=MA(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),0)/25000,1);

DIFF:EMA(obv,SHORT) - EMA(obv,LONG);

bbDIFF:DIFF-ref(DIFF,1);

DEA : EMA(DIFF,M);

bbDEA:DEA-ref(DEA,1);

MACD : 2*(DIFF-DEA), COLORSTICK;

柱: 2*(DIFF-DEA);

BB柱:柱-ref(柱,1);

stickLINE(bbDIFF>0,DIFF,DEA,6,0),colorcc00ff,LINETHICK2;

STICKLINE(bbDIFF<=0,DIFF,DEA,6,0),colorff9999,LINETHICK2;

STICKLINE(bbDEA>0,DIFF,DEA,6,0),color0066ff,LINETHICK2;

STICKLINE(bbDEA<=0,DIFF,DEA,6,0),color00ff33,LINETHICK2;

STICKLINE(BB柱>0,柱,BB柱,6,0),colorcc00ff,LINETHICK1;

STICKLINE(BB柱<=0,柱,BB柱,6,0),colorff9999,LINETHICK1;

A1:=BARSLAST(ref(cross("macd.diff"(12,26,9),"macd.dea"(12,26,9)),1));

B1:=ref(c,A1+1)>c and ref("macd.diff"(12,26,9),A1+1)<"macd.diff"(12,26,9) and cross("macd.diff"(12,26,9),"macd.dea"(12,26,9));

A2:=BARSLAST(ref(cross("kdj.k"(9,3,3),"kdj.d"(9,3,3)),1));

B2:=ref(c,A2+1)>c and ref("kdj.k"(9,3,3),A2+1)<"kdj.k"(9,3,3) and cross("kdj.k"(9,3,3),"kdj.d"(9,3,3));

A3:=BARSLAST(ref(cross("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));

B3:=ref(c,A3+1)>c and ref("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) and cross("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));

C1:=BARSLAST(ref(cross("macd.dea"(12,26,9),"macd.diff"(12,26,9)),1));

D1:=ref(c,C1+1)<c and ref("macd.diff"(12,26,9),C1+1)>"macd.diff"(12,26,9) and cross("macd.dea"(12,26,9),"macd.diff"(12,26,9));

C2:=BARSLAST(ref(cross("kdj.d"(9,3,3),"kdj.k"(9,3,3)),1));

D2:=ref(c,C2+1)<c and ref("kdj.k"(9,3,3),C2+1)>"kdj.k"(9,3,3) and cross("kdj.d"(9,3,3),"kdj.k"(9,3,3));

C3:=BARSLAST(ref(cross("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));

D3:=ref(c,C3+1)<c and ref("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) and cross("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));

TR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),14);

HD := HIGH-REF(HIGH,1);

LD := REF(LOW,1)-LOW;

PDM:= SUM(IF(HD>0 AND HD>LD,HD,0),14);

MDM:= SUM(IF(LD>0 AND LD>HD,LD,0),14);

PDI:= PDM*100/TR;

MDI:= MDM*100/TR;

C4:=BARSLAST(ref(cross(mdi,pdi),1));

D4:=ref(c,C+1)<c and ref(mdi,C4+1)>mdi and cross(mdi,pdi);

A4:=BARSLAST(ref(cross(PDI,MDI),1));

B4:=ref(c,A4+1)>c and ref(pdi,A4+1)<pdi and cross(pdi,mdi);

DMI底背:IF(B4>0,-0.1,0),COLOR0099FF,POINTDOT;

MACD底背:if(B1>0,-0.1,0),colorred,pointdot;

KDJ底背:if(B2>0,-0.1,0),colorff00ff,pointdot;

RSI底背:if(B3>0,-0.1,0),coloryellow,pointdot;

DMI顶背:IF(D4>0,0.1,0),COLORBLUE,POINTDOT;

MACD顶背:if(D1>0,0.1,0),color00ff00,pointdot;

KDJ顶背:if(D2>0,0.1,0),colorffcc66,pointdot;

RSI顶背:if(D3>0,0.1,0),colorgray,pointdot;

DRAWTEXT(B1>0,BBDIFF,'MACD底背'),colorred;

DRAWTEXT(B2>0,BBDIFF,'KDJ底背'),colorff00ff;

DRAWTEXT(B3>0,BBDIFF,'RSI底背'),coloryellow;

DRAWTEXT(d1>0,DIFF,'MACD顶背'),color00ff00;

DRAWTEXT(d2>0,DIFF,'KDJ顶背'),colorffcc66;

DRAWTEXT(d3>0,DIFF,'RSI顶背'),colorwhite;

DRAWTEXT(B4>0,BBDIFF,'DMI顶背'),color0099ff;

DRAWTEXT(D4>0,BBDIFF,'DMI顶背'),colorblue;  

该文观点仅代表作者本人,贝壳投研系信息发布平台

贝壳投研从多维度分析,整理了一份《成长50》的名单,可以关注同名公众号:"贝壳投研":Beiketouyan,进行领取(点击复制)

/阅读下一篇/

别人一晒收益我就觉得自己的基金不给力怎么办?五张图给你一个抗住的理由!

可能感兴趣的
热门推荐