- 精华
- 0
- 在线时间
- 569 小时
- UID
- 826
- 积分
- 1407
- 帖子
- 118
- 阅读权限
- 60
- 注册时间
- 2007-11-25
- 最后登录
- 2013-12-24
- 精华
- 0
- UID
- 826
- 积分
- 1407
- 帖子
- 118
- 主题
- 46
- 阅读权限
- 60
- 注册时间
- 2007-11-25
- 最后登录
- 2013-12-24
|
自己译一个震荡指标,可写出来却是无有效值输出,不知道问题出在那里,请老大帮助:
Params
Numeric n(25);
Numeric m(3);
Vars
Numeric tr;
Numeric hd;
NumericSeries ld;
Numeric dmp;
Numeric dmm;
NumericSeries pdi;
NumericSeries mdi;
NumericSeries adx;
NumericSeries adxr;
Begin
tr = sma(max(max(high-low,abs(high-close[1])),abs(low-close[1])),n,1);
hd=high-high[1];
ld=low[1]-low;
dmp=sma(IIF(hd>0&&hd>ld,hd,0),n,1);
dmm=sma(IIF(ld>0&&ld>hd,ld,0),n,1);
pdi=dmp*100/tr;
mdi=dmm*100/tr;
adx=sma(abs(mdi-pdi)/(mdi+pdi)*100,n,1);
adxr=(adx+adx[m])/2;
PlotNumeric("adx",adx);
PlotNumeric("adxr",adxr);
End |
|