TOKYO --:--
LONDON --:--
FRANKFURT --:--
NEW YORK --:--
LOCAL --:--
HIGH IMPACT NEWS
Loading...

MT5 CANDLE DATA API

SECURE

MetaTrader 5 — Real-Time & Historical OHLCV Data

Fetch Candles
N8N Link Generator
Python Guide
Trading Use Cases
Quick Docs
Startup Guide
Econ Calendar
Commodity Futures
Settings
Request Parameters
N8N HTTP Request Node — Step-by-Step Setup

Follow these exact steps to configure N8N to fetch candle data from the MT5 API.

Step 1 — Add HTTP Request Node
In your N8N workflow, click the + button and search for HTTP Request. Click to add it.
Step 2 — Set HTTP Method
In the HTTP Request node, set Method to GET
Step 3 — Paste the URL
In N8N, find the URL field in the HTTP Request node. Paste this URL:
Step 4 — Add the API Key Header
In the HTTP Request node, scroll to "Headers" and add one row:
Name: X-API-Key
Value: 43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk
N8N UI path: HTTP Request node → Options tab → Specify Headers → Add row → Name: X-API-Key, Value: 43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk
Step 5 — Test the Node
Click the Test Step button (or Test Workflow). You should see JSON output with candle data. The data is in $json.candles — access it with {{ $json.candles }} in subsequent nodes.
Using Candle Data in N8N
Response Structure:
{
  "symbol": "EURUSDm",
  "timeframe": "H1",
  "count": 5,
  "candles": [
    { "time": "2026-03-27T00:00:00", "open": 1.15, "high": 1.16,
      "low": 1.14, "close": 1.155, "tick_volume": 1234 },
    ...
  ]
}
Access candle data in subsequent nodes:
  • {{ $json.symbol }} — Symbol name
  • {{ $json.candles[0].close }} — Latest candle close price
  • {{ $json.candles[0].high }} — Latest candle high
  • {{ $json.candles[0].tick_volume }} — Latest tick volume
  • {{ $json.count }} — Number of candles returned
Complete Daily Alert Workflow

Example N8N workflow that fetches H4 candles and sends a summary to Telegram every morning:

Workflow:
1. Cron Trigger → Daily at 08:00
2. HTTP Request
   Method: GET
   URL: https://mt5api.invoker4916.io.vn/api/v1/candles?symbol=XAUUSDm&timeframe=H4&count=5
   Headers: X-API-Key = 43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk
3. Code Node (JavaScript):
   const candles = $input.first().json.candles;
   const latest = candles[0];
   const trend = latest.close > latest.open ? "UP 📈" : "DOWN 📉";
   return { json: {
     symbol: "XAUUSD",
     close: latest.close,
     high: latest.high,
     low: latest.low,
     trend,
     time: latest.time
   }};
4. Telegram Node:
   Message: "{{ $json.trend }} XAUUSD | Close: {{ $json.close }} | H4 candle at {{ $json.time }}"
Step 1 — Install Dependencies
pip install requests pandas
Step 2 — Fetch Candles with Your API URL
Replace the URL below with your own. Get candle data in 3 lines:
import requests

url = "https://mt5api.invoker4916.io.vn/api/v1/candles?symbol=EURUSDm&timeframe=M15&count=100"

response = requests.get(url, headers={
    "X-API-Key": "43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk"
})

data = response.json()
print(f"Loaded {data['count']} candles from {data['from_dt']} to {data['to_dt']}")
print(data["candles"][0])
Build Your API URL
url = "https://mt5api.invoker4916.io.vn/api/v1/candles?symbol=EURUSDm&timeframe=M15&count=100"
Step 3 — Pandas Data Analysis
Convert candles to a DataFrame and compute indicators:
import requests
import pandas as pd

url = "https://mt5api.invoker4916.io.vn/api/v1/candles?symbol=EURUSDm&timeframe=H1&count=500"
headers = {"X-API-Key": "43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk"}

data = requests.get(url, headers=headers).json()
df = pd.DataFrame(data["candles"])
df["time"] = pd.to_datetime(df["time"])
df = df.iloc[::-1].reset_index(drop=True)  # oldest first

# Simple Moving Averages
df["sma20"] = df["close"].rolling(20).mean()
df["sma50"] = df["close"].rolling(50).mean()

# RSI
delta = df["close"].diff()
gain = delta.where(delta > 0, 0).rolling(14).mean()
loss = (-delta.where(delta < 0, 0)).rolling(14).mean()
df["rsi"] = 100 - (100 / (1 + gain / loss))

# Latest values
latest = df.iloc[-1]
print(f"{latest['time'].date()} | Close: {latest['close']:.5f} | RSI: {latest['rsi']:.1f}")
print(f"SMA20: {latest['sma20']:.5f} | SMA50: {latest['sma50']:.5f}")

# Golden cross signal
if latest["sma20"] > latest["sma50"]:
    print('>>> GOLDEN CROSS — BUY signal')
elif latest["sma20"] < latest["sma50"]:
    print('>>> DEATH CROSS — SELL signal')
Step 4 — Real-time Streaming (SSE)
Receive live candle updates the moment they close:
pip install sseclient-py

import sseclient, requests, json

url = "https://mt5api.invoker4916.io.vn/api/v1/subscribe"
params = {"symbol": "XAUUSDm", "timeframe": "M1", "api_key": "43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk"}

resp = requests.get(url, params=params,
    headers={"Accept": "text/event-stream"}, stream=True)

client = sseclient.SSEClient(resp)
for event in client.events():
    msg = json.loads(event.data)
    if msg["type"] == "snapshot":
        print(f"Loaded {len(msg['candles'])} historical candles")
    elif msg["type"] == "candle":
        c = msg["data"]
        print(f"{c['time']} | Close: {c['close']} | Vol: {c['tick_volume']}")
How to Start This System

Run these commands in order after VPS restart or shutdown.

Step 1 — Set MT5 Credentials
Edit the .env file and add your MT5 login ID and password:
# Open this file:
# C:\Users\Administrator\Desktop\ClaudeCode-API-MT5\.env

MT5_API_KEY=43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk
MT5_USERNAME=YOUR_MT5_LOGIN_ID      ← Find in MT5: File → Login to Trade Account
MT5_PASSWORD=YOUR_MT5_PASSWORD      ← Your MT5 account password
WEB_USERNAME=admin
WEB_PASSWORD=admin123       ← Web login page password (change after first login)
Step 2 — Launch MT5
start "" "C:\Users\Administrator\Desktop\Exness\terminal64.exe"
Step 3 — Start API Server
cd C:\Users\Administrator\Desktop\ClaudeCode-API-MT5
"C:\Program Files\Python312\python.exe" mt5_server.py --port 8000 --reload
Step 4 — Start Nginx (if not running)
cd C:\nginx
nginx.exe
Step 5 — Verify
curl -H "X-API-Key: 43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk" https://mt5api.invoker4916.io.vn/api/v1/health
Expected: {"status":"ok","mt5_connected":true,...}
Restart Order
MT5 → API Server → Nginx. If Nginx is already running, use nginx.exe -s reload instead of starting fresh.
Web Login Page
Access the API playground at https://mt5api.invoker4916.io.vn. You will be redirected to the login page. Default credentials:
Username: admin
Password: admin123
After logging in, go to the Settings tab to change your passwords. See the Settings tab for how to change passwords manually via the .env file.
More details:
API Docs · Full Guide (README.md) · Startup Notes (StartUp.md)
Quant / Backtesting — Python
Fetch 10,000 M15 candles and compute RSI + Bollinger Bands:
import requests
import pandas as pd

resp = requests.get(
    "https://mt5api.invoker4916.io.vn/api/v1/candles",
    params={"symbol": "EURUSDm", "timeframe": "M15", "count": 10000},
    headers={"X-API-Key": "43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk"}
)
df = pd.DataFrame(resp.json()["candles"])
df["time"] = pd.to_datetime(df["time"])
df = df.iloc[::-1].reset_index(drop=True)  # oldest first

# RSI
delta = df["close"].diff()
gain = delta.where(delta > 0, 0).rolling(14).mean()
loss = (-delta.where(delta < 0, 0)).rolling(14).mean()
df["rsi"] = 100 - (100 / (1 + gain / loss))

# Bollinger Bands
df["sma20"] = df["close"].rolling(20).mean()
df["bb_lower"] = df["sma20"] - 2 * df["close"].rolling(20).std()
df["signal"] = (df["rsi"] < 30) & (df["close"] < df["bb_lower"])

print("Entry signals:", df[df["signal"]].shape[0])
HFT / Scalping — Real-time SSE Stream
Receive live M1 candle closes for Gold scalping with pin bar detection:
import sseclient, requests, json

resp = requests.get(
    "https://mt5api.invoker4916.io.vn/api/v1/subscribe",
    params={"symbol": "XAUUSDm", "timeframe": "M1", "api_key": "43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk"},
    headers={"Accept": "text/event-stream"}, stream=True
)
client = sseclient.SSEClient(resp)
for event in client.events():
    msg = json.loads(event.data)
    if msg["type"] == "candle":
        c = msg["data"]
        o, h, l, cl = c.get("open"), c.get("high"), c.get("low"), c.get("close")
        body = abs(cl - o)
        lower_wick = min(o, cl) - l
        upper_wick = h - max(o, cl)
        # Pin bar: lower wick > 2x body, tiny upper wick
        if lower_wick > body * 2 and upper_wick < body * 0.5:
            print('>>> BULLISH PIN BAR at', c.get('time'), '| Close:', cl)
        else:
            print('Close:', cl, '| Vol:', c.get('tick_volume'))
N8N — Daily Morning Alert to Telegram
Every morning at 08:00, fetch H4 candles and send a trend summary to Telegram:
# N8N Workflow:
# 1. Schedule Trigger → Daily at 08:00
# 2. HTTP Request
#    GET /api/v1/candles?symbol=XAUUSDm&timeframe=H4&count=5
#    Header: X-API-Key = 43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk
# 3. Code (JS):
#    const candles = $json.candles;
#    const closes = candles.map(c => c.close);
#    const avg = (closes.reduce((a,b) => a+b, 0) / closes.length).toFixed(2);
#    const latest = closes[closes.length-1];
#    return { latest, avg, signal: latest > avg ? "BUY" : "SELL" };
# 4. Telegram Node:
#    Message: "{{ $json.signal }} signal | XAUUSD H4 close: {{ $json.latest }}"
N8N — Real-time Discord Alert on Candle Pattern
Alert to Discord when XAUUSD M5 closes with a bullish engulfing candle:
# N8N Workflow:
# 1. Wait (Webhook) — receives manual /push trigger
# 2. HTTP Request
#    GET /api/v1/candles?symbol=XAUUSDm&timeframe=M5&count=2&source=mql5
#    Header: X-API-Key = 43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk
# 3. Code (JS) — detect engulfing:
const candles = $input.first().json.candles;
const prev = candles[1], curr = candles[0];
const body = Math.abs(curr.close - curr.open);
const prevBody = Math.abs(prev.close - prev.open);
const engulfing = curr.close > prev.open && curr.open < prev.close
  && body > prevBody;

if (engulfing) {
  return { json: { alert: "BULLISH ENGULFING", close: curr.close } };
}
# 4. Discord Node → Post: {{ $json.alert }} at {{ $json.close }}
Multi-Timeframe Strategy (H4 Trend + M15 Entry)
D1 sets trend direction (200 SMA), M15 triggers entries (RSI). Full Python example:
import requests

API_KEY = "43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk"
BASE = "https://mt5api.invoker4916.io.vn/api/v1/candles"

def get_candles(symbol, tf, count=200):
    r = requests.get(BASE, params={"symbol": symbol, "timeframe": tf, "count": count},
                      headers={"X-API-Key": API_KEY})
    return r.json()["candles"]

def sma(closes, period):
    return sum(closes[-period:]) / period

def rsi(closes, period=14):
    deltas = [closes[i] - closes[i-1] for i in range(1, len(closes))]
    gain = sum([d for d in deltas[-period:] if d > 0]) / period
    loss = abs(sum([d for d in deltas[-period:] if d < 0]) / period)
    return 100 - (100 / (1 + gain / loss)) if loss != 0 else 50

# Step 1: D1 trend (200 SMA)
d1 = get_candles("EURUSDm", "D1", 200)
d1_closes = [c["close"] for c in reversed(d1)]
trend_up = d1_closes[-1] > sma(d1_closes, 200)

# Step 2: M15 entry (RSI)
m15 = get_candles("EURUSDm", "M15", 100)
m15_closes = [c["close"] for c in reversed(m15)]
r = rsi(m15_closes)

# Signal
if trend_up and r < 40:
    print('LONG — D1 up, RSI=', round(r, 1))
elif not trend_up and r > 60:
    print('SHORT — D1 down, RSI=', round(r, 1))
else:
    print('No signal')
All Endpoints
GET/api/v1/healthMT5 + watcher status. Use in uptime monitors
GET/api/v1/connectForce MT5 reconnect after terminal restart
GET/api/v1/symbolsList all 348 tradeable symbols
GET/api/v1/timeframesM1–MN1 supported timeframes
GET/api/v1/candlesFetch OHLCV (max 10,000). Core endpoint
GET/api/v1/pushForce MQL5 EA to push latest candles
GET/api/v1/subscribeSSE stream — live tick-by-tick data
GET/api/v1/calendarEconomic calendar — ?currency=USD&impact=High&tz=GMT&days=7
GET/api/v1/calendar/subscribeSSE stream — high-impact economic event alerts
/candles — Query Parameters
symbolEURUSDm, XAUUSDm, BTCUSDm, US500m...
timeframeM1 M5 M15 H1 H4 D1 W1 MN1
count1–10,000 candles
sourcemt5 (historical, default) or mql5 (live)
Authentication — Required on Every Request

Header: X-API-Key: 43zr7RvLh7ZEZCw6cWHsZgbHc2tqW5OSAvfjpnPrqqk
SSE subscribe uses query param instead: ?api_key=YOUR_KEY (browsers block custom headers on EventSource)

Candle Response Format
{
  "symbol": "EURUSDm",
  "timeframe": "M15",
  "count": 5,
  "from_dt": "2026-03-27T03:00:00",
  "to_dt": "2026-03-27T03:56:00",
  "candles": [
    { "time": "2026-03-27T03:00:00",
      "open": 1.15337, "high": 1.15352,
      "low": 1.15325, "close": 1.15347,
      "tick_volume": 99 },
    ...
  ],
  "source": "mt5"
}
Commodity Futures Barchart OnDemand via TradingCharts
Symbol Name Price 1D% 3D% 1W% 10D% Volume OI Unit Sector
Economic Calendar — Forex Factory

Upcoming economic events from Forex Factory. Works 24/7 including weekends. Data is cached for 30 minutes.

Click "Fetch Events" to load the calendar.
Live Alerts — SSE Stream

Connect to real-time SSE stream for high-impact event notifications.

Quant API Reference

Fetch all high-impact USD events for the next 14 days in London time:

import requests, pandas as pd

resp = requests.get(
    "https://mt5api.invoker4916.io.vn/api/v1/calendar",
    params={
        "currency": "USD",
        "impact":   "High",
        "tz":       "GMT",
        "days":     14
    },
    headers={"X-API-Key": "YOUR_KEY"}
)

cal = pd.DataFrame(resp.json()["events"])
cal["time"] = pd.to_datetime(cal["time"])
# Align with your candle timestamps
upcoming = cal[cal["time"] > pd.Timestamp.now()]

# Count high-impact events this week
high_count = len(upcoming[upcoming["impact"] == "High"])

Timezone options: EST5EDT (New York), GMT (London), local (server time) | Days: 1-30 | Filters: currency, impact | Force refresh: ?refresh=true

N8N Calendar Link Generator
Profile
🤖

Upload a profile avatar (JPG, PNG, GIF, WebP)

MT5 Terminal Control
Checking...
|
—
Credentials & Storage

All credentials are stored in one file. Edit it directly to change any value.

C:\Users\Administrator\Desktop\ClaudeCode-API-MT5\.env
Stored values in .env:
MT5_API_KEY — API key
MT5_USERNAME — MT5 account ID
MT5_PASSWORD — MT5 password
MT5_SERVER — Broker server
MT5_TERMINAL_PATH — .exe path
WEB_USERNAME — Web login user
WEB_PASSWORD_HASH — Hashed web password
Change MT5 Password

Update the MT5 trading account password. After changing, run Initialize to apply.

After changing, run Initialize to apply the new password. Also update the password in your MT5 terminal to match.
Change Web Login Password

Update the password used to log in to this web page. Takes effect immediately.

All active sessions will be invalidated. You will need to log in again.

Swagger Docs | Health Check

ENVYLIA
ENVYLIA
future frequencies
Radio17