Why won't this code work? Need help please.

 
//+------------------------------------------------------------------+
//|                                          tool buffer display.mq5 |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
//#property indicator_plots 1
//string buff_1 = "try it out";
// string buff_1 ="";
input string enter_name_exactly = "Waddah Attar Explosion";
input int buffer_num1 = 0;
input int bars_back1 = 0;
input int digits = 2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
  
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//---
double a = iCustom(Symbol(), Period(), enter_name_exactly,buffer_num1,bars_back1);
string xx1 = DoubleToString(a, digits);


    ObjectCreate(0,"buff_1", OBJ_LABEL,0,0,0,0,0);
    ObjectSetInteger(0,"buff_1",OBJPROP_XDISTANCE,200);
    ObjectSetInteger(0,"buff_1",OBJPROP_YDISTANCE,20);
    ObjectSetString(0,"buff_1",OBJPROP_TEXT,xx1 +" buffer " +buffer_num1 +" Bar " +bars_back1);
    ObjectSetInteger(0,"buff_1",OBJPROP_CORNER,CORNER_RIGHT_LOWER);
    ObjectSetString(0,"buff_1",OBJPROP_FONT,"Arial");
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
I'm trying to get the value of a buffer out of an indicator using iCustom and displaying it's result in Object_Create label object but the result is always 1.00.  
 

At first iCustom function creates an indicator and returns a handle (int). It isn't the same as indicator value. You should use CopyBuffer function to get indicator values.

At second it isn't good idea to use iCustom in OnCalculate function.

I think the source of Alligator indicator might be helpful for you.

Reason: