Hello, does anyone know how the Bollinger Bands level lines are calculated in Metatrader, please? I need these values to use in an EA but I don't know how to get to them. The print below is of a standard configuration. Period 20, Offsets 2, Offset 0 applied to closing price.
And the levels I put +2 (upper white line) and -2 (lower white line).
Guys, I've figured it out. For those who are interested, here's how it works: The level is the displacement of the bands vertically by a factor that is multiplied by the original formula (Deviations * Standard Deviation), so the final formula looks like this: Upper Band = SMA + (Standard Deviation * Deviations)
Lower Band = SMA - (Standard Deviation * Deviations) The levels come in as a second multiplier, so it looks like this:
Upper Band = SMA + (Standard Deviation * Deviations * Level)
Lower Band = SMA - (Standard Deviation * Deviations * Level) So in my case a practical way to get this line in my EA is to plot two Bollinger Bands, one with Deviations of 2 and the other with Deviations of 4, i.e. Deviations * Levels.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hello, does anyone know how the Bollinger Bands level lines are calculated in Metatrader, please?
I need these values to use in an EA but I don't know how to get to them.
The print below is of a standard configuration. Period 20, Offsets 2, Offset 0 applied to closing price.
And the levels I put +2 (upper white line) and -2 (lower white line).
Guys, I've figured it out. For those who are interested, here's how it works: The level is the displacement of the bands vertically by a factor that is multiplied by the original formula (Deviations * Standard Deviation), so the final formula looks like this:
Upper Band = SMA + (Standard Deviation * Deviations)
Lower Band = SMA - (Standard Deviation * Deviations)
The levels come in as a second multiplier, so it looks like this:
Upper Band = SMA + (Standard Deviation * Deviations * Level)
Lower Band = SMA - (Standard Deviation * Deviations * Level)
So in my case a practical way to get this line in my EA is to plot two Bollinger Bands, one with Deviations of 2 and the other with Deviations of 4, i.e. Deviations * Levels.