Connect MetaTrader 5

Install the PineHook Expert Advisor in MetaTrader 5, attach it to a chart, enter the license credentials, and verify the first broker connection.

Last updated: 2026-10-20

Follow these steps to connect TradingView alerts to your MT5 terminal.

Still choosing between platforms? Our cTrader vs MT5 comparison covers setup, hosting, and timing for TradingView alerts.

PineHook is independent of TradingView and MetaQuotes. Their names describe the platforms used in this setup, not a partnership.

Using cTrader?

cTrader has nothing to install. Follow the cTrader connection guide instead.

What you need#

  • MetaTrader 5 build 2000+ on Windows 8.1/10/11
  • A paid TradingView subscription with access to webhook alerts
  • A broker or prop-firm MT5 account. Demo, live, challenge, and funded accounts are supported.
  • Permission to use automated trading on that account.
  • Stable internet connection

Before you install the EA, check the account mode, the broker's exact symbol names, and its minimum volume and volume step. Make sure the market will be open when you send the test trade. Start on demo when possible.

Step 1: Create your account#

  1. Go to pinehook.io and click Get Started.
  2. Choose a plan.
  3. Enter your email and create a password.
  4. Verify your email address.
  5. Log in to your dashboard.

Step 2: Get your license key#

  1. Open Licenses in the dashboard sidebar.
  2. Click + New License.
  3. Under Platform, choose MetaTrader 5. A cTrader license cannot connect to the MT5 EA.
  4. Give the license a name, such as "My Trading PC", "VPS Server", or "Demo Account". The name is optional.
  5. Click Create License, then copy the license key.
  6. To add a Secret Key, open the new license's three-dot menu and click Set Secret Key. This is optional.

Protect the EA connection

A Secret Key prevents anyone who sees your License ID from connecting their own EA to your PineHook subscription. Keep it secure and never include it in webhook messages. It belongs only in your EA settings.

Step 3: Download and install the bundle#

Open your Downloads page and click Download bundle. The ZIP contains PineHook.ex5 and PineHook.dll in an MQL5/ folder.

Verify the bundle before installing (Optional)

Before extracting the ZIP, use Verified via GitHub on the Downloads page to open its release. If the hash is unavailable, use Verify manually on GitHub instead. In that release's SHA256SUMS asset, find the entry for the ZIP you downloaded. Run the command for your system in the folder containing the ZIP, replacing your-bundle.zip with its filename:

  • Windows PowerShell: Get-FileHash -Algorithm SHA256 .\your-bundle.zip
  • macOS: shasum -a 256 your-bundle.zip
  • Linux: sha256sum your-bundle.zip

Compare the full hash from your command with the GitHub entry for the same ZIP. You can also copy the full hash from the Downloads page. If any value differs, do not extract or install the bundle. Download it again, and contact support@pinehook.io if the mismatch continues. Matching hashes confirm that your ZIP matches the checksum published with that release; they cannot establish whether the publishing account itself was compromised.

Install in MT5#

  1. In MetaTrader, go to File → Open Data Folder. This opens your terminal's data folder in your system's file explorer.

  2. Install the bundle using one of these two options:

    Option A: drag the MQL5 folder. Open the ZIP, then drag the MQL5 folder from inside the ZIP into the data folder window. When Windows asks whether to merge folders, choose Yes / Replace / Merge. Both files land in the correct places at once.

    Option B: place each file by hand. Extract the ZIP anywhere, then copy the two files individually:

    FileDestination
    PineHook.ex5MQL5/Experts/
    PineHook.dllMQL5/Libraries/

    Both files are inside the ZIP at the matching path (MQL5/Experts/PineHook.ex5 and MQL5/Libraries/PineHook.dll).

  3. Restart MetaTrader or right-click the Navigator panel and select Refresh.

Installation Directory Structure

MT5 Data Folder
MQL5
Experts
PineHook.ex5REQUIRED

Main EA executable - copy this file here

Libraries
PineHook.dllREQUIRED

Secure WebSocket library - copy this file here

Include
Scripts
Profiles
Logs

How to find your MT5 Data Folder:

  1. Open MetaTrader 5
  2. Go to File → Open Data Folder
  3. This will open the directory in your file explorer

After copying the files, restart MT5 or refresh the Navigator panel (right-click → Refresh) to see the EA.

Don't rename PineHook.dll

The EA imports the WebSocket library by the exact filename PineHook.dll. If you rename it (for example by adding a version number), the EA will fail to load with error 126 at startup. The ZIP always contains the file with the correct name, so just leave it alone.

After restarting MT5, look for PineHook under Navigator > Expert Advisors.

To use several MT5 terminals, install the bundle in each terminal and give each one a separate license.

Step 4: Configure MT5#

Open Tools → Options and select the Experts tab, labelled Expert Advisors in older MT5 builds, then enable the required permissions:

  • Allow algorithmic trading is required for trade execution.
  • Allow DLL imports is required for WebSocket connectivity.

Click OK, then click the Algo Trading button in the toolbar until it turns green.

Both permissions are required

Without both settings enabled and Algo Trading active, the EA cannot connect or execute trades.

Step 5: Configure the EA#

  1. Open any chart in MT5.
  2. Drag PineHook from Navigator → Expert Advisors onto a chart. The EA only needs to be on one chart to receive alerts for all symbols.
  3. In the Inputs tab:
    • License Key: paste the key from Step 2. This is required.
    • Secret Key: paste it here if you set one. Otherwise, leave it blank.
    • Review the remaining settings and configure them to your preferences.

Inputs shown before entering the License Key or optional Secret Key.

  1. Switch to the Common tab and enable Allow live trading.
  2. Switch to the Dependencies tab and enable Allow DLL Imports.
  3. Click OK.

The EA icon should appear in blue in the chart's top-right corner when connected. To reopen the Inputs window later, double-click the blue EA icon (the small "hat") in the chart's top-right corner (the icon next to the name, not the name text), or right-click the chart → Expert List, select PineHook, and click Properties.

Use one chart per account

A single chart handles every symbol for your broker, so attach PineHook to one chart only. Don't add it to a second chart on the same MT5 account: a license allows one live connection per account, so the newest chart takes over and the older one disconnects. When that happens, the disconnected instance prints a note in the Experts tab explaining that the license is already connected and that one chart covers all symbols.

Alert parameters override stored defaults. If the EA has a default lot size of 0.1 but the alert specifies size_lots=0.05, the trade uses 0.05 lots. See Trading settings for the full reference.

Step 6: Set up a TradingView alert#

Your MT5 connection is ready. Continue with the TradingView integration guide to configure the webhook, write the message, and test the alert. For alerts generated by a Pine strategy, see Strategy alerts.

Troubleshooting#

Connection issues:

  • Verify your license key and secret key are entered correctly.
  • Confirm Allow DLL imports is enabled on the Experts tab of Tools > Options and in the PineHook EA's own Dependencies tab. Allow DLL imports in MT5 explains each DLL error message.
  • Check that MT5 has internet access.
  • Review error messages in the Experts tab.
  • On a restricted network, ask your network administrator to review MT5 (terminal64.exe) outbound access to relay.pinehook.io on port 443.

Alerts not arriving:

  • Check that your TradingView alert is active and not paused.
  • Review TradingView's Alert Log and confirm it's sending to the correct license ID.
  • Verify the webhook URL: https://relay.pinehook.io/webhook
  • Check your alert logs in the PineHook dashboard.
  • Confirm your TradingView plan supports webhooks.

Trades not executing:

  • Enable "Allow algorithmic trading" in MT5.
  • Check that the Algo Trading toolbar button is green.
  • Verify sufficient margin is available.
  • Confirm the symbol exists on your broker.

Keep going#