HELP! iCustom not giving the same values as indicators

 

I want to include the StochasticRVI indicator values for the current + 1 candle in a EA. I have used iCustom to get the values from the indicators but none of the 0-7 modes return the value as listed in the data window or as shown on the indicator in the chart window. What am I doing wrong? The code is below - any help or advise on this would be great.


#property indicator_separate_window
#property indicator_minimum -1.0
#property indicator_maximum 1.0
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue

double gda_76[];
double gda_80[];
double gda_84[];
double gda_88[];
double gda_92[];
double gda_96[];
extern int Length2 = 10;
int gi_104 = 0;
int gi_108 = 0;

int init() {
   gi_108 = Length2;
   initBuffer(gda_76, "Stochastic RVI Rev2", DRAW_LINE);
   initBuffer(gda_80, "Trigger", DRAW_LINE);
   initBuffer(gda_84);
   initBuffer(gda_88);
   initBuffer(gda_92);
   initBuffer(gda_96);
   IndicatorBuffers(gi_104);
   IndicatorShortName("Stochastic RVI [" + Length2 + "]");
  

   return (0);

}

int start() {
   double ld_12;
   double ld_20;
   double ld_32;
   double ld_40;
   double ld_48;
   double ld_60;
   if (Bars <= gi_108) return (0);           // if chart bar are less than 10 (default setting then Zero
      int li_0 = IndicatorCounted();         // the number of bars no changed after indicator was started
   if (li_0 < 0) return (-1);
   if (li_0 > 0) li_0--;
      int li_8 = Bars - li_0 - 1;
   for (int li_4 = li_8; li_4 >= 0; li_4--) {
      gda_88[li_4] = (Close[li_4] - Open[li_4] + 2.0 * (Close[li_4 + 1] - (Open[li_4 + 1])) + 2.0 * (Close[li_4 + 2] - (Open[li_4 + 2])) + (Close[li_4 + 3] - (Open[li_4 +
         3]))) / 6.0;
      gda_92[li_4] = (High[li_4] - Low[li_4] + 2.0 * (High[li_4 + 1] - (Low[li_4 + 1])) + 2.0 * (High[li_4 + 2] - (Low[li_4 + 2])) + (High[li_4 + 3] - (Low[li_4 + 3]))) / 6.0;
      ld_12 = 0.0;
      ld_20 = 0.0;
      for (int l_count_28 = 0; l_count_28 < Length2; l_count_28++) {
         ld_12 += gda_88[li_4 + l_count_28];
         ld_20 += gda_92[li_4 + l_count_28];
      }
      if (ld_20 != 0.0) gda_84[li_4] = ld_12 / ld_20;
      else gda_84[li_4] = 0.0;
      ld_32 = gda_84[li_4];
      ld_40 = ld_32;
      ld_48 = ld_32;
      for (int l_count_56 = 0; l_count_56 < Length2; l_count_56++) {
         ld_60 = gda_84[li_4 + l_count_56];
         ld_40 = MathMax(ld_40, ld_60);
         ld_48 = MathMin(ld_48, ld_60);
      }
      gda_96[li_4] = 0.0;
      if (ld_40 != ld_48) gda_96[li_4] = (ld_32 - ld_48) / (ld_40 - ld_48);
      gda_76[li_4] = (4.0 * gda_96[li_4] + 3.0 * (gda_96[li_4 + 1]) + 2.0 * (gda_96[li_4 + 2]) + (gda_96[li_4 + 3])) / 10.0;
      gda_76[li_4] = 2.0 * (gda_76[li_4] - 0.5);
      gda_80[li_4] = 0.96 * (gda_76[li_4 + 1] + 0.02);
   }
   return (0);
}

void initBuffer(double ada_0[], string as_4 = "", int ai_12 = 12, int ai_16 = 0, int a_style_20 = -1, int ai_24 = -1, int ai_unused_28 = -1) {
   SetIndexBuffer(gi_104, ada_0);
   SetIndexLabel(gi_104, as_4);
   SetIndexEmptyValue(gi_104, EMPTY_VALUE);
   SetIndexDrawBegin(gi_104, gi_108);
   SetIndexShift(gi_104, 0);
   SetIndexStyle(gi_104, ai_12, a_style_20, ai_24);
   SetIndexArrow(gi_104, ai_16);
   gi_104++;
   
} 
 

My Dear, it's a decompiled copy of the indicator, so where is your iCustom format ?

write it here to we will try to know where is the problem exactly.

 
tiodaronzi:

My Dear, it's a decompiled copy of the indicator, so where is your iCustom format ?

write it here to we will try to know where is the problem exactly.

Hi tidaronzi


Thanks for the reply - came right last night after a while.


Thanks again

Reason: