PRECISIONFX
PFX Self-Host Relay - v1.00

PFX tools without an account

You do not need an account to use any PFX tool. This guide shows how to run the PFX relay yourself, on your own computer or VPS. It is free. Your keys are made on your machine and stay there. Nothing in the relay contacts PrecisionFX.

Read the first table. You may not need the relay at all.

Do I need the relay?
You want toWhat you need
Copy trades between MT5 accounts on the same computerNothing. The PFX Trade Copier works on its own: no account, no internet, no relay.
Copy trades between NinjaTrader 8 accountsNothing. The PFX Copier (NT8) runs inside NinjaTrader. No account, no relay.
Copy trades between MT5 accounts on different computersThe relay (this guide) and the free PFX Copy EAs. They are in the kit, in the EAs folder.
Send TradingView alerts to MT5 with the PFX ExecutorThe relay (this guide), or the PrecisionFX website if you prefer. Both work the same way.
Get the kit
DownloadFor
PFX-SelfHost-Relay-Windows.zipWindows PC or Windows VPS. Everything inside, nothing to install.
PFX-SelfHost-Relay-Linux.zipLinux, macOS or Docker. Needs Node.js 20 or newer.

Both are free, with no sign-up, on the guide page precisionfx.io/guides/self-host. If you already have the kit, this same guide is inside it.

What is in the kit
FileWhat it is
START-RELAY.cmdDouble-click this to start the relay (Windows).
pfx-relay.mjsThe relay itself.
node folderNode.js, the program that runs the relay. Already inside, nothing to install.
EAs folderPFX Copy Source, Follower and Observer EAs (for copying between computers).
relay-config.txtYour settings and keys. It appears the first time you start the relay. Keep it private.
relay-state.jsonWhat the relay remembers between restarts. Leave it alone.
Step 1 - Unzip and start
DoYou should see
Right-click the zip, choose Properties, tick Unblock if it is there, press OK.Nothing yet. This stops Windows asking about each file.
Unzip it to a folder that stays, for example C:\PFX-Relay.The files listed above.
Double-click START-RELAY.cmd.A black window: PFX Self-Host Relay 1.00 - free, runs on your own computer. then First run: made relay-config.txt with new keys.

Leave the window open. Closing it stops the relay. Open trades are never closed by stopping it.

Not seeing it?

It saysWhat to do
Windows protected your PCPress More info, then Run anyway. Or unblock the zip first (above) and unzip again.
Port 8787 is already in useThe relay is already running in another window. Use that one, or change port in relay-config.txt.
Node.js was not foundYou have the Linux download. Get the Windows download.
Step 2 - Your settings file

Open relay-config.txt in Notepad. Every line is name = value. Save the file and the relay reads it again within a few seconds.

LineWhat it does
webhook = pfxr_... name=MainA TradingView webhook. Add another line with webhook = new name=Gold for a second one.
terminal = pfxk_... name=Terminal-1A key for one PFX Executor. One line per MT5 terminal.
copy_source = pfxcopy_... name=SourceThe key for the PFX Copy Source EA (the account you trade).
copy_follower = pfxcopy_... name=Follower-1 mode=offA key for one PFX Copy Follower EA. mode=off watches only. mode=on copies new trades.
news_mode = OFFThe Executor's news guard: OFF, HIGH or HIGH_MEDIUM.
tunnel = offYour internet address. See step 3.

To make a new key, write the word new where the key goes, and save. To stop a key working, delete its line.

Not seeing it? The black window prints Settings: line 7: ... with the reason when a line is wrong. Fix that line and save. Nothing else stops.

Step 3 - An internet address (a tunnel)

TradingView needs a public https:// address to send alerts to. The PFX Copy EAs also only accept https:// addresses. A tunnel gives your relay one, without opening your router. Your relay still only listens on this computer.

OptionGood forHow
Quick testTrying it out todayDownload cloudflared-windows-amd64.exe from Cloudflare's cloudflared downloads page. Rename it cloudflared.exe and put it in the kit folder. Set tunnel = quick. Restart the relay. The address changes every restart, so use this for testing only.
Cloudflare Tunnel (recommended)A lasting address, freeNeeds a free Cloudflare account and a domain on Cloudflare. In Cloudflare Zero Trust open Networks > Tunnels, create a tunnel (type cloudflared), and copy its token. Add a public hostname, for example relay.yourdomain.com, pointing to http://localhost:8787. Then set tunnel = cloudflare, cloudflare_token = <the token> and public_address = https://relay.yourdomain.com. Put cloudflared.exe in the kit folder too.
ngrokA lasting address without your own domainA free ngrok account includes one free fixed address. Run ngrok http 8787 --url=https://your-name.ngrok-free.app in its own window and set public_address to that address.

Restart the relay after changing tunnel. It then prints every address you need:

It printsWhere it goes
Relay address for every EAThe Executor's relay address
Copy EAs (Relay address)The PFX Copy EAs' Relay address (it ends in /api/copy/relay)
TradingView webhook "Main"The Webhook URL in your TradingView alert
In MT5, allow WebRequest forMT5's WebRequest list (step 4)

Not seeing it?

It saysWhat to do
Could not start cloudflared.execloudflared.exe is not in the kit folder, or is still called cloudflared-windows-amd64.exe.
The tunnel stoppedCheck the internet connection, then restart the relay.
Step 4 - Let MT5 talk to the relay

In every MT5 terminal that uses the relay: Tools > Options > Expert Advisors. Tick Allow WebRequest for listed URL, add the address the relay printed after In MT5, allow WebRequest for, and press OK.

Not seeing it? The Executor prints WebRequest is not allowed for and the Copy EAs show MT5 is blocking the relay address. Both mean this step. Add the address exactly as printed, then re-attach the EA.

Step 5a - PFX Executor (TradingView alerts)
SettingSet it to
Signal sourcePrecisionFX Cloud (this is the relay setting; your own relay counts)
^ cloud: terminal key from your dashboardYour terminal = pfxk_... key from relay-config.txt
^ cloud: relay address (leave as-is)Your relay address, for example https://relay.yourdomain.com

In TradingView, paste the TradingView webhook address into the alert's Webhook URL. The alert message does not change. When an alert arrives the black window prints TradingView (Main): BUY XAUUSD queued as #1, then Executor: Terminal-1 collected #1, then what the EA did with it.

Not seeing it?

It saysWhat to do
terminal key rejected (in MT5)The key in the EA does not match a terminal = line. Copy it again.
an alert came to an address that is not in relay-config.txtThe webhook URL in TradingView is old or mistyped. Copy it from the window again.
skipped ... entry alert(s) older than 10 minutesThe terminal was off. Old entries are never traded late; closes still go through.
Step 5b - Copy trades between computers (PFX Copy EAs)
DoDetail
Install the EAsIn each MT5: File > Open Data Folder > MQL5 > Experts, copy in the .ex5 from the kit's EAs folder, restart MT5.
The account you tradeAttach PFX_Copy_Source. Relay address = your Copy EAs address. Connection key = your copy_source key.
Each account that copiesAttach PFX_Copy_Follower. Same Relay address. Connection key = that follower's copy_follower key.
Two switches before anything is copiedIn relay-config.txt set that follower's mode=on, and in the Follower EA tick Allow this EA to place orders.

Start on demo accounts. Losing trades are copied too. One key runs on one terminal only.

Not seeing it?

It saysWhat to do
The relay address must start with https://Use the tunnel address from step 3, not http://127.0.0.1.
The relay does not recognise this key.The key is not in relay-config.txt (or its line was deleted). Copy it again.
This key is bound to a different account.Each key belongs to one account. To move it, write new in place of that key and paste the new key into the EA.
Another installation is using this key.The same key is on two terminals. Give each terminal its own line.
Step 6 - Keep it running

The relay only works while its window is open and the computer is on. On a VPS, start it once and leave it.

To start it with Windows: press Win+R, type shell:startup, press Enter, and put a shortcut to START-RELAY.cmd in the folder that opens.

Linux or a server: install Node.js 20 or newer and run sh start-relay.sh, or use the Dockerfile in the kit (its first lines say how).

Safety
RuleWhy
The relay listens on this computer onlylisten = 127.0.0.1. The tunnel reaches it from inside. Only change this if you know why.
Keys are made on your machineThe relay makes them with your computer's own random generator and never sends them anywhere.
It never contacts PrecisionFXNo account, no check-in, no updates. The only outside connection is the tunnel you switch on.
Stopping it closes nothingCopies and trades stay open with their stop loss and take profit. They are just not managed until it runs again.
It places no tradesThe EAs do, on your terminals, under their own settings. Test on demo first.

Trading carries a high risk of loss and is not suitable for everyone. Copying repeats losses as well as profits.

Say thanks (optional)

Every PFX tool is free and stays free: there is no paid tier and nothing is held back. If one helps you and you would like to send a coffee back, there is a Ko-fi link on precisionfx.io. It is entirely optional and unlocks nothing.