Получить цвет индикатора в данный момент времени

 

День добрый,

Вопрос в теме, а именно, есть :

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots   1

#property indicator_type1   DRAW_COLOR_HISTOGRAM
#property indicator_color1  DeepSkyBlue, Red, LightGray, Lime, Black, Magenta
#property indicator_style1  0
#property indicator_width1  2

int OnCalculate(
    const int rates,
    const int counted,
    const datetime &Time[],
    const double &Open[],
    const double &High[],
    const double &Low[],
    const double &Close[],
    const long &TickVolume[],
    const long &Volume[],
    const int &Spread[])

{

    ...

   int volumeColorIndex = int(InVolumeColor[ArraySize(InVolumeColor) - 1]);

   color volumeColor = PlotIndexGetInteger(volumeColorIndex, PLOT_LINE_COLOR); // TRY TO GET THE COLOR OF LAST ELEMENT IN BUFFER - BUT WITHOUT LUCK - IT ALWAYS RETURNS 0

   ShowLabel(name, "Demo", 100, fontSize, color);

    ...

}

void ShowLabel(const string name, const string value, const int positionTop, const int fontSize, const color fontColor)
{
    if (ObjectFind(0, name) < 0)
    {
        ObjectCreate(0, name, OBJ_LABEL, ChartWindow, 0, 0);
    }
   
    ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
    ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 20);  
    ObjectSetInteger(0, name, OBJPROP_XDISTANCE, 10);
    ObjectSetInteger(0, name, OBJPROP_YDISTANCE, positionTop);
    ObjectSetInteger(0, name, OBJPROP_COLOR, fontColor);
    ObjectSetString(0, name, OBJPROP_TEXT, value);
    ObjectSetString(0, name, OBJPROP_FONT, "Arial");
}


Вобщем, пытаюсь получить цвет последнего элемента в буфере цветов индикатора, но PlotIndexGetInteger всегда возвращает 0, может у кого есть идеи как это исправить и как получить не индекс цвета из буфера, а сам цвет?

P.S. Буфер заполнен правильными данными и отрисовывается как надо, проблема исключительно в том, что я не знаю как по индексу получить цвет.

 
//--- номер буфера отрисовки цветом
   int plot_index=0;

//--- количество цветов
   int count=PlotIndexGetInteger(plot_index,PLOT_COLOR_INDEXES);

//--- массив цветов
   color colours[];
   ArrayResize(colours,count);

//--- заполнение массива
   for(int i=0;i<count;i++)
     {
      colours[i]=(color)PlotIndexGetInteger(plot_index,PLOT_LINE_COLOR,i);
      PrintFormat("%d %s",i,ColorToString(colours[i],true));
     }