metatrader5

n8n community node for MetaTrader 5 integration

Package Information

Released: 11/18/2025
Downloads: 19 weekly / 205 monthly
Latest Version: 0.5.6

Documentation

n8n-nodes-metatrader5

This is an n8n community node. It lets you use MetaTrader 5 in your n8n workflows.

MetaTrader 5 is a multi-asset platform for trading forex, stocks, futures, and CFDs.

n8n is a fair-code licensed workflow automation platform.

Installation

Recommended: GitHub Packages (Private npm)

The easiest way to install and keep this node updated is via GitHub Packages. This method provides:

  • ✅ Easy installation with npm
  • ✅ Automatic updates with npm update
  • ✅ Version management
  • ✅ Works with Docker and non-Docker n8n

See the complete guide: GITHUB_PACKAGES_INSTALL.md

Quick install (after setup):

npm install -g @who/n8n-nodes-metatrader5

Alternative: Local Development/Testing

This project includes a Docker setup for local development and testing. See DEPLOYMENT.md for the complete guide on:

  • Building the TypeScript code
  • Deploying to Docker
  • Testing and debugging
  • Quick rebuild commands

Quick deploy command:

npm run build; Copy-Item -Path ".\dist\nodes" -Destination ".\n8n-docker\custom_nodes\" -Recurse -Force; Copy-Item -Path ".\dist\credentials" -Destination ".\n8n-docker\custom_nodes\" -Recurse -Force; cd n8n-docker; docker-compose restart; cd ..

For n8n Cloud

n8n Cloud does not support custom community nodes that are not published to the public npm registry. You must use a self-hosted n8n instance to use this node.

Operations

The MetaTrader 5 node provides comprehensive access to the MetaTrader 5 WebAPI with 15 resource categories and 52+ operations.

User Account Management

  • Create User: Create a new user account with full profile information and password validation
  • Get User: Get user information by login
  • Get Users Batch: Get information about multiple users by logins or groups
  • Update User: Update user account information with structured required/optional fields
  • Delete User: Delete a user account
  • Get User by External ID: Get user by external trading system account
  • Get User Group: Get user group by login
  • Get Total Users: Get total number of users on the server
  • Sync External: Synchronize with external trading system
  • Check Balance: Check and correct user balance
  • Add to Archive: Move user to archive database

Client Management

  • Create Client: Create a new client record with personal/contact information
  • Get Client: Retrieve client information by ID or multiple IDs
  • Update Client: Update existing client information
  • Delete Client: Delete a client record
  • Get Client IDs: Get list of all client IDs (optionally filtered by trading group)

Account Binding

  • Bind Account: Bind a trading account to a client record
  • Unbind Account: Remove the binding between a trading account and client
  • Get Bound Accounts: Get all trading accounts bound to a specific client

Trading Account

  • Get Account Info: Get trading account information
  • Get Accounts Batch: Get multiple trading accounts info
  • Get Account Logins: Get accounts in specified groups
  • Deposit: Add funds to a trading account
  • Withdrawal: Remove funds from a trading account

Symbols

  • Get Symbol List: Get list of all available trading symbols
  • Get Symbol Total: Get total number of symbols on the server
  • Get Symbol: Get detailed information about a specific symbol or symbols matching a pattern

Prices

  • Get Current Price: Get current bid/ask prices for a symbol
  • Get Price Stats: Get daily price statistics for a symbol
  • Get Tick History: Get historical tick data with customizable data fields (date, bid, ask, last, volume)

Password Management

  • Check Password: Check user password with validation
  • Change Password: Change user password (main/investor/phone) with comprehensive validation

Certificate Management

  • Update Certificate: Add or update user certificate
  • Get Certificate: Get user certificate
  • Delete Certificate: Delete user certificate
  • Confirm Certificate: Confirm user certificate

OTP (One-Time Password)

  • Get OTP Secret: Get OTP secret key
  • Set OTP Secret: Set OTP secret key

Archive Management

  • Get from Archive: Get user from archive database
  • Get Archive Batch: Get multiple users from archive
  • Restore from Archive: Restore users from archive

Backup Management

  • List Backups: Get backup creation dates
  • Get from Backup: Get user from specific backup

Notification

  • Send Notification: Send push notifications to MetaQuotes IDs

Orders

  • Get Order: Get an open order by ticket
  • Get Order Total: Get the total number of a client's open orders
  • Get Order Page: Get open orders by login with pagination
  • Get Order Batch: Get multiple open orders by logins, tickets or groups
  • Update Order: Change an open order on the server
  • Delete Order: Delete one or more open orders by ticket numbers
  • Cancel Order: Move one or several open orders to history
  • Get History Order: Get an order from history by its ticket
  • Get History Total: Get the number of orders in history within time range
  • Get History Page: Get a client's order history with pagination
  • Get History Batch: Get multiple closed orders by logins, tickets or groups
  • Update History Order: Change a closed order on the server
  • Delete History Order: Delete one or more closed orders by ticket numbers
  • List Order Backups: Get order backup creation dates within time range
  • Get Order from Backup: Get information about orders from a specific backup
  • Restore Order from Backup: Recover an order from a backup
  • Reopen Order: Reopen a pending order from account history

Positions

  • Get Position: Get a client's position by symbol name
  • Get Position Total: Get the total number of a client's open positions
  • Get Position Page: Get positions by login with pagination
  • Get Position Batch: Get multiple positions by logins, tickets or groups
  • Delete Position: Delete one or more positions by ticket numbers
  • Check Positions: Check correctness of account positions based on deal history
  • Fix Positions: Correct account positions based on deal history

Deals

  • Get Deal: Get a deal by ticket
  • Get Deal Total: Get the total number of deals within time range
  • Get Deal Page: Get deals by login with pagination
  • Get Deal Batch: Get multiple deals by logins, tickets or groups
  • Update Deal: Change a deal on the server
  • Delete Deal: Delete one or more deals by ticket numbers
  • List Deal Backups: Get deal backup creation dates within time range
  • Get Deal from Backup: Get information about deals from a specific backup
  • Restore Deal from Backup: Recover a deal from a backup

Features

Data Formatting

  • Simplify Parameter: Toggle between simplified table format (field names as columns) and raw API response
  • Field Filtering: System fields are automatically filtered for cleaner data presentation
  • Array Flattening: Nested arrays are flattened for better table display

Dynamic Selectors

  • Group Dropdown: Dynamic loading of trading groups from MT5 server with 5-minute caching
  • Smart Caching: Reduces API calls while keeping data fresh

Validation

  • Password Validation: Comprehensive password requirements (8-16 chars, uppercase, lowercase, numbers, special chars)
  • Input Validation: Amount limits, required field checks, and helpful error messages

Performance

  • Connection Pooling: HTTPS agent reuse for better performance
  • Caching: 5-minute in-memory cache for frequently accessed data like groups
  • Efficient API Calls: Optimized requests with proper error handling

Credentials

You need to set up MetaTrader 5 API credentials:

  • Server: Your MetaTrader 5 server address (e.g., 185.97.161.179:443)
  • Login: Account login number
  • Password: Account password

Compatibility

  • Minimum n8n version: 1.0.0
  • Tested with n8n versions: 1.0.0+
  • MetaTrader 5 WebAPI compatible

Usage

  1. Install the node package
  2. Set up your MetaTrader 5 credentials in n8n
  3. Use the MetaTrader 5 node in your workflows
  4. Select the appropriate resource and operation
  5. Configure parameters and execute

Resources

Version history

  • 0.1.0: Initial release with basic account, order, and position operations
  • 0.2.0: Added MetaTrader 5 Client node for comprehensive client management and account binding operations
  • 0.3.0: Added MetaTrader 5 User node for complete user account management, including passwords, certificates, OTP, archives, backups, and notifications
  • 0.4.0: Major Update - Consolidated all functionality into single MetaTrader5 node with 14 resources
    • Added Symbols and Prices resources for market data access
    • Implemented dynamic group selector with caching
    • Added comprehensive password validation
    • Added deposit/withdrawal operations for Trading Account
    • Improved data formatting with Simplify parameter
    • Enhanced error handling and user experience
  • 0.4.5: Enhanced Trading Operations
    • Added Deals resource with 9 operations for complete deal history management
    • Added complete parameter definitions for all 18 Orders operations (previously missing input fields)
    • Added 16 parameter fields for Orders: ticket, login, dates, pagination, batch operations, backups
    • Implemented deal data simplification (11 key fields)
    • Added support for order and deal backup/restore operations
    • Total: 15 resources with 52+ operations

Discussion