Standard Deviation MT4 formula

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Standard Deviation MT4 formula

Postby Nikolay.Gekht » Mon Sep 05, 2011 10:27 am

The indicator has no practical meaning itself, but is useful for whose who wants to make their indicators to calculate the same values as MT4 indicators based on the standard deviation do.

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:
MT4_STDDEV.lua
(2.55 KiB) Downloaded 1135 times


The indicator was revised and updated
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC



Return to Custom Indicators

Who is online

Users browsing this forum: No registered users and 188 guests