metatrader5

n8n community node for MetaTrader 5 integration

Package Information

Downloads: 4 weekly / 51 monthly
Latest Version: 0.5.8
Author: Kevin Reyes

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 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 14 resource categories and 43+ 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

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

Discussion