Help for linking EA to Custom Indicator

 
Please can someone tell me what I am doing wrong! The indicator works correctly both for the lines displayed and their values.

I do not seem to be able to transfer the values correctly to the EA.

In the EA the EA calculation of the pivot value matches the displayed indicator pivot value (say 2.0560) BUT the value I am trying to get from the EA is totally wrong (21477483647 a few million too many)

//Indicator to draw daily pivots on chart

#property indicator_chart_window
#property indicator_buffers 3

#property indicator_color1 Aqua
#property indicator_color2 Yellow
#property indicator_color3 Red

#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID
#property indicator_style3 STYLE_SOLID

#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1

double R1_0[], PIVOT_0[], S1_0[], Rates_D1[2][6];

int init()
   {   
      SetIndexBuffer(0, R1_0); 
      SetIndexLabel(0, "R1"); 
      SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1, Aqua);
      
      SetIndexBuffer(1, PIVOT_0); 
      SetIndexLabel(1, " PIVOT"); 
      SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1, Yellow);
      
      SetIndexBuffer(2, S1_0); 
      SetIndexLabel(2, "S1"); 
      SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 1, Red);

      IndicatorShortName("Als20pip");
      
      return(0);
   }

int start()
   {
      ArrayCopyRates(Rates_D1, Symbol(), PERIOD_D1);

      double yesterday_close = Rates_D1[1][4];
      double yesterday_open = Rates_D1[1][1];
      double yesterday_high = Rates_D1[1][3];
      double yesterday_low = Rates_D1[1][2];
      
      string StrR1Value = "";
      string StrPIVOTValue = "";
      string StrS1Value = "";
   
      int counted_bars=IndicatorCounted(); 
      if(counted_bars<0) return(-1); 
      if(counted_bars>0) counted_bars--;
      int Limit = Bars-counted_bars;
   
      for(int i = Limit; i > 0; i--)
         {  
            PIVOT_0[i] = (yesterday_high + yesterday_low + yesterday_close)/3.0 ;
            R1_0[i] = (2.0 * PIVOT_0[i]) - yesterday_low;
            S1_0[i] = (2.0 * PIVOT_0[i]) - yesterday_high;
      
            StrR1Value = DoubleToStr(R1_0[i], 4);
            StrPIVOTValue = DoubleToStr(PIVOT_0[i], 4);
            StrS1Value = DoubleToStr(S1_0[i], 4);
         }
      
      ObjectMakeLabel("R1", 70, 40 , 0);
      ObjectSetText("R1", "R1 - " , 10, "Arial Bold", Aqua);
      ObjectMakeLabel("R1Value", 30, 40, 0);
      ObjectSetText("R1Value", StrR1Value , 10, "Arial", Aqua);
     
      ObjectMakeLabel("Pivot", 70, 55, 0);
      ObjectSetText("Pivot", "Pivot - " , 10, "Arial Bold", Yellow);
      ObjectMakeLabel("PivotValue", 30, 55, 0);
      ObjectSetText("PivotValue", StrPIVOTValue , 10, "Arial", Yellow);
     
      ObjectMakeLabel("S1", 70, 70, 0);
      ObjectSetText("S1", "S1 - " , 10, "Arial Bold", Red);
      ObjectMakeLabel("S1Value", 30, 70, 0);
      ObjectSetText("S1Value", StrS1Value , 10, "Arial", Red);
  
      return(0);
   }

int ObjectMakeLabel(string n, int xoff, int yoff, int WindowToUse)
   {
      ObjectCreate(n, OBJ_LABEL, WindowToUse, 0, 0);
      ObjectSet(n, OBJPROP_CORNER, 1);
      ObjectSet(n, OBJPROP_XDISTANCE, xoff);
      ObjectSet(n, OBJPROP_YDISTANCE, yoff);
      ObjectSet(n, OBJPROP_BACK, true);
   }

void CleanUp()
   {
      ObjectDelete("R1");
      ObjectDelete("PIVOT");
      ObjectDelete("S1");
      ObjectDelete("R1Value");
      ObjectDelete("PIVOTValue");
      ObjectDelete("S1Value");
   }



//EA attempting to link to indicator!

#property copyright "Copyright © 2007"
#property link      "http://"
double Pivot = 0;
iCustom(NULL, PERIOD_D1, "TestPivots", 1, 0);
double GBPAsk = 0, GBPBid = 0;

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()

   {
     
      GBPAsk = MarketInfo("GBPUSD", MODE_ASK);
      GBPBid = MarketInfo("GBPUSD", MODE_BID);
      
      Pivot = (iHigh("GBPUSD",PERIOD_D1,1)+iLow("GBPUSD",PERIOD_D1,1)+iClose("GBPUSD",PERIOD_D1,1))/3;
      Print(Pivot);

      Pivot = iCustom(NULL, PERIOD_D1, "TestPivots", 1, 0);
      Print(Pivot);
      
      return(0);
   }


 
See searche's results - 2147483647
 
Understand your answer ok and know it is an empty value, BUT why does my code return an empty value every tick. Is there something wrong with what I am doing to get the info from the indicator which is working/drawing the lines and displaying the values correctly. Should the following code work or is there a bug

Pivot = iCustom(NULL, PERIOD_D1, "TestPivots", 1, 0);
Reason: