Why bollinger buffers show identical values

#property copyright "Adam"
#property link      "https://mql5.com"
#property version   "1.00"

int bbHandle;

void OnInit()
{

   bbHandle = iBands(Symbol(),PERIOD_CURRENT,20,2,0,PRICE_CLOSE);
   
}

void OnTick()
{

   double upbb[];
   double lwbb[];
   double mibb[];
   
   ArraySetAsSeries(upbb,true);
   ArraySetAsSeries(lwbb,true);
   ArraySetAsSeries(mibb,true);
   
   CopyBuffer(bbHandle,1,0,2,upbb);
   CopyBuffer(bbHandle,2,0,2,lwbb);
   CopyBuffer(bbHandle,0,0,2,mibb);
   
   Comment(upbb[1], "|", lwbb[1], "|", mibb[1]);

}

Hello,

I have lurked on a lot of posts but this is my first actual post so hi!

I’m learning to code MQL5 and I have tried to use buffers to copy the last values of the Bollinger bands to arrays, from which the values are then commented. For some reason the comment displays the same data 3 times:

44

I can’t get my head around it, it’s not important I’m doing it purely for the purposes of learning but it is driving me nuts! I have checked the documentation on iBands and Buffers but for someone inexperienced like myself this often leaves me more confused than I was before.

Thank you in advance,

  bbHandle = iBands(Symbol(),PERIOD_CURRENT,20,2,0,PRICE_CLOSE);

check your parameters.

Thank you, that is embarrassing on my skills as a trader… not a new developer lol

I have encountered another issue with this today, I have tried for hours to get it right but I just cannot seem to diagnose the issue, nor find any help online and it’s so frustrating!

double Open[];

double iOpen(string symbol(),ENUM_TIMEFRAMES timeframe, int index)

{

   double open=0;
   ArraySetAsSeries(Open,true);
   int copied=CopyOpen(symbol(),timeframe,0,Bars(symbol(),timeframe),Open);
   
   if(copied>0 && index<copied) open=Open[index];
   return(open);
   
}

double previous_open = iOpen(Symbol(),PERIOD_CURRENT,1);

The following error messages are being displayed:

45

Thank you in advance and apologies for being so dense

double _Open[];

double iOpen(string symbol,ENUM_TIMEFRAMES timeframe, int index)
{

   double open=0;
   ArraySetAsSeries(_Open,true);
   int copied=CopyOpen(symbol,timeframe,0,Bars(symbol,timeframe),_Open);
   
   if(copied>0 && index<copied) open=_Open[index];
   return(open);
   
}

also CopyOpen, CopyBuffer and other timeseries related copy functions, need a array (of type double often) as the last parameter.