龙听期货论坛's Archiver

龙听 发表于 2018-11-29 16:43

[文华指标]DMI顶底背离 MACD底背离 KDJ底背离 RSI底背离 圆弧底[文华财经公式]

相关标签: DMI底背离 、DMI顶背离、 MACD底背离 、KDJ底背离 RSI底背离 、 文华程序化收盘价模型 、 文华程序化视频 、 文华程序化模型 、 文华程序化开盘价模型 、 文华财经博客指标公式 、

[文华指标]源码:

[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;
K2:EMA(CLOSE,6),COLORCYAN;
K3:EMA(CLOSE,9),COLORCYAN;
K5:EMA(CLOSE,12),COLORCYAN;
K7:EMA(CLOSE,15),COLORCYAN;
K10:EMA(CLOSE,18),COLORCYAN;
K13:EMA(CLOSE,21),COLORCYAN;
K16:EMA(CLOSE,24),COLORCYAN;
IFELSE (K2>REF(K2,1),K2,K2),COLORRED;
IFELSE (K3>REF(K3,1),K3,K2),COLORRED;
IFELSE (K5>REF(K5,1),K5,K2),COLORRED;
IFELSE (K7>REF(K7,1),K7,K2),COLORRED;
IFELSE (K10>REF(K10,1),K10,K2),COLORRED;
IFELSE (K13>REF(K13,1),K13,K2),COLORRED;
IFELSE (K16>REF(K16,1),K16,K2),COLORRED;
HHV(HIGH,20),COLORYELLOW;
LLV(LOW,20),COLORYELLOW;
STICKLINE(CLOSE>=OPEN,CLOSE,OPEN,COLORRED,0);
STICKLINE(CLOSE>=OPEN,CLOSE,OPEN,COLORGREEN,0);
STICKLINE(CLOSE>=OPEN,CLOSE,OPEN,COLORYELLOW,0);
STICKLINE(CLOSE>=OPEN,HIGH,LOW,COLORYELLOW,0);
STICKLINE(CLOSE<=OPEN,CLOSE,OPEN,COLORBLUE,0);
STICKLINE(CLOSE<=OPEN,CLOSE,OPEN,COLORMAGENTA,0);
STICKLINE(CLOSE<=OPEN,CLOSE,OPEN,COLORLIGHTGREEN,0);
STICKLINE(CLOSE<=OPEN,HIGH,LOW,COLORLIGHTGREEN,0);
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-0.09,'DMI底背');
STICKLINE(D4,HIGH,HIGH+0.06,COLORWHITE,0);
DRAWTEXT(D4,HIGH+0.09,'DMI顶背');
STICKLINE(B1,LOW,LOW-0.06,COLORGREEN,0);
DRAWTEXT(B1,LOW-0.09,'MACD底背');
STICKLINE(B2,LOW,LOW-0.06,COLORYELLOW,0);
DRAWTEXT(B2,LOW-0.09,'KDJ底背');
STICKLINE(B3,LOW,LOW-0.04,COLORRED,0);
DRAWTEXT(B3,LOW-0.09,'RSI底背');
STICKLINE(D1,HIGH,HIGH+0.06,COLORMAGENTA,0);
DRAWTEXT(D1,HIGH+0.09,'MACD顶背');
STICKLINE(D2,HIGH,HIGH+0.06,COLORLIGHTRED,0);
DRAWTEXT(D2,HIGH+0.09,'KDJ顶背');
STICKLINE(D3,HIGH,HIGH+0.06,COLORLIGHTGREEN,0);
DRAWTEXT(D3,HIGH+0.09,'RSI顶背');
MA13:=MA(CLOSE,13),COLORWHITE;
VLL:=CROSS(MA(CLOSE,13),MA(CLOSE,21));
DRAWTEXT(VLL,MA13,'●');
DRAWTEXT(VLL,MA13-0.09,'圆弧底');
[/code]

页: [1]