Xagusd Sentinel
- Experts
- Version: 1.20
- Activations: 5
XAGUSD Sentinel
XAGUSD Sentinel is an Expert Advisor for XAGUSD (silver) and EURUSD on the M1 timeframe. It trades breakouts and retests of support and resistance zones built from recent price pivots, and manages risk at both the individual trade level and the basket level (all open trades on the symbol with the EA’s magic number).
Core idea
Swing highs and swing lows that sit close together tend to act as areas where price reacts. The EA scans recent bars for pivots, merges nearby pivots into zones, and sizes the width of each zone with ATR so it adapts to current volatility. A clean move through a zone is treated as a trading opportunity, either on the break itself or after price pulls back into the zone and breaks again.
Entry logic
- Breakout: enter when price clears a zone by a small buffer.
- Retest: after a break, wait for a pullback into the zone within a set number of bars, then enter on the re-break.
- Intrabar entries: signals can trigger during the bar, not only at candle close.
- Entry spacing: a minimum number of bars and a minimum price distance must separate entries in the same direction.
- One trade per bar option to prevent multiple entries on the same candle.
Trade management
Each trade has a stop loss beyond the opposite side of the zone and a take profit set as a multiple of the risk. The stop moves to breakeven once the trade reaches a chosen R multiple, then trails by an ATR multiple. An optional give-back rule closes a trade if it retraces a set share of its maximum favourable excursion after reaching a minimum R.
Basket and account protection
- Basket take profit in account currency.
- Basket profit trail: arms once basket profit reaches a set amount and closes all trades if profit falls back by a set amount.
- Live risk cap: limits the total open risk as a percentage of balance.
- Drawdown limits measured against current balance and against the equity peak.
- Position limits: maximum open positions for the symbol and magic number, plus a per-direction cap.
- Hedging block: prevents opening opposite positions on the same symbol.
The EA does not use martingale, grid, averaging or recovery techniques. Position size is either a percentage of balance or a fixed lot, with a maximum lot cap.
Requirements and recommendations
- Symbols: XAGUSD and EURUSD. Attach the EA separately to each M1 chart.
- Timeframe: M1.
- Account type: hedging or netting (a netting compatibility option is available).
- Leverage: the default settings were developed on 1:500.
- Suggested starting balance: 5,000 USD.
- A low-latency VPS is recommended because the EA trades on M1.
The default settings are tuned for XAGUSD and EURUSD M1. Other symbols and timeframes can be tested, but they will need their own optimization.
Strategy tester notes
- Use “Every tick based on real ticks” with variable spread.
- Set realistic commission and slippage for your broker.
- Forward-test on a demo account before trading live.
Input parameters
General
- Trade comment: label added to each order (default XAGUSD MACHINE).
- Magic number: identifies the EA’s trades (default 43127).
- Signal timeframe: timeframe used for zone detection (default current chart).
- One trade per bar: (default true).
- Debug logging: (default true).
Zone detection
- Lookback bars: number of bars scanned for pivots (default 300).
- Pivot depth: bars on each side required to confirm a pivot (default 2).
- Minimum touches: pivots needed to form a zone (default 1).
- Merge tolerance in points: maximum distance for pivots to be merged into one zone (default 120).
- Use ATR for zone width: (default true).
- ATR period: (default 14).
- ATR zone multiplier: zone half-width as a multiple of ATR (default 0.5).
- Fixed zone half-width in points: used when ATR sizing is off (default 60).
Signals
- Enable breakouts: (default true).
- Enable retests: (default false).
- Retest valid bars: bars allowed for a retest after a break (default 8).
- Break buffer in points: distance beyond the zone needed to confirm a break (default 6).
- Retest tolerance in points: how close price must return to the zone (default 20).
- Intrabar entries: (default true).
Position sizing and exits
- Use money management: risk a percentage of balance instead of a fixed lot (default true).
- Risk % of balance per trade: (default 1.0).
- Maximum lot: (default 0.2).
- Take profit in R: (default 1.8).
- Move to breakeven at R: (default 1.0).
- Trailing ATR multiplier: (default 1.6).
- Close on profit give-back from maximum excursion: (default true).
- Minimum R before give-back applies: (default 1.0).
- Give-back share: (default 0.35).
Position limits and spacing
- Netting compatibility: (default false).
- Maximum positions for this symbol and magic number: (default 3).
- Maximum positions per direction: (default 2).
- Block hedging: (default true).
- Minimum bars after an entry: (default 3).
- Minimum distance from last entry in the same direction, in points: (default 80).
- Live risk cap as % of balance: (default 3.0).
Basket controls
- Use basket take profit: (default true).
- Basket take profit in USD: (default 200).
- Use basket trail: (default true).
- Basket trail starts at USD: (default 120).
- Basket give-back in USD: (default 40).
Drawdown limits
- Maximum drawdown vs current balance %: (default 5.0).
- Maximum drawdown vs equity peak %: (default 35.0).
Order modification
- Per-ticket modification throttle: (default 5).
- Minimum change in points before a modification is sent: (default 3).
Display and alerts
- Draw zones on chart, support and resistance colors, line style.
- Popup, push and email alerts: (default false).
- Diagnostic mode, ignore spread in diagnostic mode, test after bars: for troubleshooting only.
Support
Questions and feedback are welcome in the product comments or through MQL5 private messages.
Risk notice
Trading leveraged products involves significant risk. Backtest and optimization results are historical simulations and do not guarantee future performance. Results depend on your broker, spreads, execution and the settings you choose.
