Indicator is not plotting when inserted into MT5 Platform.

 

Hi all I tried to add a Color change buffer. When the Indicator crossed level 60 color has to change. I'm not sure whether the colour buffer is added correctly or not. Please help to resolve this . When i try to compile I"m not getting any errors. Please advise on this.

// + ----------------------------------------------- ------------------- +
// | RBVI.mq5 |
// | Copyright © 2004, BECEMAL |
// | |
// + ----------------------------------------------- ------------------- +
#property copyright "Copyright © 2004, BECEMAL"
#property link ""
// ---- indicator version number
#property version "1.10"
// ---- Indicator drawing in a separate window
#property indicator_separate_window
// ---- number of indicator buffers
#property indicator_buffers 2
// ---- Only one graphical construction is used.
#property indicator_plots 1
// + ---------------------------------------------- +
// | Indicator drawing parameters 1 |
// + ---------------------------------------------- +
// ---- Drawing the indicator as a line
#property indicator_type1 DRAW_COLOR_LINE
// ---- Blue is used as the indicator line color.
#property indicator_color1 clrBlue,clrYellow
// ---- Indicator line - continuous curve
#property indicator_style1 STYLE_SOLID
// ---- Indicator line thickness is 2
#property indicator_width1 2
// ---- display of the indicator label
#property indicator_label1 "RBVI"
// + ---------------------------------------------- +
// | Horizontal level display options |
// + ---------------------------------------------- +
#property indicator_level1 60
#property indicator_level2 40
#property indicator_levelcolor clrMagenta
#property indicator_levelstyle STYLE_DASHDOTDOT
// + ---------------------------------------------- +
// | INPUT PARAMETERS OF THE INDICATOR |
// + ---------------------------------------------- +
input int RBVIPeriod = 8; // indicator period
input ENUM_APPLIED_VOLUME VolumeType = VOLUME_TICK; // volume
input int Shift = 0; // horizontal indicator shift in bars
// + ---------------------------------------------- +
// ---- Declaration of dynamic arrays that will be in
// further used as indicator buffers
double RbviBuffer [];
double ColorBuffer[];
// ---- Declaring integer variables for storing indicator handles
int ATR_Handle;
// ---- Declaring integer datum variables
int min_rates_total;
// + ----------------------------------------------- ------------------- +
// | RBVI indicator initialization function |
// + ----------------------------------------------- ------------------- +
int onInit ()
  {
// ---- Initialization of data zero points
   min_rates_total = 2 + RBVIPeriod;

// ---- Receive ATR indicator handle
   ATR_Handle = iATR (NULL, 0, RBVIPeriod);
   if (ATR_Handle == INVALID_HANDLE)
     {
      Print ("Failed to get ATR indicator handle");
      return (INIT_FAILED);
     }

// ---- turning a dynamic array into an indicator buffer
   SetIndexBuffer (0, RbviBuffer, INDICATOR_DATA);
   SetIndexBuffer(1,ColorBuffer,INDICATOR_COLOR_INDEX);
// ---- Horizontal shift of indicator 1
   PlotIndexSetInteger (0, PLOT_SHIFT, Shift);
// ---- Shifting the start of the indicator rendering
   PlotIndexSetInteger (0, PLOT_DRAW_BEGIN, min_rates_total);
// ---- Set indicator values ​​that are not visible on the chart
   PlotIndexSetDouble (0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
// ---- Indexing elements in buffers as in timeseries
   ArraySetAsSeries (RbviBuffer, true);
   ArraySetAsSeries(ColorBuffer,true);

// ---- Initialize the variable for the short name of the indicator
   string shortname;
    StringConcatenate(shortname,"RBVI(",string(RBVIPeriod),",",EnumToString(VolumeType),",",Shift,")");
// ---- Creating a name for display in a separate subwindow and in a tooltip
   IndicatorSetString (INDICATOR_SHORTNAME, shortname);

// --- Determining the accuracy of displaying indicator values
   IndicatorSetInteger (INDICATOR_DIGITS, 1);
// --- completion of initialization
   return (INIT_SUCCEEDED);
  }
// + ----------------------------------------------- ------------------- +
// | RBVI iteration function |
// + ----------------------------------------------- ------------------- +
int OnCalculate (
                const int rates_total, // amount of history in bars on the current tick
                const int prev_calculated, // amount of history in bars on the previous tick
                const datetime & time [],
                const double & open [],
                const double & high [],
                const double & low [],
                const double & close [],
                const long & tick_volume [],
                const long & volume [],
                const int & spread []
                )
  {
// ---- checking the number of bars for sufficiency for calculation
   if (BarsCalculated (ATR_Handle) <rates_total
      || rates_total <min_rates_total)
      return (0);

// ---- Declaring integer variables
   int to_copy, limit, bar;
// ---- Declaring floating point variables
   double Range [], vol0 = 0, vol1 = 0, sumn, sump, rel, positive, negative;
   static double positive_, negative_, sumn_, sump_;

// ---- Calculation of the required amount of copied data and the start number limit for the cycle of recalculation of bars
   if (prev_calculated> rates_total || prev_calculated <= 0) // check for the first start of the indicator calculation
     {
      limit = rates_total-min_rates_total-1; // starting number for calculating all bars
      sumn_ = 0.0;
      sump_ = 0.0;
     }
   else limit = rates_total-prev_calculated; // starting number for calculating new bars

   to_copy = limit + 2;
// ---- Copy the newly appeared data into the Range [] array
   if (CopyBuffer (ATR_Handle, 0,0, to_copy, Range) <= 0) return (0);

// ---- Indexing of elements in arrays as in timeseries
   ArraySetAsSeries (Range, true);
   if (VolumeType == VOLUME_TICK) ArraySetAsSeries (tick_volume, true);
   else ArraySetAsSeries (volume, true);

// ---- restore the values ​​of variables
   positive = positive_;
   negative = negative_;
   sumn = sumn_;
   sump = sump_;

// ---- The main cycle of the indicator calculation
   for(bar=limit; bar>=0 && !IsStopped(); bar--)
     {
      // ---- remember the values ​​of the variables before the runs on the current bar
      if(rates_total!=prev_calculated && bar==0)
        {
         positive_ = positive;
         negative_ = negative;
         sumn_ = sumn;
         sump_ = sump;
        }

      if (VolumeType == VOLUME_TICK)
        {
         vol0 = double (tick_volume [bar]);
         vol1 = double (tick_volume [bar + 1]);
        }
      else
        {
         vol0 = double (volume [bar]);
         vol1 = double (volume [bar + 1]);
        }

      rel = Range [bar] * vol0-Range [bar + 1] * vol1;

      if (rel> 0) sump = rel;
      else sumn = -rel;

      positive = (positive * (RBVIPeriod-1) + sump) / RBVIPeriod;
      negative = (negative * (RBVIPeriod-1) + sumn) / RBVIPeriod;

      if (negative == 0.0) RbviBuffer [bar] = 0.0;
      else RbviBuffer [bar] = 100.0 * (1.0-1.0 / (1.0 + positive / negative));
     }
       {
       if (RbviBuffer[bar]>55)
        ColorBuffer[bar] = (bar>0) ? (RbviBuffer[bar] > RbviBuffer[bar+1]) ? 0 : (RbviBuffer[bar+1]>RbviBuffer[bar]) ? 0 : ColorBuffer[bar+1] : 0 ;
}
// ----
   return (rates_total);
  }
// + ----------------------------------------------- ------------------- +
 
I seem to remember seeing this topic started a number of times. If I am correct, please do not keep re-posting the same topic.
 
Keith Watford:
I seem to remember seeing this topic started a number of times. If I am correct, please do not keep re-posting the same topic.

I'm sorry i repeated this same topic since i'm seeking a developer's advise. need to fix this accordingly. Please help on this.

Reason: