通达信指标综合评分公式
公式中用到MACD、DMI及量三个指标进行综合度评比。满分为9分。其中MACD所占比重偏大为4分,量占3分,DMI占2分。
源码如下:(DZH2用副图公式,也可用于排序,排序时选择指标线综合度)
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
DEA度:=IF(DEA>REF(DEA,1) AND DEA>0,2,IF(DEA>REF(DEA,1) AND DEA<0,1,0));
DIFF度:=IF(DIFF>DEA AND DEA>REF(DEA,1) AND DIFF>REF(DIFF,1),1,IF(DIFF>DEA AND DEA>REF(DEA,1) AND DIFF<REF(DIFF,1),0.5,0));
MACD度:=IF(MACD>REF(MACD,1) AND MACD>0,1,IF(MACD>REF(MACD,1) AND MACD<0,0.5,0));
M度:=DEA度+DIFF度+MACD度;
V35:=MA(V,35);
五日量:=SUM(V,5);
均量度:=IF(V>35 AND V35>REF(V35,1),2,IF(V<V35 AND V35>REF(V35,1),1,0));
增量度:=IF(五日量>REF(五日量,1),1,0);
量度:=均量度+增量度;
TR:=SMA(MAX(MAX(H-L,ABS(H-REF(C,1))),ABS(L-REF(C,1))),14,1);
HD:=H-REF(H,1);
LD:=REF(L,1)-L;
DMP:=SMA(IF(HD>0 AND HD>LD,HD,0),6,1);
DMM:=SMA(IF(LD>0 AND LD>HD,LD,0),6,1);
PDI:=DMP*100/TR;
MDI:=DMM*100/TR;
PDI度:=IF(PDI>REF(PDI,1) AND PDI>MDI,1,IF(PDI>REF(PDI,1) AND PDI<MDI,0.5,0));
MDI度:=IF(MDI<REF(MDI,1) AND MDI<PDI,1,IF(MDI<REF(MDI,1) AND MDI>PDI,0.5,0));
DMI度:=PDI度+MDI度;
综合度:M度+量度+DMI度,COLORMAGENTA,PRECIS1,LINETHICK0;
走强:=IF(综合度>=5,综合度,0);
走弱:=IF(综合度<5,综合度,0);
强势:SMA(走强,3,1),COLORRED,PRECIS2,LAYER1;
弱势:SMA(走弱,3,1),COLORGREEN,PRECIS2,LAYER2;
FILLRGN(强势,4,强势>=4),COLOR000066,PRECIS2,LAYER3;
STICKLINE(C,4,4,5,0),COLORYELLOW,LAYER4;
921355109.jpg
|