How to Set Up MetaTrader for Automated H4 Timeframe Trades

Quick Answer

To set up MetaTrader for automated H4 timeframe trades, install MT4 or MT5, enable the platform's AutoTrading permission in both the terminal settings and the broker connection, then attach a rules-based Expert Advisor to an XAUUSD H4 chart with "Allow live trading" checked for that EA. From there, configure lot sizing and risk parameters to match your account size, run the EA on a VPS for uninterrupted 24/5 execution, and confirm trades are firing correctly by checking the Experts and Journal tabs during the first few H4 candle closes. The whole process takes under 30 minutes once your broker account is funded and verified.

If you have traded gold manually and you are ready to hand routine execution to an automated system, the H4 (4-hour) chart is one of the more forgiving timeframes to automate: it produces roughly six candle closes per trading day, filters out a lot of the intraday noise that trips up lower timeframes, and gives an Expert Advisor (EA) enough structure to apply consistent rules without you watching the screen all day. This guide walks through the full MetaTrader setup process step by step, from installing the platform to configuring an EA for XAUUSD H4 automation, so you can get from a blank terminal to a working automated setup without guessing at settings.

Why the H4 Timeframe Is a Practical Choice for Automated Gold Trading

Before touching any settings, it helps to understand why H4 is the timeframe most gold-focused EAs, including Golden Viper EA, are built around. Gold (XAUUSD) is notoriously volatile intraday, reacting sharply to economic data releases and shifts in risk sentiment. On the M15 or M30 charts, that volatility produces a high number of false signals — an automated system reacting to every wick can rack up commissions and slippage without net progress. The H4 chart compresses that noise into six candles a day (00:00, 04:00, 08:00, 12:00, 16:00, and 20:00 platform time on most broker servers), which means an EA evaluating conditions only at each H4 close is working with more confirmed, less reactive information.

This is also why H4 automation tends to produce a lower trade frequency than scalping-style systems. A selective H4 approach might generate roughly one qualifying setup a day at most rather than dozens, which matters for how you think about position sizing, drawdown, and account growth — topics covered in more detail in our guide on how much capital you need to start EA trading. If you are comparing H4 against faster approaches, a breakdown of scalping-style gold strategies is a useful contrast point for understanding the trade-offs between frequency and signal quality.

MT4 vs. MT5: Choosing the Right Platform for H4 Automated Trading

Both MetaTrader 4 and MetaTrader 5 support H4 automated trading, and most modern gold EAs — including Golden Viper — are built to run on either platform under a single license. The decision usually comes down to what your broker offers and which platform you already have historical data and habits built around. MetaTrader 5 is the newer platform with more built-in timeframes, a faster strategy tester, and native support for hedging and netting account types, while MetaTrader 4 remains widely supported and is still preferred by some brokers for its lighter footprint. You can review the official platform documentation directly from MetaTrader 4's help resources and MetaTrader 5's terminal help before deciding.

FactorMetaTrader 4 (MT4)MetaTrader 5 (MT5)
Native timeframes9 (M1 to MN)21, including H4 with finer intraday granularity
Strategy tester speedSingle-threaded, slower on long backtestsMulti-threaded, noticeably faster for H4 history runs
Account typesPrimarily hedging accountsSupports both hedging and netting
Broker availability (2026)Still widely offeredNow the default for most new broker accounts
EA programming languageMQL4MQL5
Golden Viper EA compatibilitySupported under the same licenseSupported under the same license

Whichever platform you choose, the setup steps below follow the same logic. The menu names differ slightly between MT4 and MT5, but the AutoTrading toggle, EA input tabs, and Experts/Journal logs behave almost identically across both.

Step-by-Step: Installing MetaTrader and Enabling Automated Trading

Step 1: Download the Platform From Your Broker

Always download MetaTrader through the link your broker provides rather than a generic search result, since the broker's installer pre-configures the correct server connection for your account. If you have not yet chosen a broker for gold EA trading, our comparison of best brokers for gold EA trading covers spread and execution quality specifically for XAUUSD.

Step 2: Log In and Enable AutoTrading Globally

After installing, log in with your account number, password, and the broker's server address. Locate the "AutoTrading" or "Algo Trading" button in the main toolbar and click it until it shows green — this is the master switch that permits any Expert Advisor on the terminal to place trades. Separately, open Tools > Options > Expert Advisors (MT4) or Tools > Options > Expert Advisors (MT5) and check "Allow automated trading" along with "Allow WebRequest for listed URL" if your EA needs external connectivity.

Step 3: Set the Chart to H4

Open a chart for XAUUSD (your broker may label it Gold, XAUUSD, or GOLD#), and select the H4 timeframe from the timeframe toolbar or by pressing the corresponding shortcut. Confirm the chart is actually updating H4 candles by watching the current bar's timestamp — it should be one of the six H4 open times noted earlier, adjusted for your broker's server time zone.

Step 4: Attach the Expert Advisor

Drag the EA from the Navigator panel's "Expert Advisors" folder onto the XAUUSD H4 chart. A settings window opens with three tabs relevant here: Common, Inputs, and (in MT5) Dependencies. On the Common tab, check "Allow live trading" (or "Allow algo trading" in MT5) and "Allow DLL imports" only if the EA specifically requires it. Click OK, and you should see a small smiley-face icon in the chart's top-right corner confirming the EA is active and permitted to trade.

Checklist ItemWhere to Find ItWhy It Matters
Terminal AutoTrading toggle is greenMain toolbarMaster switch; nothing trades without it
"Allow automated trading" checkedTools > Options > Expert AdvisorsPlatform-level permission separate from the toggle
Chart timeframe set to H4Timeframe toolbarEA logic evaluates only at H4 candle closes
Correct symbol loaded (XAUUSD)Market Watch / chart symbolWrong symbol suffix means the EA never sees gold price data
"Allow live trading" checked on the EAEA properties, Common tabPer-EA trading permission, separate from the terminal switch
Smiley-face icon visible on chartTop-right corner of chartConfirms the EA is actively running, not just attached
Journal tab shows no red errorsTerminal window, Journal tabCatches connection, permission, or input errors immediately

Configuring Risk Settings for H4 EA Trading

Once the EA is attached and permitted to trade, the Inputs tab is where you set risk parameters. Most H4 gold EAs, Golden Viper included, use risk-based lot sizing rather than a fixed lot size, meaning the EA calculates position size as a percentage of your account equity for each trade rather than trading the same lot regardless of balance. This is a meaningfully different approach from a static 0.10-lot setting, because it scales your exposure automatically as your account grows or shrinks.

Golden Viper EA specifically offers three risk modes — Conservative, Normal, and Aggressive — that adjust the percentage of equity risked per trade and the resulting lot size. Here is a simplified illustration of how that scaling might look on a $10,000 account (actual figures depend on stop distance and current gold price, so treat this as an illustrative worked example rather than a fixed table of outcomes):

Risk ModeApprox. Risk per TradeIllustrative Lot Size ($10,000 account)Best Suited For
Conservative~0.5%–1% of equity~0.03–0.06 lotsCapital preservation, smaller drawdown tolerance
Normal~1%–2% of equity~0.06–0.12 lotsBalanced growth and drawdown exposure
Aggressive~2%–3% of equity~0.12–0.18 lotsTraders comfortable with larger equity swings

Regardless of which mode you choose, understanding risk management fundamentals before going live matters more than the specific EA you run. Position sizing that risks too much per trade is the single most common reason automated systems blow through acceptable drawdown levels, and our dedicated explainer on how drawdown actually works walks through the math in more depth. For a full walkthrough of every configurable input on a gold EA, see our guide to understanding EA settings.

Setting Magic Numbers and Managing Multiple EAs

If you plan to run more than one EA on the same account — for example, Golden Viper on XAUUSD alongside a separate system on another pair — each EA needs a unique magic number so the platform can distinguish which trades belong to which strategy. This is set in the Inputs tab, usually as a numeric field labeled "Magic Number" or similar. Without unique magic numbers, EAs can inadvertently modify or close each other's trades, which is a common and entirely avoidable source of confusion. Our detailed guide on EA magic numbers covers how to assign and verify them correctly, and it also discusses whether running several systems on one account actually reduces risk or just adds complexity.

Backtesting Before You Trade H4 Live

Before committing real capital, run the EA through MetaTrader's built-in Strategy Tester using historical H4 data. This lets you see how the system would have behaved across different market conditions without risking anything. MT5's tester is generally faster and supports multi-threaded optimization, which is useful if you want to test how a strategy performs across a range of risk settings. The platform's official documentation covers the technical mechanics of the tester in detail if you want to go deeper than the GUI settings. Our separate step-by-step walkthrough for backtesting an EA on MT4 covers how to interpret the resulting equity curve and drawdown report rather than just the headline profit figure (the MT5 tester follows the same logic with a faster interface).

One caution here: backtest results, even accurate ones, describe what already happened. They do not predict what will happen next. Treat a backtest as a sanity check on logic and risk behavior, not as a guarantee of future performance.

Running Your H4 EA on a VPS for Uninterrupted Execution

An H4 EA only needs to evaluate conditions six times a day, but it needs to be running and connected at every one of those candle closes to work as intended. If your home computer sleeps, loses internet, or is simply turned off when an H4 candle closes, the EA misses that evaluation entirely. This is why most traders running automated systems, whether on gold or any other instrument, move execution to a Virtual Private Server (VPS) — a small remote computer that stays online 24/5 regardless of your local machine's state.

A VPS also reduces the physical distance (and therefore latency) between your terminal and your broker's trade server, which can matter for execution quality even on a timeframe as unhurried as H4. Setup typically takes 15–20 minutes: you install MetaTrader on the VPS the same way you would locally, log in with your broker credentials, attach the EA, and enable AutoTrading exactly as described above. Our full walkthrough on choosing a VPS for forex EA trading compares providers by price and latency, and covers the remote desktop connection process for readers doing this for the first time.

Verifying Your Automated H4 Trades Are Working Correctly

After the EA is live, do not assume it is working simply because no error appeared. Check the Experts tab and Journal tab in the Terminal window after the next H4 candle closes to confirm the EA logged an evaluation, even if it decided not to trade (remember, a selective H4 system may go a full day or more without a qualifying setup). Look specifically for connection drops, "trade context busy" messages, or rejected orders, which usually point to a broker-side execution issue rather than a problem with the EA itself.

For independent verification beyond your own terminal, connecting your MT4 or MT5 account to a third-party tracking service like Myfxbook gives you an outside record of every trade, timestamped and unaltered by you after the fact. This is also the standard most experienced gold traders use to evaluate whether a public track record is genuine — Myfxbook's own verification process explains how accounts are confirmed as real, live trading rather than simulated. Our guide on connecting MT4 to Myfxbook covers the exact steps to link your account and start building your own verifiable history.

Common Setup Mistakes That Break H4 Automated Trading

Most problems with automated H4 setups trace back to a handful of repeat mistakes rather than anything exotic. The EA appears attached but never trades because AutoTrading is toggled on the terminal but not on the individual EA, or vice versa. The chart is on the wrong symbol variant — many brokers append a suffix like XAUUSD.m or GOLD# to their gold symbol, and an EA configured for the base symbol name may not recognize the variant. The VPS loses connectivity because the terminal was left logged in on two machines simultaneously, which most brokers do not permit and will silently disconnect one session. And input settings get changed mid-test without documenting the original values, making it impossible to know afterward which configuration actually produced which results.

If you are troubleshooting an EA that seems attached but inactive, a structured checklist covering permission errors and broker-side trade restrictions can usually isolate the issue in a few minutes.

Red Flags: Avoiding Automated Trading Scams

Because automated trading systems are marketed heavily, this space attracts a disproportionate number of scams alongside legitimate tools. The CFTC's forex fraud resources and its specific advisory on automated trading system fraud are worth reading in full before you buy any EA, including this one. The consistent warning signs across regulator guidance are promises of guaranteed profits, pressure to deposit quickly, unverifiable or screenshot-only performance claims, and systems that refuse to show a live, third-party-verified track record. The FTC's overview of investment scams covers similar patterns that apply well beyond forex and gold trading specifically.

A legitimate EA vendor should be comfortable pointing you to a verified Myfxbook or MQL5 signal record you can inspect independently, rather than asking you to trust marketing copy alone. No honest system, automated or not, can promise guaranteed returns or claim to be risk-free — any product that does should be treated as a red flag rather than a selling point.

What to Expect After Your First Week of Automated H4 Trading

In practical terms, a properly configured H4 gold EA running on a VPS will operate quietly in the background, evaluating the chart six times a day and placing trades only when its rules-based conditions for a XAUUSD setup are met. Because H4 systems are typically selective rather than high-frequency, do not expect a trade every day — a system might take one setup, skip the next two days, then take another. This is a feature of trading on a slower timeframe, not a malfunction. Many H4 approaches also apply a profit-lock mechanism that protects gains on a winning trade as price moves favorably, along with an optional safety-stop parameter you can configure based on your own risk tolerance.

Track your results weekly rather than daily during the first month. A single H4 candle's outcome tells you very little; six weeks of H4 closes (roughly 250 evaluations) gives you a far more honest picture of how the system performs across different market regimes. If you want a sense of realistic expectations before you start, our guide on whether automated gold trading is actually profitable walks through the numbers with appropriate caveats about variance and market conditions.

Trading Gold Fundamentals Alongside Your H4 Automation

Even with automation handling execution, it helps to understand what moves the instrument you are trading. Gold prices are influenced by central bank policy, real interest rates, and broader risk sentiment — dynamics covered by resources like the World Gold Council and, for futures pricing context, the CME Group, which lists the benchmark gold futures contract that spot XAUUSD pricing tracks closely. Understanding these drivers will not change how your EA executes, but it will help you interpret why certain weeks look different from others as you monitor your account alongside the automated system.

Before you go live with real capital, one honest disclosure: trading gold, automated or manual, carries genuine risk of loss. Past performance, including any verified track record, does not guarantee future results, drawdowns are a normal part of any strategy, and you should only ever trade with capital you can afford to lose. A well-configured H4 setup manages execution discipline; it does not eliminate market risk.

Frequently Asked Questions

Do I need MT4 or MT5 specifically for H4 automated gold trading?

Either platform works. H4 is a native timeframe on both MetaTrader 4 and MetaTrader 5, and most modern gold EAs, including Golden Viper, run on both under a single license, so the choice usually comes down to what your broker offers.

How many trades should I expect from an H4 gold EA per week?

It depends on the strategy's selectivity, but many H4 gold systems are designed to be selective rather than high-frequency, sometimes producing roughly one qualifying setup per day at most, and some days none at all. This is normal behavior for a rules-based H4 approach, not a sign of malfunction.

Can I run an automated H4 EA without a VPS?

Technically yes, as long as your computer stays on and connected 24/5, but this is risky in practice. A missed connection at the exact moment an H4 candle closes means the EA cannot evaluate or manage that trade window, so a VPS is strongly recommended for anyone serious about consistent execution.

Why does my EA show as attached but never places trades?

The most common cause is a permissions mismatch: AutoTrading may be enabled on the terminal but not checked in the EA's own properties (or vice versa), the chart symbol may not match what the EA expects, or the EA's conditions for a valid H4 setup simply have not been met yet. Check the Journal tab for specific error messages.

Is lot size fixed or does it adjust automatically with an H4 gold EA?

Most modern gold EAs, including Golden Viper, use risk-based position sizing, calculating the trade size as a percentage of current account equity rather than a fixed lot value. This means position size scales automatically as your balance changes.

What is a magic number and do I need to set one?

A magic number is a unique identifier attached to an EA's trades so the platform can distinguish them from trades placed by another EA or manually. You should always set a unique magic number, especially if you plan to run more than one automated system on the same account.

How can I verify an EA's track record is genuine before trusting it?

Look for a live account connected to a third-party verification service like Myfxbook, or a public signal on MQL5, rather than relying on screenshots or marketing claims. Regulators including the CFTC and FTC specifically warn against automated trading systems that cannot produce independently verifiable results.

Does the H4 timeframe reduce risk compared to trading gold on lower timeframes?

H4 tends to filter out a significant amount of intraday noise compared to M15 or M30 charts, which can reduce the number of false signals an automated system reacts to. It does not eliminate market risk, and drawdowns remain possible on any timeframe, including H4.

Can I backtest an H4 EA before trading it live?

Yes, and you should. MetaTrader's built-in Strategy Tester lets you run an EA against historical H4 data to review how it would have performed, though backtest results describe past conditions and are not a guarantee of future performance.

What does a profit-lock feature do on an automated H4 system?

A profit-lock mechanism adjusts a trade's stop level as price moves favorably, aiming to protect a portion of unrealized gains rather than risking them back to breakeven or loss if the market reverses. It is a risk-management feature, not a guarantee against losses on any given trade.

Myfxbook Verified

Automate Your MT4/MT5 Edge

+€1,485Net · 6-mo (verified)
56%Win Rate (51/91)
24/5Automated
Starting at $199 one-time
Get Lifetime Access →
✓ Instant download✓ Full feature access✓ MT4 & MT5 compatible
DC

Daniel Cole

Daniel Cole writes about MetaTrader 4/5, Expert Advisors, and automated XAUUSD gold trading for Golden Viper EA.

Myfxbook VerifiedLive since Jan 2026Public track record

Let Golden Viper EA trade gold for you

Automated XAUUSD trading for MT4 & MT5, verified live on Myfxbook. One-time $199, lifetime access.

Get Lifetime Access — $199