龙听期货论坛's Archiver

龙听 发表于 2020-3-30 11:10

文华财经各种顶底背离主图源码

[code]DIFELSEF := EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:= EMA(DIFELSEF,9);
LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
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(IFELSE(HD>0 && HD>LD,HD,0),14);
MDM:= SUM(IFELSE(LD>0 && LD>HD,LD,0),14);
PDI:= PDM*100/TR;
MDI:= MDM*100/TR;
A1:=BARSLAST(REF(CROSS(DIFELSEF,DEA),1));
B1:=REF(CLOSE,A1+1)>CLOSE && REF(DIFELSEF,A1+1)
<DIFELSEF && CROSS(DIFELSEF,DEA);
A2:=BARSLAST(REF(CROSS(K,D),1));
B2:=REF(CLOSE,A2+1)>CLOSE && REF(K,A2+1)<K && CROSS(K,D);
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(CLOSE,A3+1)>CLOSE && REF(RSI1,A3+1)
<RSI1 && CROSS(RSI1,RSI2);
C1:=BARSLAST(REF(CROSS(DEA,DIFELSEF),1));
D1:=REF(CLOSE,C1+1)<CLOSE && REF(DIFELSEF,C1+1)
>DIFELSEF && CROSS(DEA,DIFELSEF);
C2:=BARSLAST(REF(CROSS(D,K),1));
D2:=REF(CLOSE,C2+1)<CLOSE && REF(K,C2+1)>K && CROSS(D,K);
C3:=BARSLAST(REF(CROSS(RSI2,RSI1),1));
D3:=REF(CLOSE,C3+1)<CLOSE && REF(RSI1,C3+1)
>RSI1 && CROSS(RSI2,RSI1);
C4:=BARSLAST(REF(CROSS(MDI,PDI),1));
D4:=REF(CLOSE,C4+1)<CLOSE && REF(MDI,C4+1)>MDI && CROSS(MDI,PDI);
A4:=BARSLAST(REF(CROSS(PDI,MDI),1));
B4:=REF(CLOSE,A4+1)>CLOSE && REF(PDI,A4+1)<PDI && CROSS(PDI,MDI);
STICKLINE(B4,LOW,LOW-0.06,COLORBLUE,0);
DRAWTEXT(B4,LOW-20,'D底');
PLAYSOUND(CROSSUP(B4,LOW),'F');
STICKLINE(D4,HIGH,HIGH+0.06,COLORWHITE,0);
DRAWTEXT(D4,HIGH+20,'D顶');
PLAYSOUND(CROSSDOWN(D4,HIGH),'E');
STICKLINE(B1,LOW,LOW-0.06,COLORGREEN,0);
DRAWTEXT(B1,LOW-10,'M底');
PLAYSOUND(CROSSUP(B1,LOW),'F');
STICKLINE(B2,LOW,LOW-0.06,COLORYELLOW,0);
DRAWTEXT(B2,LOW-6,'K底');
PLAYSOUND(CROSSUP(B2,LOW),'F');
STICKLINE(B3,LOW,LOW-0.04,COLORRED,0);
DRAWTEXT(B3,LOW-16,'R底');
PLAYSOUND(CROSSUP(B3,LOW),'F');
STICKLINE(D1,HIGH,HIGH+0.06,COLORMAGENTA,0);
DRAWTEXT(D1,HIGH+10,'M顶');
PLAYSOUND(CROSSDOWN(D1,HIGH),'E');
STICKLINE(D2,HIGH,HIGH+0.06,COLORLIGHTRED,0);
DRAWTEXT(D2,HIGH+6,'K顶');
PLAYSOUND(CROSSDOWN(D2,HIGH),'E');
STICKLINE(D3,HIGH,HIGH+0.06,COLORLIGHTGREEN,0);
DRAWTEXT(D3,HIGH+16,'R顶');
PLAYSOUND(CROSSDOWN(D3,HIGH),'E');
MA13:=MA(CLOSE,13),COLORWHITE;
VLL:=CROSS(MA(CLOSE,13),MA(CLOSE,21));
DRAWTEXT(VLL,MA13-10,'圆底');
PLAYSOUND(CROSSUP(VLL,MA13),'F');[/code]

页: [1]