通达信指标改编DMI副图源码
MTR:=EXPMEMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),14);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=EXPMEMA(IF(HD> 0&&HD> LD,HD,0),14);
DMM:=EXPMEMA(IF(LD> 0&&LD> HD,LD,0),14);
PDI: DMP*100/MTR,COLORRED;
MDI: DMM*100/MTR,COLORGREEN;
DRAWBAND(PDI,RGB(255,0,0),MDI,RGB(0,55,250));
ADX:= EXPMEMA(ABS(MDI-PDI)/(MDI+PDI)*100,6);
ADXR:=EXPMEMA(ADX,6);
STICKLINE(PDI,PDI,0,0.00001,0),COLORRED;
20,DOTLINE;
40,DOTLINE;
{IF(PDI< REF(PDI,1),PDI,DRAWNULL),COLORCYAN;}
STICKLINE(CROSS(20,PDI),PDI,0,0.0001,0),COLORGREEN;
{股票指标网}
STICKLINE(CROSS(PDI,20),0,PDI,0.0001,0),COLORYELLOW;
上穿: CROSS(PDI,MDI),COLORRED,NODRAW;
下穿: CROSS(MDI,PDI),COLORCYAN,NODRAW;
DRAWICON(上穿,PDI,25);
DRAWICON(下穿,PDI,24);
顶: PDI> 40,COLORWHITE,NODRAW;
底: MDI> 40,COLORCYAN,NODRAW;
STICKLINE(PDI> 40,40,PDI,1,0),COLORWHITE;
STICKLINE(MDI> 40,0,PDI,1,0),COLORCYAN;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
MTR赋值:EXPMEMA(MAX(MAX(最高价-最低价,最高价-1日前的收盘价的绝对值),ABS(1日前的收盘价-最低价)),14)
HD :=最高价-1日前的最高价
LD :=1日前的最低价-最低价
如果HD> 0&&HD> LD返回HD否则返回0
如果LD> 0&&LD> HD返回LD否则返回0
输出
PDI: DMP*100/MTR,画红色
输出
MDI: DMM*100/MTR,画绿色
DRAWBAND(PDI,RGB(255,0,0),MDI,RGB(0,55,250))
ADX赋值: EXPMEMA(MDI-PDI的绝对值/(MDI+PDI)*100,6)
ADXR:=EXPADX的6日平滑移动平均
当满足条件PDI时,在PDI和0之间画柱状线
20,DOTLINE
40,DOTLINE
{IF(PDI< 1日前的PDI,PDI,DRAWNULL),画青色
}
STICKLINE(20上穿PDI,PDI,0,0.0001,0),画绿色
{股票指标网}
STICKLINE(PDI上穿20,0,PDI,0.0001,0),画黄色
输出
上穿: PDI上穿MDI,画红色,NODRAW
输出
下穿: MDI上穿PDI,画青色,NODRAW
当满足条件上穿时,在PDI和25之间画图标
当满足条件下穿时,在PDI和24之间画图标
输出
顶: PDI> 40,画白色,NODRAW
输出
底: MDI> 40,画青色,NODRAW
当满足条件PDI> 40时,在40和PDI之间画柱状线
当满足条件MDI> 40时,在0和PDI之间画柱状线