1. Please insert the code correctly: when editing a message, press the button and paste your code into the pop-up window (for the first time I corrected your message and pasted the code correctly)
2. An example of how to get the indicator value from an Expert Advisor: Creating an iMA indicator handle, getting indicator values

- 2020.03.05
- www.mql5.com
Hi everyone,
I'm new in mql5,
I'm trying to run a script that get the value of the moving average IMA. but the problem that it always return me the value of 10
i know that mql5 is different than mql4, and i have to use the function Copybuffer. i tried but no result
if anyone can help me please !! that's my code :
int EMA_HANDLE = iMA(Symbol(),PERIOD_M5,3,1,MODE_EMA,PRICE_CLOSE); double data[]; ArraySetAsSeries(data, true); CopyBuffer(EMA_HANDLE , 0, 0, 1, data); double ema_value=data[0];
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)
MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
How to call indicators in MQL5 - MQL5 Articles (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
Hi everyone,
I'm new in mql5,
I'm trying to run a script that get the value of the moving average IMA. but the problem that it always return me the value of 10
i know that mql5 is different than mql4, and i have to use the function Copybuffer. i tried but no result
if anyone can help me please !! that's my code :