Unlocked AI MT5 Gold Scalping Intraday Swing EA
- Uzmanlar
- Rabi Oudani
- Sürüm: 1.0
- Etkinleştirmeler: 20
Unlocked AI is a MetaTrader 5 Expert Advisor designed for XAUUSD (Gold). It runs two independent trading engines on the same chart simultaneously.
The first engine connects to the DeepSeek AI cloud service and sends a full multi-timeframe market snapshot on a timed cycle. It returns a structured trade decision that the EA reads and executes when the confidence threshold is met.
The second engine is a self-contained H1 breakout strategy that runs entirely inside the terminal with no external connections. It uses candle quality, volume, RSI, and ADX filters to qualify each entry.
Both engines can be enabled or disabled independently through the input parameters.
Trading Modes
The EA detects the chart timeframe automatically and switches between three modes. Each mode applies its own TP, SL, trailing stop values, and AI scan cadence.
- Scalping — M1, M5, M15 : AI scans every 15 minutes. Market orders only. Pending orders are not placed on these timeframes.
- Intraday — M30, H1 : AI scans every 30 minutes. Market orders and limit or stop pending orders are allowed.
- Swing — H4, D1, W1 : AI scans every 60 minutes. Limit and stop pending orders are preferred.
Changing the chart timeframe switches the active mode immediately with no manual reconfiguration needed.
AI Engine
On each scan cycle the EA sends the following data to the DeepSeek API:
- Current symbol, spread, ATR, and price levels
- RSI, MACD, ADX, Stochastic, and Bollinger Bands on all timeframes from M1 through W1
- All open AI positions, pending orders, and unrealized P/L
- Active mode rules including TP and SL boundaries
- Number of available trade slots
The AI returns a structured response with an action, signal direction, entry price, stop-loss, take-profit, confidence value, and a plain-text reason.
The EA acts on the response only when confidence is 85 or above and all local filters pass. When confidence is below the threshold or action is WAIT, the decision is recorded in the dashboard panel and no order is placed.
- Deepseek-v4-flash — Response time approximately 20 to 40 seconds. Recommended for scalping and intraday modes.
- Deepseek-v4-pro — Response time approximately 90 to 130 seconds. Longer reasoning chain. Suitable for swing mode.
Trade Management
- Every position opened by the AI engine carries a management plan with two optional components.
- Break-Even — When the trade reaches the configured profit distance in points, the stop-loss is moved to the entry price, removing the initial risk from the position.
- Trailing Stop — When the trade reaches the trailing start distance, a trailing stop activates and follows the price at the configured step size.
- Both values can come from the AI response or from fixed manual values set in the input parameters.
Lot Size Calculation
Four lot sizing modes are available:
- Fixed lot: a constant value defined by the user
- Auto per capital: lot size scales with account balance or equity
- Risk percent: lot size is calculated so that a stop-loss hit costs the configured percentage of the account
- Custom base: lot size scales relative to a user-defined capital figure
News Filter
The EA reads the MetaTrader 5 built-in economic calendar. New entries are suppressed when a news event matching the configured currencies and impact level falls within the blocking window around the event time.
- Currency list is configurable (for example: USD, XAU, EUR)
- Impact level: high only, or high and medium
- Minutes to block before and after the event are configurable
- Can be applied to the AI engine only, local engine only, or both
- Existing open positions are not closed by the news filter.
Session Filter
Trading is restricted near the start and end of the trading week.
- Monday: a configurable delay after market open
- Friday: a configurable early stop before market close
- Pending orders can be cancelled automatically before Friday close
Dashboard Panel
A panel is displayed in the top-left corner of the chart showing:
- AI engine status: ONLINE, ANALYZING, ERROR, DISABLED, or BACKTEST
- Current trading mode and AI scan cadence
- Last AI signal direction and confidence value
- Number of active AI positions and pending orders
- Number of active local EA positions
- Next upcoming news event with time and currency
- Last decision reason from the AI
- A Scan button in the panel triggers an immediate AI analysis cycle outside the regular cadence timer.
Chart Trade Visuals
For each open position the EA draws horizontal lines on the chart at the entry price, take-profit level, and stop-loss level. Each line is labeled with the dollar value of that level. Lines update in real time as trailing stops move.
Input Parameter Groups
- Trade Engine Control — Enable or disable each engine. Set spread limit, position limits, and cooldown between AI trades.
- Lot Size and Risk — Lot sizing mode, risk percentage, and capital base selection.
- Scalping TP / SL / TSL (M1–M15) — Take-profit, stop-loss, trailing start, and trailing step for scalping mode.
- Intraday TP / SL / TSL (M30–H1) — Take-profit, stop-loss, trailing start, and trailing step for intraday mode.
- Swing TP / SL / TSL (H4–D1–W1) — Take-profit, stop-loss, trailing start, and trailing step for swing mode.
- AI Management — Break-even trigger, trailing stop source, and SL/TP enforcement settings.
- AI Execution — DeepSeek API key, model selection, magic number, order type permissions, slot limits, and pending order expiry.
- Local EA Strategy — Timeframe, stop-loss, take-profit, trailing stop, candle body filter, volume filter, momentum filter, and OCO mode.
- News Filter — Currency list, impact level, pre-event and post-event blocking window, and which engine to block.
- Session Filters — Monday delay, Friday early close, and automatic pending order cancellation.
Requirements
- MetaTrader 5 build 3000 or later
- XAUUSD available on the broker account
- Algo Trading enabled in the MT5 toolbar
- WebRequest enabled in MT5 options for: https://api.deepseek.com
- A DeepSeek API account with available balance
- Active internet connection for the AI engine
- No DLL calls are used
Notes
- The AI engine is disabled automatically when running in the MetaTrader 5 Strategy Tester. Backtesting runs the local H1 breakout strategy only.
- The EA sends market data to an external server on each AI scan cycle. The API key is stored in the EA input parameters.
- Past behavior in testing does not indicate future results. The Market service administration does not guarantee the profitability of Expert Advisors.
A detailed user guide is available in my MQL5 Blog: https://www.mql5.com/en/blogs/post/769489
