Ok, so after more playing around I've figured out that it's only the 'handle' that's being returned as an integer, not the actual buffer values.
Is the correct practice to declare a buffer inside the EA and then use those values, or is there still another way to retrieve the values in the buffer with one command?
Ok, so after more playing around I've figured out that it's only the 'handle' that's being returned as an integer, not the actual buffer values.
Is the correct practice to declare a buffer inside the EA and then use those values, or is there still another way to retrieve the values in the buffer with one command?
It would help you to read the documentation.
I have another question. In MT5, the indicator called by iCustom is calculated asynchronously, so when I want to get the value of indicator in my EA's OnTick function, how do I know the indicator value is already up to date.
When an old bar is closed and a new bar just open, then mt5 will do the calculation of indicator's OnCalculate function and my ea's OnTick function asynchronously, it is possible that OnTick is finished earlier than OnCalculate if the indicator is very complex. I don't find a way to check if the calculation of OnCalculate has aready finished.
Alain Verleyen:
It would help you to read
the documentation.
Not helpful.
Read the documentation and doesn't mention anything about EA to Indicator best practice.
I have another question. In MT5, the indicator called by iCustom is calculated asynchronously, so when I want to get the value of indicator in my EA's OnTick function, how do I know the indicator value is already up to date.
When an old bar is closed and a new bar just open, then mt5 will do the calculation of indicator's OnCalculate function and my ea's OnTick function asynchronously, it is possible that OnTick is finished earlier than OnCalculate if the indicator is very complex. I don't find a way to check if the calculation of OnCalculate has aready finished.
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 call indicators in MQL5 - MQL5 Articles 12 March 2010

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey MQL Experts!
I'm attempting to use iCustom to return the current values of the indicators for my EA.
I've been hunting around MQL5 forums and Stack Overflow and attempted to follow the responses exactly however still not getting much luck. I'm clearly missing something and I bet it's super obvious so a virtual shout to whoever can nail it first! :)
Trying to return two values from the Adaptive Moving Average indicator 'AMA'.
According to what I've read, in terms of the params you use:
1. Symbol
2. Period
3. <Indicator Name>
4. Inputs
5. Buffer Index
6. Value offset
I've tried all different sorts of combos in the parameters but I still continuously receive integers counting up instead of the actual value of the adaptive moving average which is what I'm after.
I've also attached both the EA and Indi file for your reference.
Any other references than?
https://www.mql5.com/en/docs/indicators/icustom