// Fetch the latest data for the Bollinger Bands upper and lower bands if(CopyBuffer(bandsHandle, 0, 1, 1, upperBandData) <= 0) // Fetch the upper band value of the last closed candle
What you are doing here is getting the information for the middle(baseline) band as that is buffer 0.
See iBands documentation in MQL5 reference under Technical Indicators.
Argh that is so trivial and frustrating! Thank you Douglas, great spot!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
for the life of me, I cannot accurately get the upper and lower bollinger bands. I apply my code and when referencing with the same input settings on the real-time chart, they don't align! The upper is in sync with the middle bollinger line (average).
Here's my code:
- CopyBuffer function should be handling this and I've read the documentation a thousand times. Can someone guide me on where I'm going wrong? I'm printing and drawing on the chart to get to the bottom of my error but I can't piece it together.