BBWidthAverageBuffer[i] would not plot, help appreciated.
Do a separate loop for iMAOnArray after populating the other buffer.
Do a separate loop for iMAOnArray after populating the other buffer.
int begin=!prev_calculated?rates_total-BBandPeriod-1:rates_total-prev_calculated; double bandsUpper, bandsLower, bandsMain, bbwidth[]; for (int i=begin;i>=0;i--) { bandsUpper=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_UPPER,i); bandsLower=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_LOWER,i); bandsMain=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_MAIN,i); bbwidth[i]=(bandsUpper-bandsLower)/bandsMain*100; // BBWidthAverageBuffer[i]=iMAOnArray(bbwidth,0,20,0,MODE_SMA,i); } for (int i=begin;i>=0;i--) { BBWidthAverageBuffer[i]=iMAOnArray(bbwidth,0,20,0,MODE_SMA,i); }
I did this as a separate loop, but nothing showed up either. Am I wrong in the coding?
I did this as a separate loop, but nothing showed up either. Am I wrong in the coding?
I just noticed
double bandsUpper, bandsLower, bandsMain, bbwidth[];
why are you not declaring bbwidth[] as a buffer? If you are going to use it as a normal array, then you will need to size it which is a waste of time when you can just make it a buffer.
I just noticed
why are you not declaring bbwidth[] as a buffer? If you are going to use it as a normal array, then you will need to size it which is a waste of time when you can just make it a buffer.
A great thanks to you, Keith. My apologies I am still a newbie in the learning of MQL and neither am I good in C++.
This time around I managed to show something in my plot. So a buffer does make things easier. I will read up more on this. Your kind pointers are most appreciated.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
BBWidthAverageBuffer[i] would not plot, help appreciated.