大智慧神奇双线指标公式

INPUT:区间(6,3,15),快(4,2,8),慢(3,2,8);

DRAWGBKLAst(C>0,STRIP(RGB(80,100,120),RGB(0,0,0),0)),color33ff66;

DRAWTEXTREL(10,20,'神奇双线'+' 名称:'+STKNAME+'('+STKLABEL+')'),LINETHICK4,COLORWHITE;

RSV:= (CLOSE-LLV(LOW,区间))/(HHV(HIGH,区间)-LLV(LOW,区间))*100;

快线:SMA(RSV,快,1),COLORWHITE;

慢线:SMA(快线,慢,1),COLORWHITE;

拐点 :快线>REF(快线,1) AND REF(快线,1)<=REF(快线,2),LINETHICK0;

{取得 慢线 的波峰和波谷}

TT:=慢线;

A1:=REF(TT,3)=HHV(TT,2*3+1); B1:=FILTER(A1,3); C1:=BacKSET(B1,3+1); D1:=FILTER(C1,3);{高点}

A2:=REF(TT,3)=LLV(TT,2*3+1); B2:=FILTER(A2,3); C2:=BACKSET(B2,3+1); D2:=FILTER(C2,3);{低点}

H1:=(D1 AND NOT(D2)) OR barstatus=2 OR BARSCOUNT(CLOSE)=1;

L1:=(D2 AND NOT(D1)); H2:=D1 AND NOT(D2);

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);{过滤后高点}

{DRAWLINE(LD,TT,HD,TT,0),COLORWHITE,LINETHICK2,POINTDOT;

DRAWLINE(HD,TT,LD,TT,0),COLORWHITE,LINETHICK2,POINTDOT;}

{近期趋势}

{J1:=BACKSET(barstatus=2 ,MIN(BARSLAST(HD),BARSLAST(LD))+1); J2:=J1>REF(J1,1);

DRAWLINE(J2,IF(HD,TT,TT),barstatus=2 ,IF(BARSLAST(HD)>BARSLAST(LD),TT,TT),0),COLORBLUE,LINETHICK3,POINTDOT;}

{波峰和波谷趋势线}

UU1:=BACKSET(barstatus=2 ,BARSLAST(LD)+1);

VV1:=UU1>REF(UU1,1);

WW1:=BACKSET(VV1,REF(BARSLAST(LD),1)+2);

XX1:=WW1>REF(WW1,1);

DRAWLINE(XX1,TT,VV1,TT,1),COLORCYAN;{波谷线}

SJ11:=慢线>REF(慢线,1) AND REF(慢线,1)<REF(慢线,2);

SJ12:=BACKSET(SJ11,2);

SJ13:=SJ12>REF(SJ12,1);

SJ14:=BARSLAST(SJ13);

DRAWLINE(VV1,TT,SJ14<BARSLAST(VV1),TT,1),COLORCYAN;

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

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

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

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

DRAWLINE(XX2,TT,VV2,TT,1),COLORMAGENTA;{波峰线}

SJ21:=慢线<REF(慢线,1) AND REF(慢线,1)>REF(慢线,2);

SJ22:=BACKSET(SJ21,2);

SJ23:=SJ22>REF(SJ22,1);

SJ24:=BARSLAST(SJ23);

DRAWLINE(VV2,TT,SJ24<BARSLAST(VV2),TT,1),COLORMAGENTA;

PARTLINE(慢线,慢线>=REF(慢线,1),RGB(255,0,0),慢线<REF(慢线,1),RGB(0,255,0)),LINETHICK2;