龙听期货论坛's Archiver

C
+
+


 微信: QQ:

龙听 发表于 2018-10-10 09:54

[转载]顺势多空(改版DMI,源码,图片)

公式源码如下:
[code]
{副图名称:顺势多空,(多空顺势)}
{参数设置:N(14,2,90,1);M(6,2,60,1)}
参数设置:N(14,2,90,1);M(6,2,60,1)

TR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),N);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:= SUM(IF(HD>0 AND HD>LD,HD,0),N);
DMM:= SUM(IF(LD>0 AND LD>HD,LD,0),N);
PDI:=DMP*100/TR;
MDI:=DMM*100/TR;
多头线:PDI,COLORRED,LINETHICK2;
空头线:MDI,COLORCYAN,LINETHICK1;
顺势线_多或空:MA(ABS(MDI-PDI)/(MDI+PDI)*100,M),DOTLINE;
顺势线:(顺势线_多或空+REF(顺势线_多或空,M))/2,DOTLINE;
[/code]


通达信版顺势多空源码参数设置:
N(2,90,14);MM(2,60,6)}


[code]
MTR:=EXPMEMA(MAX(MAX(ABS(HIGH-LOW),ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),N);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=EXPMEMA(IF(HD>0&&HD>LD,HD,0),N);
DMM:=EXPMEMA(IF(LD>0&&LD>HD,LD,0),N);
PDI:=DMP*100/MTR;
MDI:=DMM*100/MTR;
多头线:PDI,COLORRED,LINETHICK2;
空头线:MDI,COLORCYAN,LINETHICK1;
顺势线_多或空:EXPMEMA(ABS(PDI-MDI)/(MDI+PDI)*100,MM),DOTLINE;
顺势线M:EXPMEMA(顺势线_多或空,MM),DOTLINE;
[/code]

[attach]4477[/attach]

页: [1]