Lock30x XAUUSD
- Experts
-
Jarrod Emery
I’m the founder of ExpertCodeFX and an MQL5 Expert Advisor developer focused on practical, testable automation for MetaTrader 5. - Versione: 2.914
- Aggiornato: 12 novembre 2026
- Attivazioni: 10
Lock30x XAUUSD - Four-engine gold Expert Advisor for MetaTrader 5
Lock30x XAUUSD is an automated MetaTrader 5 Expert Advisor for USD-quoted gold, designed to run from one M5 chart. It combines four trading engines - Range, Sessions, Portfolio and Core - in one application.
Each engine looks for different market conditions and has its own entry and trade-management rules. The engines can be tested together or separately, but all trades use the same account equity and available margin. A built-in dashboard displays account information, engine activity and trading status. The supplied settings are included in the Expert Advisor, so an external settings file is not required for a first test.
This description covers version 2.914. M5 refers to the five-minute chart. Some signals use higher timeframes internally; the default Core signal timeframe is H1 (one hour).
THE FOUR TRADING ENGINES
1. Range engine
Range analyses previous highs, lows and price structures across several timeframes. When its conditions are met, it can place pending buy-stop or sell-stop orders around eligible price levels. Its settings cover entry distance, stop loss, profit target, order expiry, position limits and trade management, including break-even, profit locking and trailing stops where applicable.
By default, Trade Frequency is set to Auto. This selects a group of Range strategies according to the account balance and the Range drawdown-sizing input. A change in account balance may therefore change both the position sizes and the strategies that participate. Manual Selection supports strategies 1 through 8. Strategy 9 is not available in version 2.914; keep RunStrat9 and S9_EnableInAutoMode disabled and do not select the Extreme preset.
Range includes a US nonfarm payroll timing filter. The built-in release schedule is approximate, and exact broker-server times can be entered. This filter applies to Range, not to every engine, and is not a live economic-calendar service.
2. Sessions engine
Sessions combines an intraday range-breakout setup with a timed buy setup. Both are enabled in the supplied configuration. A third setup based on previous daily ranges and momentum is available but disabled by default.
Sessions uses market entries with an initial stop loss. Depending on the setup, trades may close after a holding-time limit, at a scheduled session exit or after an opposite signal. These setups do not use a fixed take-profit order. Settings include session times, stop distance, automatic or manual position sizing, and optional spread and equity controls. The Sessions spread filter is disabled by default.
3. Portfolio engine
Portfolio combines technical-pattern strategies, Sovereign setups and a Trend Complement. The pattern strategies examine moving averages, market structure, price retests and volatility. Only a selected group of patterns and trade directions is enabled in the supplied configuration; switching on Portfolio does not activate every pattern.
Sovereign uses completed hourly price levels with volatility-based stop-loss and target distances. The Trend Complement evaluates breakouts of 48-bar and 72-bar price ranges, using H1 by default. The engine provides settings for position limits, pending-order expiry, stop loss, take profit, break-even, trailing stops and maximum holding time. The 48-bar and 72-bar figures are signal lookback periods, not how long a trade must remain open.
4. Core engine
Core evaluates completed candles, their size and direction, and permitted trading hours. In the supplied configuration, Core uses H1 signals and places buy-limit pullback orders. Core buys are enabled by default; Core sells are disabled. Management includes an initial stop loss, trailing adjustments and a time-based exit instead of a fixed take-profit order.
An optional Boost setup can propose additional buy entries when its daily-profit, candle, exposure and market-quality conditions are satisfied. The market-quality score is calculated using programmed rules within MetaTrader 5; it is not a trained artificial-intelligence forecasting service.
Core also includes a separate Trend Complement using 48-bar and 72-bar breakout signals, which may operate in either direction under its own rules. The optional H1 Expansion setup is disabled by default.
FILTERS, POSITION SIZING AND RISK CONTROLS
A shared H1 direction filter is enabled by default. It checks completed hourly candles, moving-average direction and a volatility buffer. It applies to the timed Sessions setup, selected Sovereign setups, and Core and Boost entries. It does not filter every strategy in the Expert Advisor. An entry can be skipped if its direction is not permitted or the required market data is unavailable.
AutoAccountCapitalSizing is enabled by default. It scales applicable reference volumes and cash values using a saved starting-capital baseline, with contract-size and currency conversion when required. Individual engines can also use their own balance, equity or percentage-risk calculations. Automatic sizing therefore does not mean every trade risks the same fixed percentage.
PortfolioSizeMultiplier defaults to 0.5. This multiplies the requested order volume before broker lot-size checks; it does not mean 0.5% account risk. Orders below a broker's minimum volume may be skipped. Leave AutoSizingProfileId at 0 for normal use. Changing it selects a new saved sizing baseline and should not be used as a routine way to increase activity or bypass a trading halt.
The main drawdown protection is OFF in the supplied settings: EnableDrawdownProtection is false. Before live use, review the protection settings and test any changes. The shared equity breaker requires both EnableDrawdownProtection and PortfolioBreakerEnabled to be enabled. Its default PortfolioDrawdownTrigger value is 20%, measured from a recorded equity peak. If triggered, it blocks new entries and attempts to cancel pending orders and close recognised Lock30x trades on the chart symbol. It is not an account-wide close-all function, and its peak and halt status may persist through an ordinary terminal restart.
Individual engines also have separate daily-loss, equity and recovery controls with different accounting baselines and reset rules. The Range MaxAllowedDD input also affects weighted position sizing; it is not a promise that account drawdown will remain below that figure.
AdaptiveExposureEnabled and LaneRiskSizingEnabled are off by default. When enabled, these options can reduce future entry volume during drawdown; they do not reduce positions that are already open. Broker minimum-lot rules can also limit a requested reduction.
These protections can reduce or block exposure under defined conditions, but cannot guarantee a maximum loss or compliance with any funded-account rules. Gaps, spreads, slippage, market closures and disconnections may affect execution.
ACCOUNT SIZE AND LEVERAGE
There is no verified universal minimum deposit or leverage that makes Lock30x suitable for every broker and account. The practical starting balance depends on the broker's gold contract size, minimum lot and step, margin rules, leverage, the enabled engines and acceptable drawdown.
The built-in gold sizing reference on a USD account is USD 10,000. This is a calculation baseline, NOT a required minimum deposit or a claim that a USD 10,000 account is safe. For example, with a standard 100-ounce contract, a 0.01-lot minimum and the default 0.5 Portfolio multiplier, one Portfolio pattern reference order calculates to 0.005 lots at a USD 10,000 baseline and is skipped.
At a USD 20,000 baseline, that particular calculation reaches 0.01 lots before other broker and exposure checks. This example concerns only order-volume compatibility, not a recommended deposit.
There is no single recommended leverage ratio. Use the actual leverage and gold margin requirements offered by your broker, then backtest with the same values. Higher leverage may reduce margin required for a position, but does not make a strategy safer and can allow greater exposure. Test the exact intended balance and compare USD 10,000 and USD 20,000 scenarios if you want to study minimum-lot effects. Assess equity drawdown, the largest concurrent exposure, free margin and which engines actually trade before using real funds.
SYMBOLS AND ACCOUNT TYPES
Use a USD-quoted gold symbol such as XAUUSD or a compatible gold alias defined by your broker. The Expert Advisor reads symbol properties to select its operating profile. The standard setup is ONE instance on the gold M5 chart.
Hedging accounts can hold separate positions, subject to the Expert Advisor's restrictions and broker rules. On netting accounts, an existing position, pending order or unresolved request on the symbol can prevent another entry; trade frequency may therefore differ. Avoid mixing manual positions or another Expert Advisor on the same symbol, particularly on netting accounts. Do not run duplicate instances against the same account and symbol on a computer and a virtual private server.
For other compatible instruments, only the Sessions engine operates. That profile uses an H1 Average True Range stop calculation with a 14-period default and a multiplier of 2. It must be evaluated independently; gold test results do not describe other markets.
INSTALLATION AND FIRST SETUP
1. Open MetaTrader 5 on a desktop terminal and connect to a broker demo account first.
2. In Tools > Options > Community, sign in using the MQL5 account that purchased or rented the Expert Advisor. Install or update Lock30x through the Market purchases section.
3. In Market Watch, locate the broker's exact gold symbol. Open Specification and check contract size, minimum lot, lot step, trading hours and margin rules.
4. Open one chart for that symbol and set it to M5. Attach Lock30x from Navigator.
5. Start with the supplied Inputs. Keep AutoAccountCapitalSizing enabled, AutoSizingProfileId at 0 and the Core signal timeframe at H1 for the initial comparison. Check the broker-time settings before trading.
6. Enable algorithmic trading in the Expert Advisor permissions and the main MetaTrader 5 Algo Trading control. Review the drawdown settings: the main drawdown protection is OFF by default.
7. Check that the dashboard appears, then review the Experts and Journal tabs for missing history, permissions, sizing notices or rejected orders.
8. Keep the terminal running and connected, or use a correctly configured virtual private server. Software-managed trailing stops and time-based exits require the Expert Advisor to be operating.
The free MQL5 Market demonstration can be used in the Strategy Tester. To operate the complete purchased or rented product on a normal broker demo-account chart, install the full licensed version.
BROKER TIME SETTINGS
The strategy uses UTC as its reference clock. Leave BridgeBrokerUtcOffsetMinutes at 0. The default MT5BrokerClockMode assumes a broker server operating at UTC+2 outside US daylight saving time and UTC+3 during it. This is a configuration assumption, not automatic detection of every broker's time zone.
Confirm your broker's present and historical server offsets. For a fixed-offset broker, select PORT_FIXED_OFFSET and set MT5HistoricalBrokerUtcOffsetMinutes to the correct number of minutes. If the broker uses another daylight-saving schedule, obtain setup guidance before relying on session-based entries. Your computer's local time is not the same as broker-server time.
HOW TO BACKTEST IN METATRADER 5
1. Open View > Strategy Tester or right-click Lock30x in Navigator and choose Test.
2. Select Lock30x XAUUSD, the broker's exact gold symbol and M5. Retain the H1 Core signal timeframe and verify the broker-time settings.
3. Enter the deposit, account currency and leverage you intend to use. Match the broker's hedging or netting account mode where possible.
4. Select Every tick based on real ticks when sufficient broker history is available. Allow MetaTrader 5 to finish downloading the history. Do not treat Open prices only results as equivalent for this order-management system.
5. Use the supplied settings first, with optimization disabled. Test a period containing different market conditions, not just a short favourable interval.
6. Review spreads, commissions, swaps, symbol specifications and execution-delay assumptions. Use monetary profit calculations rather than the profit-in-pips shortcut.
7. Run a shorter visual test to check the dashboard, orders and exits. Examine the Tester Journal for skipped volume, missing data, insufficient margin and order rejection messages.
8. Save the report and exact settings. Compare engine combinations under the same conditions, and validate any chosen configuration on dates not used when selecting the settings. Then evaluate the full version on a broker demo account.
Review equity drawdown, losing periods, trade count, lot sizes, free margin, concurrent exposure and results for each active engine. A positive ending balance alone does not establish suitability. Historical real-tick tests remain simulations and depend on the quality of the broker's available history.
DASHBOARD AND TROUBLESHOOTING
The on-chart dashboard shows account balance, equity, floating profit or loss, spread, open and pending orders, engine status, sizing information, trading filters and available performance history. Display options control panel layout, chart theme, trade levels and watermark. Dashboard drawdown statistics describe observed activity since attachment or visual-test start and should not be confused with protection thresholds.
The Expert Advisor does not target a fixed number of trades per day. If it is not trading, check the session window, availability of historical data, H1 direction filter, spread or exposure limits, minimum lot and available margin, trading permissions, open orders, account mode and possible risk halts. A pending order may also expire before execution. Check the Experts and Journal logs before changing settings; increasing the lot size is not a general remedy for missing trades.
Advanced parameters cover broker time, filters, sizing, display and each engine's entries and exits. Change one group at a time and save the settings used in each test. Keep OB_EnableLock30xEngine, OB_EnableAurumEngine and PG_InpCloseAllAccountPositions disabled; these retained compatibility controls are not supported in this combined version.
SUPPORT AND RISK INFORMATION
For installation and technical questions, contact the seller through the MQL5 product Comments tab or MQL5 messaging. Include the installed version, MetaTrader 5 build, broker, exact symbol, account currency, leverage and account mode. For testing questions, include the date range, tick model, Inputs, report and relevant Journal messages. Remove account numbers and personal information; never share passwords.
Lock30x is automated trading software, not a guarantee of profit. Its four engines trade within the same account and can share exposure to gold price movements. Gold and leveraged trading can cause substantial losses. Stop losses and equity brakes may not execute at intended levels during adverse market conditions. Historical and demo performance do not guarantee future results. Test carefully and trade only with capital you can afford to lose.
Evaluating Lock30x Over Time
Lock30x is designed to operate across different market conditions. Its performance should not be judged solely on the results of a single month.
A short evaluation period may be useful for confirming installation, broker compatibility, trade execution and risk-management behaviour. However, a longer observation period covering a sufficient number of completed trades can provide a broader understanding of the EA's behaviour.
Users are encouraged to test the EA with their intended broker and account settings, review trading activity and drawdown, and begin with a demo account before considering live trading.
Historical results and short-term performance do not guarantee future returns. Actual results will depend on market conditions, execution, trading costs and risk settings.


Good Robot