Perhaps you should read the manual, especially the examples.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
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)
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
How to call indicators in MQL5 - MQL5 Articles (2010)
Perhaps you should read the manual, especially the examples.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
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)
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
How to call indicators in MQL5 - MQL5 Articles (2010)
I have created an expert advisor that searches, within all the symbols offered by the broker, which symbols in a specific timeframe satisfy certain requirements given by the values of several indicators.
Everything works well only that sometimes the call to get the handle takes a long time (I assume for the lack of data on the broker's server as the reference market of the symbol, typically a stock, is closed).
Is there a way to limit the waiting time and then generate an exception that allows me to discard the symbol and move on to the next one?
Below is the piece of code under observation (in this example I need only three values of simple moving average of the symbol):
The number of handle is limited. Maybe you have to release the indicators when you move to the next symbol. If your EA invokes a new handle the indicator has to be calculated (for the numbers of bars of the chart I guess) this might take a while.
Perhaps it is how you ask your questions.
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problem
Your code certainly is not waiting for the newly created handle to update. And therefor is wrong.
Your code also doesn't synchronize the other symbols. And therefor is wrong.
On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)

- 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 have created an expert advisor that searches, within all the symbols offered by the broker, which symbols in a specific timeframe satisfy certain requirements given by the values of several indicators.
Everything works well only that sometimes the call to get the handle takes a long time (I assume for the lack of data on the broker's server as the reference market of the symbol, typically a stock, is closed).
Is there a way to limit the waiting time and then generate an exception that allows me to discard the symbol and move on to the next one?
Below is the piece of code under observation (in this example I need only three values of simple moving average of the symbol):