Connect PropTradeBot on your Mac to NinjaTrader 8 on Windows. About 15 minutes.
PropTradeBot runs on your Mac. NinjaTrader 8 runs on Windows, either a separate Windows PC or a Windows virtual machine on your Mac. A small NinjaTrader add-on, PTBBridge, connects the two. It places PropTradeBot's orders in NinjaTrader and enforces its own hard limits, even if PropTradeBot stops.
Before you start: confirm that your prop firm allows automated trading through NinjaTrader 8 on your accounts. That's your responsibility. Setup asks you to confirm it, and PropTradeBot does not check it for you.
Downloads (save both on the Windows PC)
You'll also need a Windows administrator login (for one firewall rule) and NinjaTrader 8 logged in.
You'll need two addresses, one for each machine.
ipconfig. Use the
IPv4 Address of the network adapter that's connected (for example 192.168.1.20).192.168.1.15).Home routers can hand out new addresses after a restart. To stop that, reserve both addresses in your router's DHCP settings (often called "DHCP reservation" or "static lease"). Otherwise, if one changes, repeat the steps below that use it.
On the Windows PC, create the file Documents\NinjaTrader 8\ptbbridge.cfg. Start from
ptbbridge.cfg.example and change:
| Setting | Set it to |
|---|---|
accounts= | your NinjaTrader account name(s), exactly as on NinjaTrader's Accounts tab |
instruments= | MES, or MES,MNQ if you also trade the Nasdaq leg |
max_order_qty= and max_position_qty= | at least your Contracts setting in PropTradeBot |
daily_loss_limit= | a dollar loss per account per day. When an account reaches it, the add-on closes that account's position and refuses new entries for the rest of the session (0 = off) |
listen= | the Windows PC's address from step 1 |
allow_from= | your Mac's address from step 1 |
The add-on will not start without this file. If listen= is set but allow_from= is
missing, it also refuses to start, so the port is never open to everyone.
Open Command Prompt as administrator (right-click → Run as administrator) and run, with your Mac's address:
netsh advfirewall firewall add rule name="PropTradeBot add-on" dir=in action=allow protocol=TCP localport=7811 remoteip=192.168.1.15
It should print Ok. This lets only your Mac reach port 7811. If your Mac's address changes later,
update the rule:
netsh advfirewall firewall set rule name="PropTradeBot add-on" new remoteip=NEW.MAC.ADDRESS
Never forward port 7811 on your router. The add-on is for your own local network only.
PTBBridge.cs into Documents\NinjaTrader 8\bin\Custom\AddOns\ on the Windows PC.Check it started: in NinjaTrader's Control Center open the Log tab and look for
PTBBridge listening on 192.168.1.20:7811 allow_from=192.168.1.15 accounts=... roots=MES ...
with your addresses. The add-on starts by itself every time NinjaTrader starts.
The first time it starts, the add-on creates a random token in
Documents\NinjaTrader 8\ptbbridge_token.txt on the Windows PC. Open the file and copy the token.
PropTradeBot needs it to connect. Keep it private; anyone with the token and network access to the PC could send
orders through the add-on.
On your Mac, open PropTradeBot's setup:
7811. Token: from step 5.NinjaTrader must stay running and logged in while PropTradeBot trades. If the connection drops, PropTradeBot stops taking entries, then rebuilds any open trade from NinjaTrader's own positions when it reconnects.
| What you see | What it means | Fix |
|---|---|---|
NinjaTrader Log: PTBBridge refused a connection from 192.168.1.37 (not in allow_from) |
A machine at that address tried to connect but isn't in allow_from=. Usually your Mac's address changed |
Put the address from the log line in allow_from= (and in the firewall rule), then restart NinjaTrader |
NinjaTrader Log: PTBBridge FAILED to start: listen=... needs allow_from= |
listen= is set without allow_from= |
Add allow_from= with your Mac's address |
NinjaTrader Log: PTBBridge FAILED to start: missing ...ptbbridge.cfg |
The settings file is missing or misnamed (Windows may have added .txt) |
Create Documents\NinjaTrader 8\ptbbridge.cfg (step 2) |
NinjaTrader Log: PTBBridge FAILED to start: unknown key in ptbbridge.cfg: ... |
A typo in a setting name | Fix the line it names |
| PropTradeBot setup can't connect, and nothing appears in NinjaTrader's Log | The connection never reached NinjaTrader: wrong address, firewall rule missing, or the two machines aren't on the same network | Check the address against ipconfig, re-run the firewall command in step 3, and make sure both machines are on the same home network |
| PropTradeBot says the token was refused | The token doesn't match ptbbridge_token.txt |
Copy the token again (step 5) |
allow_from= to your Mac's address.max_order_qty, max_position_qty, daily_loss_limit)
are a second safety net beside PropTradeBot's own. They hold even if PropTradeBot misbehaves.Stuck? Contact support.