PineHookPineHook

Connection Issues

Troubleshooting EA connection problems.

This guide helps resolve issues when the EA can't connect to PineHook.

Symptoms#

  • Dashboard shows "Disconnected"
  • EA logs show "WebSocket error" or "Connection failed"
  • Signals aren't being received

Solution Checklist#

1. Enable DLL Imports#

PineHook connects through a bundled library, PineHook.dll, not through MT5's WebRequest. The setting that governs connectivity is Allow DLL imports:

  1. In MT5: Tools → Options → Expert Advisors
  2. Check Allow DLL imports
  3. Click OK
  4. When attaching the EA, also tick Allow DLL Imports on the attach dialog's Dependencies tab, and Allow live trading on the Common tab
  5. Restart the EA

There is no WebRequest URL to add

Older guides told users to add a URL under "Allow WebRequest for listed URL". That does nothing for PineHook: the EA never uses WebRequest, it connects over a WebSocket opened by PineHook.dll. If the EA won't connect, the setting to check is Allow DLL imports, not a WebRequest allowlist.

2. Enable AutoTrading#

AutoTrading must be enabled:

  1. Click the AutoTrading button in MT5 toolbar
  2. Button should show green/enabled state
  3. The EA's hat icon (top-right of the chart) should be blue (enabled; grey means disabled)

3. Check License Key#

Verify your license is correct:

  1. Copy license from PineHook dashboard
  2. Open EA settings in MT5
  3. Paste into License Key field
  4. Ensure no extra spaces

4. Verify Internet Connection#

MT5 must have internet access:

  1. Check MT5 connection status (bottom right)
  2. Should show ping time (e.g., "45 ms")
  3. If disconnected, check your network

5. Firewall/Antivirus#

Security software may block connections:

  • Add MT5 to firewall exceptions
  • Add relay.pinehook.io to allowed domains
  • Temporarily disable antivirus to test

Common Errors#

"WebSocket connection failed"#

Cause: Can't establish WebSocket connection.

Solutions:

  1. Confirm Allow DLL imports is enabled (Tools → Options → Expert Advisors)
  2. Verify internet connection
  3. Try a different network (mobile hotspot)
  4. Contact your broker - some block WebSockets

"SSL certificate error"#

Cause: SSL/TLS handshake failed.

Solutions:

  1. Update MT5 to latest version
  2. Check system date/time is correct
  3. Install Windows updates

"Connection timeout"#

Cause: Connection attempt took too long.

Solutions:

  1. Check internet speed
  2. Try restarting MT5
  3. Check if behind corporate proxy
  4. VPN may help if ISP blocks WebSockets

"Invalid license key"#

Cause: The license key sent by the EA isn't recognised (wrong key, extra spaces, or a key that's been deleted).

Solutions:

  1. Copy the license again from the dashboard
  2. Ensure no extra spaces before or after the key
  3. Confirm you're using a current, active license from your account

An expired subscription still connects

An inactive or expired subscription does not produce this error. The EA still connects, but in limited (close-only) mode: the relay sends a note reading "Your subscription is inactive. Close/cancel commands still execute, but new trades are blocked." If your EA is connected yet no entries open, check your subscription status rather than the connection.

"Secret key required for this license" / "Invalid secret key"#

Cause: The license has a Secret Key set in the dashboard, but the EA's InpSecretKey input is blank ("Secret key required for this license") or doesn't match ("Invalid secret key").

Solutions:

  1. Open the license in the dashboard and copy its Secret Key
  2. Paste it into the EA's Secret Key (InpSecretKey) input, with no extra spaces
  3. If you rotated or regenerated the Secret Key, update InpSecretKey to the new value. A change only takes effect on the EA's next reconnect, so an already-connected EA keeps running until it reconnects
  4. If you don't use a Secret Key, make sure none is set on the license in the dashboard

"Already connected" / a chart disconnects itself#

Cause: The license is already connected from another EA, most often the same license attached to a second chart on the same MT5 account. A license holds one live connection, so the newest connection takes over and the older one disconnects. The disconnected instance prints a note in the Experts tab: the license is already connected and one chart already covers every symbol.

Solutions:

  1. Keep PineHook on one chart only: it trades every symbol for your broker, so you don't need a chart per symbol.
  2. Remove the EA from any extra charts on the same account.
  3. To run a genuinely separate account or terminal, give it its own license (don't reuse one license across accounts, or they'll keep kicking each other). More licenses come with higher tiers.

Network Diagnostics#

Test WebSocket Connection#

In your browser, open developer tools (F12) and run:

const ws = new WebSocket('wss://relay.pinehook.io/ws/test');
ws.onopen = () => console.log('Connected!');
ws.onerror = (e) => console.log('Error:', e);

If this fails, your network may be blocking WebSockets.

Check from Command Line#

curl -I https://relay.pinehook.io/health

Should return 200 OK.

Broker Restrictions#

Some brokers restrict EA functionality:

Broker TypeWebSocketNotes
ECN/RawUsually OKFull functionality
Market MakerSometimes blockedMay need VPS
Prop FirmVariesCheck their rules

If your broker blocks WebSockets:

  1. Use a VPS service
  2. Contact broker support
  3. Consider switching brokers

VPS Considerations#

If running MT5 on a VPS:

  • Windows VPS - Works the same as local
  • Choose low-latency VPS - Closer to your broker
  • Keep MT5 running 24/7 - Don't close the terminal
  • Set the Connection Profile to VPS - On an always-on server, switch this EA input from LOCAL to VPS so the EA detects and recovers from a dropped connection faster. Leave it on LOCAL for a home computer, laptop, or Wi-Fi connection.

Reconnection Behavior#

The EA automatically reconnects when disconnected:

  • First retry: near-immediate (within about half a second)
  • Subsequent retries: escalating backoff with jitter (roughly 1s, then 2s, 5s, 10s, up to a 15s ceiling)
  • Maximum retries: Unlimited (keeps trying)

During disconnection:

  • Signals queue on the PineHook server
  • On reconnect, the server replays only signals newer than your Signal Expiry Window (an EA setting; default 15 minutes, selectable 5, 15, 30, or 60). Signals older than that window are skipped instead of filled late, so a stale price never triggers an unexpected entry.

Position mismatch alerts#

If you change a position outside PineHook (closing or adding contracts manually, or while the EA is offline), you may see a one-time Position mismatch / Volume mismatch alert in the MT5 Experts tab. This is expected and self-heals: PineHook raises the alert once, then recalibrates its expected position to match what your EA reports (MetaTrader is authoritative). It does not repeat every heartbeat, and you don't need to acknowledge anything.

Only investigate if fresh mismatch alerts keep appearing on every heartbeat, which points to an ongoing divergence, the EA being disconnected, or the broker repeatedly changing the position.

Still Having Issues?#

  1. Restart MT5 completely - File → Exit, reopen
  2. Remove and re-attach EA - Fresh start
  3. Check MT5 Experts log - Detailed error messages
  4. Try a demo account - Rule out broker issues
  5. Contact support - Include error messages

Next Steps#