int BandsHandle; double Middle[], Upper[], Lower[]; void OnInit() { SetIndexBuffer(0, Middle, INDICATOR_DATA); SetIndexBuffer(1, Upper, INDICATOR_DATA); SetIndexBuffer(2, Lower, INDICATOR_DATA); BandsHandle = iBands(_Symbol, 0, BBPeriod, 0, BBDeviation, PRICE_CLOSE); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { ... int to_copy; if(prev_calculated>rates_total || prev_calculated<0) to_copy=rates_total; else { to_copy=rates_total-prev_calculated; if(prev_calculated>0) to_copy++; } //The buffer numbers are the following: 0 - BASE_LINE, 1 - UPPER_BAND, 2 - LOWER_BAND CopyBuffer(BandsHandle, 0, 0, to_copy, Middle); CopyBuffer(BandsHandle, 1, 0, to_copy, Upper); CopyBuffer(BandsHandle, 2, 0, to_copy, Lower); ... return rates_total; }
Masoud1365:
An example of get values from the iBands indicator
hi,
i program via mql4 before, now i am trying to create EA in mql5 but i cant use iBands in mql5, for example
in mql4 : iBands(Symbol(),0,20,2,0,PRICE_CLOSE,MODE_LOWER,2); but in mql5 i cant set mode ( MODE_LOWER or UPPER ) And cant set shift.
how can i get value of bb , for example value of upper band in last 2 candle
i test icustom for use bb indicator and i get 4802 error
thanks

How to start with MQL5
- 2020.07.05
- www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...

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
hi,
i program via mql4 before, now i am trying to create EA in mql5 but i cant use iBands in mql5, for example
in mql4 : iBands(Symbol(),0,20,2,0,PRICE_CLOSE,MODE_LOWER,2); but in mql5 i cant set mode ( MODE_LOWER or UPPER ) And cant set shift.
how can i get value of bb , for example value of upper band in last 2 candle
i test icustom for use bb indicator and i get 4802 error
thanks