NLMS Adaptive Volatility Trail Multi Filter Signal
- 지표
- 버전: 1.28
- 활성화: 5
NLMS Volatility Trail MultiFilter MT5 - Operational Manual & Technical Specification
1. Overview and Core Purpose
NLMS Volatility Trail MultiFilter MT5 is an algorithmic market analysis indicator designed for MetaTrader 5, providing adaptive trend identification, dynamic trailing envelopes, and multi-layered signal filtering. The system is built upon digital signal processing theory, dynamic volatility channels, and a modular matrix of secondary filters. At its computational core operates the Normalized Least Mean Squares (NLMS) adaptive filter, an established transversal finite impulse response (FIR) filtering methodology widely applied in acoustic noise cancellation, radar echo processing, and econometric time-series estimation.
Standard linear moving averages (SMA, EMA, LWMA) operate with static mathematical weights across a fixed lookback window. In contrast, the NLMS adaptive filter continuously optimizes its internal tap coefficients at every closed price candle. It calculates the instantaneous error between its estimated price trajectory and the realized market price, using this gradient to adjust filter weights dynamically. This delivers rapid responsiveness to emerging momentum while attenuating noise during consolidation.
Complementing the adaptive estimation core is an Average True Range (ATR) dynamic trailing volatility envelope. Rather than utilizing static point distances that fail during volatility shifts, the trailing envelope automatically expands and contracts based on prevailing market dispersion. The indicator incorporates sixteen modular secondary technical filters that can be activated independently or in combination: Ichimoku Senkou Span B equilibrium baseline (shifted 26 periods), dynamic RSI boundary crossovers, extended-period RSI trend orientation, ADX trend strength thresholding, single moving average baselines, dual moving average trend filters, Awesome Oscillator (AO) volume/color/zero verification, Parabolic SAR directionality, synthetic Heiken Ashi candle body confirmation, CCI trend and overbought/oversold boundaries, RVI trend and signal crossovers, MACD histogram and zero-level filters, dynamic Support and Resistance reaction zones, and Fibonacci retracement levels derived from a three-parameter ZigZag algorithm.
The indicator outputs five dedicated data buffers designed for visual chart inspection and direct automated integration within Expert Advisors via standard iCustom declarations.
2. Mathematical Principles and Algorithmic Operations
The computational pipeline executes across four discrete algorithmic stages on every incoming price quote:
Stage 1: Normalized Least Mean Squares Adaptive Estimation. The transversal FIR filter models price discovery through an adaptive tap architecture. For an input vector of recent prices x(n) across N taps (InpTaps), estimated price output y(n) is computed via vector dot product: y(n) = sum_{j=0}^{N-1} w_j(n) * x(n - 1 - j), where w_j(n) represents the tap weight coefficient. Prediction error e(n) is computed against the actual source price d(n) (InpSource): e(n) = d(n) - y(n). To maintain numerical stability across diverse price ranges, weight corrections are normalized by instantaneous signal energy: w_j(n+1) = w_j(n) + [mu / (epsilon + ||x(n)||^2)] * e(n) * x(n - 1 - j), where mu (InpMu) is learning rate, epsilon (InpEps) is the regularization constant, and ||x(n)||^2 is the sum of squared price inputs. To ensure determinism and eliminate repainting, weight updates occur exclusively on the close of historical bars (i < rates_total - 1). The active unclosed bar utilizes established weights to plot real-time trajectories without altering internal filter states.
Stage 2: Dynamic ATR Trailing Volatility Channel. Average True Range (ATR) is computed across a selectable lookback period (InpAtrPeriod): TR = max(High[i] - Low[i], |High[i] - Close[i-1]|, |Low[i] - Close[i-1]|), ATR = (1 / InpAtrPeriod) * sum_{k=0}^{InpAtrPeriod-1} TR[i-k]. Symmetrical volatility bands are projected around the adaptive curve: Upper Band = nlms + (ATR * InpAtrFactor), Lower Band = nlms - (ATR * InpAtrFactor). Trailing line (TrailBuffer) is evaluated recursively: If Lower Band > prev_trail, Trail = Lower Band; Else if Upper Band < prev_trail, Trail = Upper Band; Else Trail = prev_trail. This ratcheting mechanism ensures protective stops trail during trends and reverse only when price action breaches the volatility envelope.
Stage 3: Trend Direction State and Visual Color Indexing. Directional state changes are detected across three consecutive trailing values (trail, prev_t, prev2_t): Bullish Inflection occurs when trail > prev_t and prev_t <= prev2_t (TrendDirBuffer = +1, ColorBuffer = 1 / Lime). Bearish Inflection occurs when trail < prev_t and prev_t >= prev2_t (TrendDirBuffer = -1, ColorBuffer = 2 / Red). In the absence of an inflection flip, existing trend state is preserved (ColorBuffer = 0 / Gray during initialization).
Stage 4: Modular Multi-Filter Verification and Signal Generation. When a trend inflection occurs on a closed bar, the potential signal is evaluated against all active secondary filter modules. A directional arrow signal is plotted and alerts dispatched if and only if every enabled filter evaluates to true.
3. Signal Execution Protocol and Non-Repainting Architecture
Signal repainting is an unacceptable failure mode in trading software. NLMS Volatility Trail MultiFilter MT5 implements strict programmatic safeguards:
- Closed Bar Signal Commitment: Signal generation routines controlling BuyBuffer and SellBuffer are restricted strictly to confirmed closed bars (bar index i < rates_total - 1). The active candle (bar index rates_total - 1) is completely bypassed during arrow placement. Once a bar closes and an arrow is plotted, that arrow remains permanently fixed on the chart buffer. It will not disappear, alter coordinates, or recalculate on subsequent ticks, chart refreshes, or terminal restarts.
- Real-Time Trail Dynamics: The NLMS trailing line and color buffer update on the open candle (bar 0) to provide real-time situational awareness regarding distance to trailing thresholds. However, this real-time calculation does not commit signal arrows or trigger notifications until candle closure is finalized.
- Alert De-duplication: The internal alert handler tracks the timestamp of the last confirmed alert (last_alert_time) and restricts audio alerts, pop-up dialogs, and push notifications strictly to completed bar events (i == rates_total - 2). This guarantees that traders receive exactly one notification per confirmed signal event, preventing false double-triggers caused by intrabar market noise.
4. Technical Logic of All Filter Modules
Traders can run the NLMS Volatility Trail as an independent directional engine or combine it with any combination of sixteen integrated technical filters:
- Ichimoku Senkou Span B Filter: Evaluates equilibrium over period Ichimoku_SenkouB (default 52), projected backwards by Ichimoku_Kijun (default 26 bars). BUY requires close price strictly above the shifted Senkou Span B level. SELL requires close price strictly below the shifted Senkou Span B level.
- RSI Crossover Filter: Measures momentum using Relative Strength Index over period RSI_Length (default 14). BUY requires RSI on the closed bar to cross above Oversold (default 30.0) from below. SELL requires RSI on the closed bar to cross below Overbought (default 70.0) from above.
- ADX Trend Strength Filter: Evaluates trend strength via Average Directional Index over period ADX_Period (default 10). BUY and SELL signals both require ADX >= ADX_Min_Level (default 20.0). Below 20.0, the market is classified as non-trending and signals are suppressed.
- Single MA Filter: Applies a structural Moving Average (MA_Period default 50, MA_Method default SMA, MA_Shift default 0). BUY requires Close[i] > MA[i]; SELL requires Close[i] < MA[i], ensuring trades align with the dominant moving baseline.
- RSI 75 Trend Filter: Uses an extended 75-period RSI (RSI_Filter_Period default 75). BUY requires RSI 75 > 50.0; SELL requires RSI 75 < 50.0, separating overarching bullish regimes from bearish phases.
- Double MA Filter: Evaluates Fast MA A (MA_A_Period default 30, EMA) and Slow MA B (MA_B_Period default 140, EMA). BUY requires MA A > MA B; SELL requires MA A < MA B.
- Awesome Oscillator (AO) Filters: Computes difference between 5-period and 34-period SMAs of median prices. Features three optional modes: (a) Volume Filter: BUY requires AO >= AO_Buy_Min (default 4.0), SELL requires AO <= AO_Sell_Max (default -4.0); (b) Color Filter: BUY requires AO[i] > AO[i-1], SELL requires AO[i] < AO[i-1]; (c) Zero Filter: BUY requires AO > 0 and ascending, SELL requires AO < 0 and descending.
- Parabolic SAR Filter: Employs Parabolic SAR with step SAR_Step (default 0.02) and cap SAR_Maximum (default 0.2). BUY requires Close[i] > SAR[i]; SELL requires Close[i] < SAR[i].
- Heiken Ashi Filter: Computes synthetic Heiken Ashi candle bodies: HA_Close = (Open + High + Low + Close) / 4; HA_Open = (HA_Open[prev] + HA_Close[prev]) / 2. BUY requires HA_Close > HA_Open (green candle); SELL requires HA_Close < HA_Open (red candle).
- CCI Trend Filter: Uses Commodity Channel Index over CCI_Period (default 50). BUY requires CCI > 0.0; SELL requires CCI < 0.0.
- CCI OB & OS Filter: Uses short-period CCI over CCI_OBOS_Period (default 14). BUY requires CCI > CCI_Overbought (default 100.0); SELL requires CCI < CCI_Oversold (default -100.0).
- RVI Trend Filter: Evaluates Relative Vigor Index over RVI_Period (default 75). BUY requires RVI > 0.0; SELL requires RVI < 0.0.
- RVI Signal Filter: Compares RVI main line to its symmetric weighted signal line over RVI_Signal_Period (default 20). BUY requires RVI Main > RVI Signal; SELL requires RVI Main < RVI Signal.
- MACD Histogram & Zero Filters: Configured via Fast EMA 12, Slow EMA 26, Signal SMA 9. Under MACD Histogram mode, BUY requires histogram delta > 0, SELL requires delta < 0. Under MACD Zero mode, BUY requires MACD Main > 0.0, SELL requires MACD Main < 0.0.
- Support & Resistance Filter: Scans lookback window SR_Period (default 50 bars) for swing extremes with a corridor of SR_Zone_Points (default 80 points). BUY requires low price to touch or pierce support; SELL requires high price to touch or pierce resistance.
- Fibonacci Filter: Identifies recent swings using ZigZag logic (Depth 12, Deviation 5, Backstep 3). Calculates retracement boundaries Fib_Level_1 (0.382) and Fib_Level_2 (0.618). BUY and SELL require current bar range to intersect this Fibonacci retracement pocket.
5. Key Technical Features
- Adaptive Digital Filtering: Transversal FIR algorithm continuously minimizes tracking error, delivering responsive trend following during expansions while filtering chop during market consolidations.
- Dynamic ATR Volatility Trailing Channel: Trailing boundaries adjust automatically based on real-time market dispersion, avoiding rigid point distances that fail during regime shifts.
- Sixteen Modular Filter Blocks: Each secondary filter can be toggled independently or combined simultaneously to construct tailored trade validation criteria across diverse financial instruments.
- Non-Repainting Execution: Calculations and arrow plotting are bound strictly to completed closed bars (bar index 1), ensuring that chart historical audits match live execution.
- Multi-Channel Alerts: Instantaneous notifications via native desktop pop-up alerts, customizable audio playback (.wav), and push notifications to mobile MetaTrader terminals via MetaQuotes ID.
- Seamless EA Integration: Five standardized buffers enable direct reading by Expert Advisors using standard iCustom function calls.
- Resource Efficient: Intelligent pointer handling, explicit release of technical handles on deinitialization (OnDeinit), and loop constraints ensure smooth multi-chart operation.
6. Operational Setup & Timeframe Recommendations
- Supported Asset Classes: Major currency pairs (EURUSD, GBPUSD, USDJPY, AUDUSD, USDCAD), cross currency pairs (EURJPY, GBPJPY, EURGBP), precious metals (XAUUSD, XAGUSD), index CFDs (US30, US500, USTEC, GER40), and liquid energy commodities (USOIL, UKOIL).
- Recommended Timeframes:
* Scalping: M1, M5 (recommended setup: fast ATR settings, ADX filter, and RSI Cross).
* Day Trading / Intraday Swing: M15, M30, H1 (recommended setup: default NLMS settings with Ichimoku Senkou Span B, Single MA 50, or Double MA 30/140).
* Macro Trend Trading: H4, D1 (recommended setup: NLMS with RSI 75, MACD Zero-Line, and Fibonacci Retracement).
- Broker Environment: Fully compatible with both Hedging and Netting accounts on MetaTrader 5. Raw Spread or ECN account tiers are recommended for short-term strategies to minimize transaction friction. While low-latency execution or VPS hosting is advantageous for high-frequency scalping, the indicator operates reliably across standard retail desktop setups.
7. Complete Input Parameters Documentation
NLMS Settings:
- InpTaps (Default: 2) -> Number of filter tap weights in transversal FIR memory (minimum value 2).
- InpMu (Default: 0.1) -> Adaptation step-size / learning rate parameter controlling weight adjustment velocity.
- InpEps (Default: 0.5) -> Regularization damping factor preventing numerical instability during low market volatility.
- InpAtrPeriod (Default: 7) -> Lookback period in bars used to compute Average True Range (ATR) volatility.
- InpAtrFactor (Default: 0.5) -> Multiplier applied to ATR to determine trailing band offset width.
- InpSource (Default: PRICE_CLOSE) -> Applied price series (PRICE_CLOSE, PRICE_OPEN, PRICE_HIGH, PRICE_LOW, etc.).
Signal Settings:
- InpShowBuySell (Default: true) -> Toggles display of directional BUY and SELL visual arrows on chart.
- InpArrowOffset (Default: 30) -> Vertical offset spacing in points between candlestick extremes and arrow plots.
- InpAlertOnSignal (Default: false) -> Enables native MetaTrader pop-up dialog boxes upon signal confirmation.
- InpPushNotify (Default: false) -> Enables push notifications dispatched to mobile MetaTrader 5 via MetaQuotes ID.
- InpPlaySound (Default: false) -> Toggles acoustic audio alerts upon signal confirmation.
- InpBuySound (Default: "alert.wav") -> Audio wave file played on bullish BUY confirmation.
- InpSellSound (Default: "alert2.wav") -> Audio wave file played on bearish SELL confirmation.
Filter Mode - Ichimoku Senkou Span B Filter:
- Use_Ichimoku_Filter (Default: false) -> Enables or disables Ichimoku Senkou Span B trend filter.
- Ichimoku_SenkouB (Default: 52) -> Lookback period in bars for Senkou Span B baseline ((52 High + 52 Low) / 2).
- Ichimoku_Kijun (Default: 26) -> Horizontal shift offset applied to Senkou Span B relative to current bar.
Filter Mode - RSI Cross Filter:
- Use_RSI_Cross_Filter (Default: false) -> Activates dynamic RSI oversold/overbought boundary breakout verification.
- RSI_Length (Default: 14) -> Calculation period in bars for Relative Strength Index.
- RSI_Price_Source (Default: PRICE_CLOSE) -> Price series utilized in RSI calculation.
- Oversold (Default: 30.0) -> Oversold threshold boundary; crossing upward validates BUY.
- Overbought (Default: 70.0) -> Overbought threshold boundary; crossing downward validates SELL.
Filter Mode - ADX Filter:
- Use_ADX_Filter (Default: false) -> Activates Average Directional Index trend strength filter.
- ADX_Period (Default: 10) -> Calculation period in bars for directional movement system.
- ADX_Min_Level (Default: 20.0) -> Minimum required ADX threshold. Signals below this level are suppressed.
Filter Mode - Single MA Filter:
- Use_MA_Filter (Default: false) -> Activates single moving average structural filter.
- MA_Period (Default: 50) -> Averaging period in bars for the moving average.
- MA_Method (Default: MODE_SMA) -> Mathematical smoothing method (MODE_SMA, MODE_EMA, MODE_SMMA, MODE_LWMA).
- MA_Shift (Default: 0) -> Horizontal displacement shift in bars.
Filter Mode - RSI 75 Filter:
- Use_RSI75_Filter (Default: false) -> Activates macro-trend filtering via extended-period RSI.
- RSI_Filter_Period (Default: 75) -> Lookback period in bars for macro RSI baseline (BUY above 50, SELL below 50).
Filter Mode - Double MA Filter:
- Use_DoubleMA_Filter (Default: false) -> Activates dual moving average directional orientation.
- MA_A_Period (Default: 30) -> Averaging period in bars for Fast MA A.
- MA_A_Method (Default: MODE_EMA) -> Smoothing algorithm for Fast MA A.
- MA_A_Applied (Default: PRICE_CLOSE) -> Price source for Fast MA A.
- MA_A_Shift (Default: 0) -> Shift offset in bars for Fast MA A.
- MA_B_Period (Default: 140) -> Averaging period in bars for Slow MA B.
- MA_B_Method (Default: MODE_EMA) -> Smoothing algorithm for Slow MA B.
- MA_B_Applied (Default: PRICE_CLOSE) -> Price source for Slow MA B.
- MA_B_Shift (Default: 0) -> Shift offset in bars for Slow MA B.
Filter Mode - Awesome Oscillator Filter:
- Use_AO_Filter (Default: false) -> Master toggle for Awesome Oscillator filtering.
- Use_AO_Volume_Filter (Default: false) -> Enforces minimum amplitude thresholds on AO histogram bars.
- AO_Buy_Min (Default: 4.0) -> Minimum positive AO value required to authorize BUY.
- AO_Sell_Max (Default: -4.0) -> Maximum negative AO value required to authorize SELL.
- Use_AO_Color_Filter (Default: false) -> Requires ascending AO bar for BUY, descending AO bar for SELL.
- Use_AO_Zero_Filter (Default: false) -> Enforces AO position above 0.0 for BUY, below 0.0 for SELL.
Filter Mode - Parabolic SAR Filter:
- Use_SAR_Filter (Default: false) -> Enables Parabolic SAR directional confirmation.
- SAR_Step (Default: 0.02) -> Price acceleration step factor.
- SAR_Maximum (Default: 0.2) -> Upper saturation limit for acceleration factor.
Filter Mode - Heiken Ashi Filter:
- Use_HeikenAshi_Filter (Default: false) -> Activates synthetic Heiken Ashi candle body color validation (green for BUY, red for SELL).
Filter Mode - CCI Trend Filter:
- Use_CCI_Filter (Default: false) -> Enables macro CCI zero-line filter (BUY above 0, SELL below 0).
- CCI_Period (Default: 50) -> Averaging period in bars for trend CCI.
- CCI_Applied (Default: PRICE_CLOSE) -> Price data applied to CCI formula.
Filter Mode - CCI OB & OS Filter:
- Use_CCI_OBOS_Filter (Default: false) -> Enables short-cycle CCI overbought/oversold breakout confirmation.
- CCI_OBOS_Period (Default: 14) -> Calculation period in bars for momentum CCI.
- CCI_OBOS_Applied (Default: PRICE_CLOSE) -> Applied price source for momentum CCI.
- CCI_Overbought (Default: 100.0) -> Overbought threshold level required for BUY authorization.
- CCI_Oversold (Default: -100.0) -> Oversold threshold level required for SELL authorization.
Filter Mode - RVI Trend Filter:
- Use_RVI_Filter (Default: false) -> Activates Relative Vigor Index zero-line directional confirmation.
- RVI_Period (Default: 75) -> Calculation period in bars for trend RVI.
Filter Mode - RVI Signal Filter:
- Use_RVI_Signal_Filter (Default: false) -> Activates RVI main line and signal line crossover filter.
- RVI_Signal_Period (Default: 20) -> Calculation period in bars for fast RVI signal oscillator.
Filter Mode - MACD Signal & Zero Filters:
- Use_MACD_Filter (Default: false) -> Enables MACD histogram momentum confirmation (delta > 0 for BUY, delta < 0 for SELL).
- MACD_FastEMA (Default: 12) -> Period of fast exponential moving average.
- MACD_SlowEMA (Default: 26) -> Period of slow exponential moving average.
- MACD_SignalSMA (Default: 9) -> Period of signal line simple moving average.
- MACD_Applied (Default: PRICE_CLOSE) -> Price data applied to MACD calculation.
- Use_MACD_Zero_Filter (Default: false) -> Enforces MACD main line location relative to zero (above 0 for BUY, below 0 for SELL).
Filter Mode - Support & Resistance Filter:
- Use_SR_Filter (Default: false) -> Activates structural price boundary interaction validation.
- SR_Period (Default: 50) -> Lookback window in bars across which highest high and lowest low extremes are calculated.
- SR_Zone_Points (Default: 80) -> Buffer width tolerance in chart points defining the sensitivity zone around boundaries.
Filter Mode - Fibonacci Filter:
- Use_Fib_Filter (Default: false) -> Activates dynamic Fibonacci retracement zone filter.
- Fib_Level_1 (Default: 0.382) -> Shallow retracement boundary ratio.
- Fib_Level_2 (Default: 0.618) -> Deep retracement golden ratio boundary.
- ZigZag_Depth (Default: 12) -> Minimum number of bars without a conflicting extreme for ZigZag swing identification.
- ZigZag_Deviation (Default: 5) -> Minimum price change in points required to establish a new swing vertex.
- ZigZag_Backstep (Default: 3) -> Minimum number of bars required between consecutive swing pivots.
8. Technical Buffer Architecture & EA Integration
For quantitative algorithmic developers, the indicator outputs five data buffers:
- Buffer 0 (INDICATOR_DATA, TrailBuffer): Stores the price value of the NLMS trailing line.
- Buffer 1 (INDICATOR_COLOR_INDEX, ColorBuffer): Stores the visual color state (0 = Neutral/Gray, 1 = Bullish/Lime, 2 = Bearish/Red).
- Buffer 2 (INDICATOR_DATA, BuyBuffer): Stores the price coordinate of confirmed BUY arrow signals. Returns EMPTY_VALUE (DBL_MAX) when no signal exists.
- Buffer 3 (INDICATOR_DATA, SellBuffer): Stores the price coordinate of confirmed SELL arrow signals. Returns EMPTY_VALUE (DBL_MAX) when no signal exists.
- Buffer 4 (INDICATOR_CALCULATIONS, TrendDirBuffer): Stores internal trend direction (+1 = Bullish, -1 = Bearish, 0 = Undefined).
To integrate within an Expert Advisor, initialize the handle via iCustom and copy buffer data at bar index 1:
int handle = iCustom(_Symbol, _Period, "NLMS_Volatility_Trail_MultiFilter", ...);
double buy[1], sell[1], trend[1];
CopyBuffer(handle, 2, 1, 1, buy);
CopyBuffer(handle, 3, 1, 1, sell);
CopyBuffer(handle, 4, 1, 1, trend);
bool is_buy = (buy[0] != EMPTY_VALUE);
bool is_sell = (sell[0] != EMPTY_VALUE);
9. Frequently Asked Questions (FAQ)
Q1: Does this indicator recalculate or repaint past signals?
A1: No. Signal calculation is executed strictly on completed closed bars (bar index 1). Once a bar closes and prints an arrow, its position is permanent. The active open candle (bar 0) updates the live trailing line dynamically, but does not commit signal arrows until candle closure.
Q2: Can I run this indicator on multiple charts simultaneously?
A2: Yes. The code utilizes native indicator handles and releases memory on deinitialization. To preserve terminal efficiency on lower-specification systems, activate only the filter modules necessary for your specific setup.
Q3: How do I configure mobile push notifications?
A3: Set InpPushNotify to true in the indicator settings, and ensure your MetaQuotes ID is configured in MetaTrader 5 under Tools -> Options -> Notifications.
10. Risk Disclaimer
Trading foreign exchange, commodities, indices, and other leveraged financial instruments involves substantial risk of capital loss and may not be suitable for all investors. Past performance, backtest results, or hypothetical simulations do not predict future trading results. This software is an analytical and operational technical indicator developed exclusively to assist traders in objective market analysis; it does not provide financial advice, profit guarantees, or automated execution. Always test the indicator on a demo simulation account to evaluate its operational behavior before deploying it in live trading environments.
