ohlcv-metatrader

n8n node to fetch OHLCV data from crypto exchanges and MetaTrader (forex/commodities like Gold XAU/USD)

Package Information

Downloads: 2 weekly / 82 monthly
Latest Version: 1.0.0
Author: hakmeh70

Documentation

n8n-nodes-ohlcv-metatrader

npm version
License: MIT

This is an n8n community node that lets you fetch OHLCV (Open, High, Low, Close, Volume) data from:

  • Cryptocurrency Exchanges (Binance, Bybit, Kraken, OKX, etc.)
  • MetaTrader (Forex, Commodities like Gold/Silver, Indices)

Perfect for algorithmic trading, technical analysis, and market data workflows!

Features

🪙 Cryptocurrency Support

  • 7+ major exchanges (Binance, Bybit, Kraken, KuCoin, MEXC, OKX, Gate.io)
  • Spot and Futures trading modes
  • 1000+ trading pairs
  • Real-time and historical data

💰 Commodities & Forex Support (MetaTrader)

  • Precious Metals: Gold (XAUUSD), Silver (XAGUSD), Platinum, Palladium
  • Energy: Crude Oil (WTI), Brent Oil, Natural Gas
  • Forex: All major pairs (EURUSD, GBPUSD, USDJPY, etc.)
  • Indices: US30, S&P500, Nasdaq, DAX, FTSE
  • Custom symbol support

⚙️ Connection Methods

  • Crypto: Direct API via CCXT library
  • MetaTrader: MetaAPI.cloud (recommended) or Custom REST API

📊 Timeframes

  • 1m, 3m, 5m, 15m, 30m
  • 1h, 2h, 4h, 6h, 8h, 12h
  • 1d, 3d, 1w, 1M

Installation

In n8n (Docker)

  1. Option A: Using npm install command in n8n

    docker exec -u node <your-n8n-container> npm install n8n-nodes-ohlcv-metatrader -g --prefix /usr/local/lib/node_modules
    

    Replace <your-n8n-container> with your container name.

  2. Option B: Install via n8n Settings (if using community nodes)

    • Go to SettingsCommunity Nodes
    • Click Install
    • Enter: n8n-nodes-ohlcv-metatrader
    • Click Install
  3. Option C: Local package installation

    # Copy package into container
    docker cp ./n8n-nodes-ohlcv-metatrader <container>:/tmp/
    
    # Install from local directory
    docker exec -u node <container> sh -c "cd ~/.n8n/nodes && npm install /tmp/n8n-nodes-ohlcv-metatrader"
    
  4. Restart n8n

    docker restart <your-n8n-container>
    

In n8n (Native/Self-hosted)

cd ~/.n8n/nodes
npm install n8n-nodes-ohlcv-metatrader

Restart n8n.

Usage

Example 1: Fetch Bitcoin Price from Binance

Data Source: Crypto Exchange
Exchange: Binance
Mode: Spot
Symbol: BTC/USDT
Timeframe: 1h
Limit: 50

Example 2: Fetch Gold Price from MetaTrader

Data Source: MetaTrader (Forex/Commodities)
Platform: MetaTrader 5
Connection Type: MetaAPI (Cloud)
MetaAPI Token: your-token-here
Account ID: your-account-id
Symbol: Gold (XAU/USD)
Timeframe: 1h
Limit: 100

Example 3: Fetch EUR/USD Forex Pair

Data Source: MetaTrader
Symbol: EUR/USD
Timeframe: 15m
Limit: 200

MetaAPI Setup

For MetaTrader data, we recommend using MetaAPI.cloud:

  1. Sign up at metaapi.cloud (free tier available)
  2. Add your MT4/MT5 account
  3. Copy your Auth Token and Account ID
  4. Use them in the n8n node

Free Tier: 1 account, historical data access, real-time streaming.

Output Format

Returns OHLCV data in a standardized format:

{
  "dataSource": "metatrader",
  "symbol": "XAUUSD",
  "timeframe": "1h",
  "count": 50,
  "data": [
    [2045.50, 2048.75, 2044.20, 2047.30, 1250, 1704711600000],
    [2047.30, 2050.10, 2046.80, 2049.50, 1340, 1704715200000]
  ],
  "metadata": {
    "platform": "mt5",
    "fetchTimestamp": "2025-01-08T12:00:00.000Z"
  }
}

Each candle: [Open, High, Low, Close, Volume, Timestamp]

Workflow Ideas

Gold Trading Bot

Get OHLCV (Gold)
  → Technical Indicators (RSI, MACD, Bollinger Bands)
  → Candlestick Pattern Detector
  → Support/Resistance Levels
  → Trading Strategy
  → Execute Trade

Multi-Asset Monitoring

Get OHLCV (Gold) ─┐
Get OHLCV (Oil)  ─┼→ Merge → Analysis → Alert
Get OHLCV (BTC)  ─┘

Forex Correlation Analysis

Get OHLCV (EURUSD)  ─┐
Get OHLCV (GBPUSD)   ├→ Correlation Analysis → Dashboard
Get OHLCV (USDJPY)  ─┘

Compatibility

  • n8n version: 0.200.0+
  • Node.js: 18.0.0+
  • Compatible with Docker, native installations, and n8n cloud

Nodes Included

  • Get OHLCV (Crypto + MetaTrader): Fetch OHLCV data from crypto exchanges or MetaTrader

Dependencies

  • ccxt: ^4.5.17 (cryptocurrency exchange API)
  • Built-in Node.js modules for MetaTrader API calls

Troubleshooting

MetaAPI "Symbol not found"

Different brokers use different symbol names:

  • Gold: XAUUSD, XAUUSD., GOLD
  • Oil: XTIUSD, USOIL, WTI

Use the "Custom Symbol" option to enter your broker's exact symbol name.

Container restart loses changes

If installing manually in Docker, use volume mounts or rebuild the container. See Docker Deployment Guide.

Support

License

MIT

Contributing

Contributions are welcome! Please open an issue or pull request.

Credits

  • Built for the n8n community
  • Uses CCXT for cryptocurrency data
  • Integrates with MetaAPI for forex/commodities

Keywords

n8n, trading, forex, commodities, gold, silver, oil, cryptocurrency, bitcoin, OHLCV, candlestick, technical-analysis, metatrader, mt4, mt5, binance, bybit, kraken

Discussion