Nadaraya-Watson Envelope EA: Comprehensive User Guide, Backtest Results, and Optimized Set Files
MT4 Version: Nadaraya Watson Envelope Strategy Multicurrency EA MT4
MT5 Version: Nadaraya Watson Envelope Strategy Multicurrency EA MT5
Complete User Documentation — MT4 & MT5
1. OVERVIEW
The Nadaraya Watson Envelope Strategy Multicurrency EA automates trading across multiple pairs from a single chart using the Nadaraya Watson non-parametric kernel regression method. Instead of just scanning for signals, this EA places and manages trades based on configurable entry/exit strategies, trend filters, and risk controls — including ATR-based trailing stops and grid recovery. It solves the problem of manually monitoring multiple currency pairs for envelope-based reversals or breakouts, letting the EA handle execution and position management.
Who Should Use It: Retail forex traders who want a fully automated, multi-pair system based on the Nadaraya Watson envelope, especially those who prefer to fine-tune entry logic and risk management without coding.
Main Benefit: Deploy a single EA on one chart to trade up to 28 currency pairs simultaneously, with customizable entry/exit strategies and built-in safeguards like breakeven, trailing stop, and max loss limits.
2. INPUT PARAMETERS & SETTINGS
This product shares a common set of general input settings with all Multi-Currency Scanner Dashboard products in this series. The following sections are covered in the common guide: General Settings (pairs list, dashboard colors, panel size), Timeframe Signal Settings (individual TF scan per symbol), Timeframe Confluence Settings (multi-TF confluence scan), and Alert Settings (popup, push notification, email). For full details refer to the Common Multi-Currency Scanner Dashboard Settings Guide. The sections below cover only the product-specific inputs unique to this product.
General Settings
These settings control how the EA displays virtual stop-loss/take-profit lines, manages group-level risk, includes swap costs in profit calculations, and records trade history for backtesting analysis.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Chart lines for virtual SL/TP (never drawn during optimization) | bool | false | When enabled, the EA draws horizontal lines on the chart showing where your hidden stop-loss and take-profit levels sit. Handy for visual confirmation during live trading, but the EA skips drawing them during optimization runs to keep things fast. | true — enable during live trading to see your virtual SL/TP levels on the chart. |
| Group Stoploss Amount | double | 0 | Sets a maximum total loss in account currency for all open trades combined. Once the cumulative loss hits this threshold, the EA closes all positions. Useful for capping drawdown across a basket of pairs. | 50 — close all trades if total loss across the group reaches $50. |
| Include Swap charges in Profit | bool | true | When true, the EA factors overnight swap fees into the profit calculation for breakeven and trailing stop decisions. Set to false if you want to ignore swap costs and only consider pure price movement. | false — useful for short-term scalping where swaps are negligible. |
| Enable history for backtests or optimization | bool | false | When enabled, the EA records trade history and performance metrics during backtests or optimization runs. Leave it off for faster testing, but turn it on when you need detailed results for analysis. | true — enable during optimization to capture trade logs for later review. |
Atr Trailingstop Settings
These settings configure an adaptive trailing stop based on the Average True Range indicator, allowing the stop distance to adjust automatically to market volatility.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Use ATR Trailing Stop | bool | false | Enables a trailing stop that moves with price based on ATR values. Unlike a fixed pip trail, this adapts to changing volatility — wider stops in volatile markets, tighter in calm ones. Disable to use the standard breakeven or fixed trailing stop. | true — enable for volatile pairs like GBP/JPY where fixed stops get hit too often. |
| ATR Timeframe | ENUM | PERIOD_CURRENT | Selects the timeframe used to calculate the ATR value for the trailing stop. Using a higher timeframe like H4 gives a smoother, more stable ATR, while M15 reacts faster to short-term volatility changes. | PERIOD_H1 — use hourly ATR for a balance between responsiveness and stability. |
| ATR Period | int | 14 | The number of bars used to calculate the ATR value. A shorter period like 7 makes the trailing stop more sensitive to recent volatility spikes, while 21 smooths out noise. Default 14 works for most swing trading styles. | 10 — tighten the ATR calculation for faster reaction to volatility changes. |
| Activation (ATR multiplier) | double | 2.0 | The profit threshold (in ATR units) that must be reached before the trailing stop kicks in. A value of 2.0 means the trade needs 2x the current ATR in profit before trailing begins. Prevents premature trailing on small moves. | 3.0 — require more profit before activating the trail, useful for trend-following strategies. |
| Trail distance (ATR multiplier) | double | 1.0 | Sets how far the trailing stop sits behind the current price, measured in ATR units. A value of 1.0 places the stop 1 ATR away from price. Tighter values risk early exit, wider values give more breathing room. | 1.5 — give the trade more room to breathe in choppy markets. |
| Trail increment (ATR multiplier) | double | 0.5 | Controls how much the stop moves each time price advances in your favor, measured in ATR units. A value of 0.5 means the stop moves up by 0.5 ATR for every 1 ATR of favorable price movement. Higher values lock in profit faster. | 1.0 — lock in profit more aggressively as price moves in your favor. |
Grid Settings
These settings manage a grid recovery feature that aims to bring the entire basket of trades back to breakeven or profit after a series of losing positions.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Recover profit from all grid trades | bool | false | When enabled, the EA calculates the total profit or loss from all open trades in the grid and attempts to close the entire basket when the net profit reaches a target. Useful for recovering from multiple losing entries in a grid strategy. | true — enable for grid-based recovery where you want the whole basket to close at breakeven or profit. |
Safeguard Settings
These settings provide protective limits to prevent excessive losses and ensure the EA only trades under favorable conditions, with some options specifically for backtesting validation.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Max Loss from initial balance [0: disable] | double | 0.0 | Sets a maximum drawdown limit as a percentage of the initial account balance. If the account drops below this threshold, the EA stops opening new trades. Set to 0 to disable this safety net entirely. | 15 — stop trading if the account loses 15% from the starting balance. |
| Minimum Profit Percent [backtesting only] [0: disable] | double | 0 | During backtesting, this setting filters out runs where the total profit doesn't reach the specified percentage. Helps you quickly discard underperforming parameter sets in optimization. Disabled by default. | 5 — ignore any backtest result with less than 5% total profit. |
| Minimum Trades [backtesting only] [0: disable] | double | 0 | In backtesting, this setting rejects any optimization result that didn't execute at least this many trades. Useful for avoiding overfitted results with very few trades that look good by luck. | 20 — only consider results with 20 or more trades for statistical significance. |
| Max inactive days [backtesting only] [0: disable] | int | 0 | During backtesting, this setting flags periods where the EA didn't open any trades for more than the specified number of consecutive days. Helps identify parameter sets that go dormant for too long. | 30 — flag any period where the EA is inactive for more than 30 consecutive days. |
Nadaraya Settings
These settings define the core parameters of the Nadaraya Watson envelope calculation, including lookback period, bandwidth, multiplier, smoothing, and the entry/exit strategy logic.
| Setting Name | Type | Default Value | Description | Example | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Bars Count | int | 100 | The number of historical bars used to calculate the Nadaraya Watson envelope. A higher count smooths the envelope but makes it less responsive to recent price changes. Lower values react faster but may produce more false signals. | 3. HOW IT WORKS Core Calculation & LogicThe EA runs a continuous scan across every symbol you list in the Symbols input, calculating the Nadaraya Watson Envelope on each one independently. At its heart, the indicator uses a kernel regression — a non-parametric smoothing technique — to estimate a weighted average of recent prices, with the Bandwidth controlling how many bars influence each point. The envelope is then drawn at a distance determined by the Multiplier times a local volatility estimate. What you end up with is a dynamic support/resistance channel that adapts to market noise better than a simple moving average. The EA checks every tick (or every new bar, depending on your timeframe) whether price has touched or crossed these bands. When it detects a qualifying event — a bounce off the lower band in reversal mode, or a break above it in momentum mode — it fires a signal for that symbol. It then applies your risk rules (lot size, stop-loss, take-profit) and opens a market order. Because the scan is multi-symbol, a single chart can monitor the entire forex watchlist without you juggling multiple windows. Entry Strategies ExplainedENTRY_STRATEGY1 — Reversal BounceBUY Signal: Price touches or crosses below the lower envelope line, then closes back above it. The EA interprets this as a rejection of lower prices and a potential reversal upward. SELL Signal: Price touches or crosses above the upper envelope line, then closes back below it. This flags a rejection at resistance and a likely move lower. Best For: Range-bound or mean-reverting markets where price oscillates between well-defined bands. Works well on H1–H4 when volatility is moderate. ENTRY_STRATEGY2 — Momentum BreakoutBUY Signal: Price closes above the upper envelope line. The EA treats this as a breakout of the channel, expecting the trend to continue upward. SELL Signal: Price closes below the lower envelope line. This signals a breakdown and a bearish continuation. Best For: Trending markets with strong directional moves. Avoid using it during low-volatility sessions or when major news is pending — false breakouts are common then. Step-by-Step WorkflowStep 1: Attach the EA to a single chart. Any timeframe works — the EA scans all symbols you specify, not just the chart symbol. Use a 1H or 4H chart for a good balance of speed and signal quality. Step 2: Configure your symbol list. In the Symbols input, enter comma-separated pairs like EURUSD,GBPUSD,USDCHF,USDJPY,AUDUSD . The EA will scan each one in sequence. Step 3: Set your entry strategy. Choose ENTRY_STRATEGY1 if you expect reversals, or ENTRY_STRATEGY2 if you expect breakouts. Start with Strategy 1 on a demo account to see how the envelope behaves on your pairs. Step 4: Define risk parameters. Set Lot Size to 0.01 for testing. Choose a stop-loss and take-profit mode — Pips is the simplest for beginners. Enter STOPLOSS = 30 and TAKEPROFIT = 60 for a 1:2 risk-reward ratio. Step 5: Enable or disable repainting. If you want signals that won't disappear on historical bars, set Repainting Smoothing = false. For live trading where you only care about the current bar, leaving it true gives a smoother envelope. Step 6: Run on a demo account first. Let it trade for at least 50–100 closed trades before going live. Pay attention to how often each strategy triggers — if you see too many signals in quiet markets, increase the Bandwidth or Multiplier. 4. RISK MANAGEMENT FEATURESThe EA includes several built-in risk controls that let you protect your account without needing external scripts or manual oversight.
5. IMPORTANT NOTES & WARNINGSKnown Limitations
Settings Beginners Should NOT Change
Dashboard Usage Tips
Quick Start GuideFollow these steps to get started in under 5 minutes:
Installation Guide for MQL Products | Updating Purchased MQL Products on MT4/MT5 | General Troubleshooting Guide | Backtest and Set Files Check all my products: https://www.mql5.com/en/users/biswait50/seller Contact me for support: https://www.mql5.com/en/users/biswait50 |


