How to connect Ten12 GuardX to MetaTrader 5
GuardX runs inside MetaTrader as a small Expert Advisor (EA). Every few seconds it reports your account to Ten12 and closes any trade that breaks the rules you set. This guide takes you through it step by step, on a Windows PC, on a Mac, or from your phone alone.
Before you start
- A Ten12 Pro membership. GuardX is part of Pro.
- Your MetaTrader 5 login: account number, password and server name, from your broker's welcome email or client area. MT4 works too; the differences are at the end.
- A computer that runs MetaTrader: a Windows PC, a Mac, or a Windows VPS (a computer in the cloud, which you can use from your phone).
Choose your path
Everyone does step 1 the same way. Step 2 depends on what you have; steps 3 to 5 are the same again.
1Create your MetaTrader key
The key links the Expert Advisor to your Ten12 account. One key works for all your MetaTrader accounts.
- Log in at tentwelvementors.com and open the workspace (Open workspace, top right).
- In the left menu, open Ten12 GuardX, then click Connect MT4/MT5.
- Click Create your MetaTrader key. A key starting with
t12_appears. - Copy it and keep it somewhere safe, such as your notes app. It is shown only once. If you lose it, create a new one; the old key then stops working, so paste the new one into MetaTrader too.
While you're in GuardX, set your rules (daily loss limit, max trades, stop loss required and so on). You can change them any time except during a cooldown.
2Install the Expert Advisor
Pick your path. Each one ends with Ten12_GuardX listed in MetaTrader's Navigator, ready for step 3.
2A · Windows PC
- Install MetaTrader 5 from your broker's website, open it and log in to your account (File → Login to Trade Account).
- Download Ten12_GuardX.mq5 with the button above. It goes to your Downloads folder.
- In MetaTrader, open File → Open Data Folder. A folder window opens.
- Open MQL5, then Experts, and drag Ten12_GuardX.mq5 from Downloads into it.
- Back in MetaTrader, press F4 to open MetaEditor. On the left, open Experts and double-click Ten12_GuardX.mq5.
- Click Compile in the toolbar (or press F7). The Errors tab at the bottom should say 0 errors. Close MetaEditor.
- In MetaTrader, open View → Navigator (Ctrl+N), right-click Expert Advisors and choose Refresh. Ten12_GuardX appears in the list.
2B · Mac
MetaTrader 5 for Mac runs inside a compatibility layer called Wine. Its windows aren't normal Mac windows, so you can't drag a file from Finder into MetaTrader. Instead you paste the code into MetaEditor, which takes about two minutes.
- Install MetaTrader 5 for Mac from your broker or from metatrader5.com, open it and log in to your account.
- On this page, click Copy the MT5 code above. If the button doesn't work in your browser, download the file instead, double-click it, choose TextEdit, then press ⌘+A and ⌘+C.
- In MetaTrader, open Tools → MetaQuotes Language Editor (MetaEditor).
- In MetaEditor, open File → New, choose Expert Advisor (template) and click Next.
- Type the name Ten12_GuardX, then click Next, Next and Finish. A new file with some sample code opens.
- Click inside the code, select all of it (Ctrl+A, or ⌘+A) and paste (Ctrl+V, or ⌘+V), so the GuardX code replaces the sample.
- Click Compile in the toolbar, just right of the ← → arrows (or use Build → Compile). Then click the Errors tab at the bottom: it should say 0 errors. Compiling also saves the file.
- In MetaTrader, open View → Navigator, right-click Expert Advisors and choose Refresh. Ten12_GuardX appears.
2C · Phone only (Windows VPS)
A VPS is a Windows computer in a data center that stays on 24/7. You open it on your phone like a remote screen, install MetaTrader there once, and GuardX keeps running even when your phone is off.
- Get a Windows VPS. Many brokers give clients a free trading VPS (look for "Free VPS" in your broker's client area, often after a minimum deposit). You can also rent one from a VPS provider; 2 GB of memory with Windows Server is plenty. Choose a location near your broker's servers. Note the IP address, user name and password they send you.
- Install the free Windows App on your phone. It's Microsoft's Remote Desktop app: Windows App on the App Store (iPhone) or Google Play (Android).
- Connect. In Windows App, tap + → Add PC, type the VPS IP address, save, tap it, and enter the user name and password. The Windows desktop of your VPS appears on your phone. Turn your phone sideways for a bigger screen. A tap is a click; tap and hold is a right-click; pinch to zoom.
- Inside the VPS, open the web browser (Edge), download MetaTrader 5 from your broker's website, install it and log in to your trading account.
- Still in the VPS browser, log in to tentwelvementors.com, open this guide (
tentwelvementors.com/guardx/setup) and follow 2A · Windows PC from step 2. Copy your MetaTrader key from step 1; if you saved it on your phone, retype it carefully or create a new one inside the VPS. - When step 4 is done, close Windows App on your phone. The VPS keeps MetaTrader and GuardX running.
3Allow it to work
MetaTrader blocks Expert Advisors from trading and from contacting websites until you allow it. You only do this once.
- In MetaTrader, open Tools → Options and choose the Expert Advisors tab.
- Tick Allow algorithmic trading.
- Tick Allow WebRequest for listed URL.
- In the list below it, double-click the empty line (or add new URL) and type exactly:
https://tentwelvementors.com - Click OK.
4Attach it to one chart
- Open one chart of the account. Any symbol is fine, for example XAUUSD. GuardX watches every trade on the account from that single chart; don't attach it to more than one.
- In the Navigator, drag Ten12_GuardX (under Expert Advisors) onto the chart. A settings window opens.
- On the Common tab, tick Allow Algo Trading.
- On the Inputs tab, double-click the value next to GuardKey and paste your MetaTrader key. Leave the other settings as they are.
- Click OK.
- Check the Algo Trading button in the top toolbar: it must be green. If it's red, click it once.
- The chart's top-left corner shows a Ten12 GuardX status line, and the icon at the top right of the chart is active (not greyed out).
5Check the connection and test it
- In the workspace, open Ten12 GuardX. Within about a minute your account appears under Connected accounts, online, with its balance. Your last 90 days of closed trades are imported for the trade score.
- On a demo account, set strict rules and try to break them:
| Test | Rule to set | What you do | What should happen |
|---|---|---|---|
| Stop loss required | Stop loss on every trade | Open a trade with no stop loss | About a minute to add one, then the trade is closed |
| Max trades | Max trades per day = 1 | Open a second trade | The second trade is closed within seconds |
| Daily loss limit | A small limit, e.g. 0.5% | Let a trade lose past it | All open trades close and a cooldown starts; new trades are closed at once |
Each action appears in GuardX on the website. In MetaTrader you can also see GuardX's messages under View → Toolbox → Experts.
Keep it running
- GuardX enforces your rules only while MetaTrader is open, online and the computer is awake. If MetaTrader closes, nothing is enforced until it's back.
- Windows PC: set Settings → System → Power so the PC doesn't sleep while plugged in, and leave MetaTrader open.
- Mac: keep it plugged in and turn off automatic sleep; closing the lid sleeps the Mac.
- VPS: nothing to do. It's always on. If your provider restarts it, open it once from Windows App and reopen MetaTrader.
- After MetaTrader restarts, GuardX starts again on its own as long as it's still on the chart and Algo Trading is green.
Using MetaTrader 4 instead
The steps are the same with these small differences:
- Download Ten12_GuardX.mq4. On Windows, put it in MQL4 → Experts (File → Open Data Folder).
- In Tools → Options → Expert Advisors, tick Allow automated trading and Allow WebRequest for listed URL, and add
https://tentwelvementors.com. - On the chart's settings, the Common tab says Allow live trading: tick it. The toolbar button is called AutoTrading and must be green.
If something isn't working
| What you see | What to do |
|---|---|
| The chart says "allow WebRequest for https://tentwelvementors.com" | Do step 3 again and check the address is typed exactly, with https:// and no slash at the end. |
| A pop-up says "paste your MetaTrader key" and GuardX leaves the chart | The GuardKey box was empty. Drag Ten12_GuardX onto the chart again and paste your key on the Inputs tab. To change the key later, press F7 on the chart (or right-click → Expert Advisors → Properties). |
| "Unknown key" | The key is mistyped, or a newer key replaced it. Copy it again, or create a new key and paste that. |
| "Ten12 GuardX is part of Ten12 Pro" | Your Pro plan isn't active on this login. Check the plan in My account, or contact us. |
| Ten12_GuardX isn't in the Navigator | It wasn't compiled into the Experts folder. Compile it again in MetaEditor and look for 0 errors, then right-click Expert Advisors → Refresh. |
| Compile shows errors | The code was only partly pasted. Select everything in MetaEditor, paste the whole code again and compile. |
| The website says Locked, but new trades stay open | The computer or VPS running GuardX must be on, awake and online, with MetaTrader open and the Algo Trading button green. Check that the phone app is logged in to the same account number (brokers like Exness give you several demo and real accounts). With GuardX 1.01 the website shows a red warning when Algo Trading is off or MetaTrader stops reporting. |
| The account doesn't appear on the website | Check the Algo Trading button is green, the chart's top-right icon is active, and MetaTrader is connected (bottom-right corner shows a connection, not "No connection"). |
| I dragged a file into MetaTrader on a Mac and nothing happened | That's normal on a Mac. Use 2B and paste the code into MetaEditor instead. |
Still stuck? Send a screenshot of the chart and the Experts tab to support@tentwelvementors.com and we'll help.
Frequently asked questions
Can I set up GuardX with only a phone?
Yes, with a Windows VPS. The MetaTrader phone app can't run Expert Advisors, so GuardX runs on the VPS, which you set up from your phone with Microsoft's free Windows App. You then trade from the MT5 phone app as usual, and GuardX applies your rules to those trades too.
Do I need to keep my computer on?
Yes. GuardX enforces your rules only while MetaTrader is running and online. On a laptop that sleeps or is switched off, nothing is enforced. A VPS stays on around the clock, which is why it's the best option for real accounts.
Why does a trade open and then close, instead of being blocked?
MetaTrader sends your order straight from the app to your broker's server. No Expert Advisor can stop that order, only the broker can (prop firms do it with tools on their own servers). So GuardX acts the moment the trade appears: it closes it at once, and deletes pending orders before they can fill. Each blocked trade can cost a little spread, so during a cooldown it's best to close the app and step away. That's what the cooldown is for.
Does GuardX place trades for me?
No. It never opens a trade and never moves your stop loss or target. It only closes positions and pending orders that break the rules you set.
Can I connect more than one account?
Yes. Use the same key: attach GuardX to one chart in each account's MetaTrader. Each account appears separately in GuardX.
Is my MetaTrader password shared with Ten12?
No. GuardX uses your Ten12 key, never your MetaTrader password. It sends your balance, positions and closed trades so the rules and your trade score can be worked out.
Ten12 GuardX is a discipline tool, not investment advice. It acts on your own MetaTrader account only to close positions and pending orders that break the rules you set. Closing at market can mean slippage. Trading carries a substantial risk of loss. See our risk disclosure.