I am trying to calculate iBandsOnArray for MQL5 but i am only able to get the middle line value in my expert my upper and lower line keep giving me wrong values
i think the problem is from the standard deviation
if i can get a standard deviation function that i can apply to the current bb mid value, i can get it to work
The problem i have with standard deviation is that it expects whole arrays for price and maprice and i only have current bb mid value and current oscillator value
is there a way i can use only current and previous price and maprice values to get deviation?
my code is below
have you a solution?
I need also to use bollinger on array and I've problem with stdDev...
have you a solution?
I need also to use bollinger on array and I've problem with stdDev...
none
hopefully MQL will add it to MT5 soon
I use this,
ArrayResize(UB1, rates_total); ArrayResize(LB1, rates_total); ArrayResize(MidB, rates_total); for (int k = 0; k < rates_total; k++) { UB1[k] = iBandsOnArray(rsiArray, rates_total, BandsPeriod1, BandDeviation1, BandsShift1, MODE_UPPER, k); MidB[k] = iBandsOnArray(rsiArray, rates_total, BandsPeriod1, 0, BandsShift1, MODE_MAIN, k); LB1[k] = iBandsOnArray(rsiArray, rates_total, BandsPeriod1, BandDeviation1, BandsShift1, MODE_LOWER, k); } // Return the midline double GetRSIMid(int shift) { return MidB[shift]; } double SafeGet(const double &buf[], int i) { int n = ArraySize(buf); if(i < 0 || i >= n) return EMPTY_VALUE; return buf[i]; } double GetRSIUpper(int level, int i) { switch(level) { case 0: return SafeGet(UB1,i); } return EMPTY_VALUE; } double GetRSILower(int level, int i) { switch(level) { case 0: return SafeGet(LB1,i); } return EMPTY_VALUE; } I am testing to see if I can get the correct values.
Print testing to the Experts tab can make testing easier:
for (int k = 0; k < rates_total; k++) { UB1[k] = iBandsOnArray(rsiArray, rates_total, BandsPeriod1, BandDeviation1, BandsShift1, MODE_UPPER, k); MidB[k] = iBandsOnArray(rsiArray, rates_total, BandsPeriod1, 0, BandsShift1, MODE_MAIN, k); LB1[k] = iBandsOnArray(rsiArray, rates_total, BandsPeriod1, BandDeviation1, BandsShift1, MODE_LOWER, k); Print("Upper: ", UB1[k]); Print("Mid: ", MidB[k]); Print("Lower: ", LB1[k]); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to calculate iBandsOnArray for MQL5 but i am only able to get the middle line value in my expert my upper and lower line keep giving me wrong values
i think the problem is from the standard deviation
if i can get a standard deviation function that i can apply to the current bb mid value, i can get it to work
The problem i have with standard deviation is that it expects whole arrays for price and maprice and i only have current bb mid value and current oscillator value
is there a way i can use only current and previous price and maprice values to get deviation?
my code is below