MovingAverageDeviationBandsMT5
- Indicatori
- Chishi Suginio
- Versione: 1.5
- Aggiornato: 19 gennaio 2026
MAD Bands (Moving Average Deviation Bands)
MAD Bands are intended to be used when you want to visually check the behavior of price volatility in relation to a moving average.
MAD_Bands (MQL5 version) parameter description
This document explains the MT4 parameter input screen for each setting item (input parameter).
Group: Main (basic settings)
Period
- Default : 20
- Explanation : The number of candlesticks used to calculate the moving average (Mid) and band width. The larger the value, the smoother the line will be, but the slower the reaction will be.
Shift
- Default : 0
- Explanation : Shifts the indicator drawing position to the left or right. 0 is.
Center Method
- Default : EMA
- Description : Select the calculation logic for the center line (Mid line).
- SMA: Simple Moving Average
- EMA: Exponentially smoothed moving average (emphasis on recent trends)
- WMA: Weighted moving average
- SMMA: Smoothed moving average (long-term)
- ZLMA: Zero-lag MA (fast response)
- TMA: Triangular Moving Average (smooth)
- Median: Median value (characteristic of ignoring whiskers)
Applied Price
- Default : Close
- Description : The price data to use in the calculation (closing price, opening price, etc.).
Deviation Method
- Default : Max
- Description : Select the bandwidth decision logic.
- BB: Bollinger Bands (standard deviation)
- ATR: Keltner Channel (ATR)
- MAD: Median Absolute Deviation (robust to outliers)
- QSigma: Quantile Sigma (based on statistical distribution)
- Blend: Blends standard deviation and ATR
- Max: Use the larger of the standard deviation and ATR
Group: Deviation Settings
Deviation Multiplier (Global)
- Default : 1.0
- Explanation : This is the magnification for the calculated overall bandwidth. If you want to widen the band overall, 1.0 Make it bigger.
ATR Period (if used)
- Default : 14
- Description : Deviation Method in ATR, Blend, Max This is the ATR period used when is selected.
Blend Weight (0=StdDev...1=ATR)
- Default : 0.5
- Description : Deviation Method but Blend This is the blending ratio when 0 is 100% standard deviation and 1 is 100% ATR.
Group: TailRisk (Tail Risk Guard)
Use one-sided CVaR guard
- Default : false
- Explanation : This is a switch that enables or disables the tail risk (sudden change) guard function.
Tail window (N)
- Default : 100
- Explanation : The number of past periods (number of candlesticks) to be referenced for risk assessment.
Tail alpha (worst 10%)
- Default : 0.10
- Explanation : This is the sensitivity setting for determining the top percentage of fluctuations that are considered risky. If you set a small value (e.g., 0.01), it will only react to major crashes, which rarely occur.
Tail weight (beta)
- Default : 1.0
- Explanation : This is the strength with which the detected risk width is reflected in the bands.
Up tail base / Up tail alt (max)
- Default : High - Open / High - Close
- Explanation : Defines which part of the candlestick (wick or body) will be used to measure the "upward risk (rise)" for widening the upper band.
- Of the two settings (Base and Alt), the larger value is used.
- High - Open: The increase from the opening price to the high price.
- High - Close: The increase from the closing price to the high price (upper shadow).
- Open - Low: The decline from the opening price to the lowest price.
- Close - Low: The decline from the closing price to the lowest price (lower shadow).
- *The default setting is recommended as it usually measures "rising risk = distance to high price."
Down tail base / Down tail alt (max)
- Default : Open - Low / Close - Low
- Explanation : Defines the "downside risk" for widening the lower band.
- Similarly, the larger of the two settings will be adopted.
- By default, it focuses on monitoring a downward breakout (distance to the low).
Group: Levels (Display line settings)
Visible ±1 sigma ~ 5 sigma
- Default : true
- Explanation : This setting determines whether or not each band line is displayed.
±1 sigma ~ 5 sigma
- Default : 1, 2, 3, 4, 5
- Description : Sets the deviation magnification for each line.
Configuration Example
Below is the Center Method and Deviation Method This is an example of a combination.
1. Classic Bollinger Bands Settings
This setting makes the behavior the same as the commonly used Bollinger Bands.
- Center Method: SMA
- Applied Price: Close
- Deviation Method: BB
- Period: 20
2. Keltner Channel Settings
Keltner Channels are used to measure the strength of a trend using ATR.
- Center Method: EMA
- Applied Price: Typical (or Close)
- Deviation Method: ATR
- Period: 20
- ATR Period: 20
3. Highly reactive scalping setup
This setting enhances price tracking and prevents band expansion due to sudden fluctuations (wicks).
- Center Method: ZLMA (or EMA)
- Deviation Method: MAD (median deviation)
4. Robust Trend Filter Settings
This is a conservative setting that minimizes false positives and aims to break the band only when a major trend occurs.
- Center Method: Median
- Deviation Method: Max (Bollinger and ATR, whichever is wider)
- Use one-sided CVaR guard: true
5. Statistical Strict & Shock Guard Settings (Quantile + TailGuard)
While normal fluctuations are captured using the statistically rigorous Quantile Sigma, the Tail Risk function forcibly widens the band to provide protection only when a Black Swan-level fluctuation (fat tail), which occurs once in 100, occurs.
- Center Method: Median
- Deviation Method: Equivalent Sigma from Quantiles ( Statistical Rigor )
- Use one-sided CVaR guard: true
- Tail alpha: 0.01 to 0.05 Only abnormal situations at the level of (1 in 100) or (1 in 20) are detected. If the threshold is set too high, the benefits will be reduced.
- Tail weight: 2.0 ~ 3.0 If an abnormality is detected, the band will be widened by twice the normal [Tail weight] to avoid easy counter-touching.
