The problem is that MT4's
iStdDev
function differs from classic standard deviation formula used in Excel, Marketscope and hundreds of other applications.The problem was discussed on mql4.com:
mt4 support wrote:user wrote:If I calculate the standard deviation for a set of prices held in an array in MT4 I get a completely different result compared to calculating the STD in Excel using the STDEVPA function and the same data held in the array.
Standard Deviation formula is different calculated in different platforms (groups, individuals), mostly is based on change on smoothed price (ex.: get iStdDev from Moving Average indicator), but you can do the same but with actual Close prices ( or OHLC ) and by percent changes with same data (periods or ticks) and compare in MT4 and excel.
So, here is a port of MT4's iStdDev indicator to Lua.
Download:
The indicator was revised and updated