振荡指标求助

楼主  收藏   举报   帖子创建时间:  2019-05-05 15:18 回复:0 关注量:349
这个指标是为了求得目前柱子最高最低价之间的振幅于前n天平均振幅指标,运行出错,麻烦高手们看看解答一下谢谢。<div class="blockcode"><div id="code_t8I"><ol>
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1  Red
double fluctuation;
extern int time_period=3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
   {
     IndicatorBuffers(1);
     SetIndexBuffer(0,fluctuation);
     SetIndexStyle(0,0,0,2,Red);
     return(0);
   }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
   {
//----
   
//----
    return(0);
   }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
   {
     double highsum;
     double lowsum;
     int counted_bars=IndicatorCounted();
     if (counted_bars0) counted_bars--;
     int limit=Bars-counted_bars;
     for (int i=limit-1;i>=0;i--)
     {
       int r=1;
       while (r
打赏