为什么我编的涨跌幅和震幅指标无法正常显示?请高手帮我看一下。

 

这是个再简单不过的指标了。就是把每日的收盘价格减去开盘价格再除以开盘价格,以及最高价减去最低价然后除以开盘价。可是在图标上却只能显示出最近三个蜡烛位置的指标,之间的全都无法显示。请各位菩萨帮我分析一下,错误在哪里?万分感谢了。


double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
//----
int pos=Bars-counted_bars;
double dhigh,dlow,dclose,dopen;
while(pos>=0)
{dhigh=High[pos];
dlow=Low[pos];
dclose=Close[pos];
dopen=Open[pos];


ExtMapBuffer1[pos]=100*(dclose-dopen)/dopen;
ExtMapBuffer2[pos]=100*(dhigh-dlow)/dopen;
pos--;}
//----
return(0);

 
附上文件。
附加的文件:
cr.mq4  3 kb
原因: