Then the problem is there doesn't seem to be mathematical functions for stdev and mean in MQL5, apart from iStd and iMA which are rather different!
https://www.mql5.com/en/docs/standardlibrary/mathematics/stat/mathsubfunctions/statmathmean
Anthony Garot:
https://www.mql5.com/en/docs/standardlibrary/mathematics/stat/mathsubfunctions/statmathmean
Brilliant, perfect answer, thanks!
Unbelievably hidden away in the standard MQL5 docs though..
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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,
Sometimes I like to think in daily returns for a security (!)
So for instance, I'd like to know the volatility (standard deviation) of the last year of daily returns of EURUSD.
Unfortunately I cannot find a quick way to get this in MQL5.
iSTD will give me the standard deviation of the PRICE of EURUSD, but that is a different thing.
In theory I could use iMA to get a series of daily returns. Then the problem is there doesn't seem to be mathematical functions for stdev and mean in MQL5, apart from iStd and iMA which are rather different!
Of course, one could always do a cumbersome procedure such as get all the daily close prices in an array, loop through the array dividing each by predecessor to get the daily returns.
However, surely MQL5 must be better than this!
Any ideas?