Strange values from External Indicacor with CopyBuffer

 

Hi.

I'm trying to get 2 values from a free indicator downloaded from the market.

These are the indicator parameters:


This is my OnInit code, that works fine because I get a message for a valid handle:

int OnInit()
  {
//---
   ResetLastError();

   iIndicatorhandle = iCustom(_Symbol, _Period, cIndicatorname, 1, 0.019, 25.0, 75.0, 3, 100);
   Print("iIndicatorhandle = ", iIndicatorhandle,"  error =", GetLastError());
   ResetLastError();
   if(iIndicatorhandle==INVALID_HANDLE)
     {
      Print("// Indicador: ", cIndicatorname, " -->iIndicatorhandle INVÁLIDO: ",iIndicatorhandle);
     }
   else
     {
      Print("// Indicador: ", cIndicatorname, " -->iIndicatorhandle VÁLIDO: ",iIndicatorhandle);
     }
     
     

//---
   return(INIT_SUCCEEDED);
  }


This is my code located on OnTick function, for get values for the previous candle (Print and Comment functions are for debug values) :

   double dMegaSpikesSELL[];
   double dMegaSpikesBUY[];
   double dMegaSpikesSELLvalue;
   double dMegaSpikesBUYvalue;
   
   bool lAsSeriesBuy = ArraySetAsSeries(dMegaSpikesBUY, true);
   bool lAsSeriesSell = ArraySetAsSeries(dMegaSpikesSELL, true);
   
   ResetLastError();

   int iCopiedBUY = CopyBuffer(iIndicatorhandle, 0, 0, 2, dMegaSpikesBUY);
   int iCopiedSELL = CopyBuffer(iIndicatorhandle, 1, 0, 2, dMegaSpikesSELL);
   
   
   if(BarsCalculated(iIndicatorhandle)>0)
   {
   isBarsCalculated = true;
   cBarsCalculated = "True";
   }

   dMegaSpikesSELLvalue = dMegaSpikesSELL[1];
   dMegaSpikesBUYvalue  = dMegaSpikesBUY[1];

   Comment("\n Buffer copied dMegaSpikesBUY : "+ IntegerToString(iCopiedBUY) +
           "\n Buffer copied dMegaSpikesSELL : "+ IntegerToString(iCopiedSELL) +
           "\n BarsCalculated : "+ cBarsCalculated +
           "\ndMegaSpikesSELL[1] : "+DoubleToString(dMegaSpikesSELL[1], 6) +
           "\ndMegaSpikesBUY[1] : "+DoubleToString(dMegaSpikesBUY[1],6) +
           "\ndMegaSpikesSELLvalue : "+DoubleToString(dMegaSpikesSELLvalue,6) +
           "\ndMegaSpikesBUYvalue : "+DoubleToString(dMegaSpikesBUYvalue,6)
          );
          
    Print(" lAsSeriesSell: ", lAsSeriesSell);
    Print("dMegaSpikesSELL[0]: ",DoubleToString(dMegaSpikesSELL[0], 6));
    Print(" lAsSeriesBuy: ", lAsSeriesBuy);
    Print("dMegaSpikesBUY[0]: ",DoubleToString(dMegaSpikesBUY[0], 6));


These are the indicator variables (Data window):


I am assuming that the Sell and Buy buffers of the indicator are 0 (Sell) and 1 (Buy). But the buffer values have strange values:



The buffer values ​​should be 0 or empty, right?

Why do the buffer values ​​have these strange values?

What I'm doing wrong?

Are there indicators that do not allow their values ​​to be extracted?

I have tried to find in the documentation about it but I have not found information that can help me.

Can you help me, please?

Thanks in advance.


GB.

 

Usually Buy and Sell signals are processed via DRAW_ARROW buffers. And empty values are like "don't show arrow".

The strange numbers mean: EMPTY_VALUE

 
Yashar Seyyedin #:

Usually Buy and Sell signals are processed via DRAW_ARROW buffers. And empty values are like "don't show arrow".

The strange numbers mean: EMPTY_VALUE

Thank you, Yashar !!!

Your answer has helped me a lot.

God bless you.

GB