rhodium1trading: But if I use "Print (lower_band[2])" in order to read the same value at past candle 2, it doen't return anything. Could someone please explain a reason for that?
-
Perhaps you should read the manual, especially the examples.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
How to call indicators in MQL5 - MQL5 Articles 12 March 2010 - Your CopyBuffer call asked for two values. Their indexes are therefor [0 … 1]. Why do you think you can read array index 2?
rhodium1trading :
When I use the following code to read the bollinger band lower value at the past candle 1, it works fine.
But if I use "Print (lower_band[2])" in order to read the same value at past candle 2, it doen't return anything. Could someone please explain a reason for that?First, fix the main mistake:
Forum on trading, automated trading systems and testing trading strategies
How to get opening and current price information according to position interpretation?
Vladimir Karputov, 2020.12.28 11:21
Remember the rule: the indicator handle MUST be received ONCE! This is done in OnInit () !!!
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
When I use the following code to read the bollinger band lower value at the past candle 1, it works fine.
But if I use "Print (lower_band[2])" in order to read the same value at past candle 2, it doen't return anything. Could someone please explain a reason for that?