#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:
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,