Okay, this is a big one for MT5 traders. Let's do it properly.
In Python, the "Merge Tool" usually means 2 things:
1. *Merge MT5 data from different symbols / timeframes into one DataFrame*
2. *Plot it as a clean graph*
Here is a complete working setup:
*Step 1: Install*
pip install MetaTrader5 pandas matplotlib mplfinance
*Step 2: Full Code - Get MT5 Data + Merge + Plot*
import MetaTrader5 as mt5
import pandas as pd
import mplfinance as mpf
from datetime import datetime
# 1. CONNECT TO MT5
if not mt5.initialize():
print("MT5 failed, open MT5 terminal first")
quit()
# 2. FUNCTION TO GET DATA
def get_data(symbol, timeframe, bars=500):
rates = mt5.copy_rates_from_pos(symbol, timeframe, 0, bars)
df = pd.DataFrame(rates)
df['time'] = pd.to_datetime(df['time'], unit='s')
df.set_index('time', inplace=True)
df.rename(columns={'tick_volume': 'volume'}, inplace=True)
return df
# 3. GET 2 DIFFERENT DATA SETS
# Example: XAUUSD M1 + XAUUSD H1
df_m1 = get_data("XAUUSD", mt5.TIMEFRAME_M1, 500)
df_h1 = get_data("XAUUSD", mt5.TIMEFRAME_H1, 100)
# 4. MERGE TOOL - Merge M1 and H1 on time
# We merge the H1 close as a trend filter onto M1 chart
df_h1_trend = df_h1[['close']].rename(columns={'close': 'h1_close'})
df_merged = pd.merge_asof(
df_m1.sort_index(),
df_h1_trend.sort_index(),
left_index=True,
right_index=True,
direction='backward'
)
# Add indicators
df_merged['EMA_20'] = df_merged['close'].ewm(span=20).mean()
df_merged['EMA_50'] = df_merged['close'].ewm(span=50).mean()
print(df_merged.tail())
mt5.shutdown()
# 5. PLOT GRAPH
# Create extra plots for EMAs
ap = [
mpf.make_addplot(df_merged['EMA_20'], color='blue', width=1),
mpf.make_addplot(df_merged['EMA_50'], color='orange', width=1),
mpf.make_addplot(df_merged['h1_close'], color='purple', width=1, linestyle='--')
]
mpf.plot(
df_merged.tail(200), # plot last 200 candles
type='candle',
style='charles',
title='XAUUSD M1 Merged with H1 Trend',
ylabel='Price',
volume=True,
addplot=ap,
figsize=(14, 7),
savefig='merged_chart.png'
)
print("Chart saved as merged_chart.png")
*What this does:*
- Pulls live data straight from your MT5 terminal
- Merges the H1 close price onto the M1 chart, so you can see the higher timeframe trend while scalping
- Plots candles + EMA 20 / EMA 50 + H1 trend line
*If you want to merge 2 SYMBOLS instead (e.g. XAUUSD + EURUSD):*
# Get both
gold = get_data("XAUUSD", mt5.TIMEFRAME_H1, 500)[['close']].rename(columns={'close': 'GOLD'})
eur = get_data("EURUSD", mt5.TIMEFRAME_H1, 500)[['close']].rename(columns={'close': 'EURUSD'})
# Merge on time
merged_symbols = pd.merge(gold, eur, left_index=True, right_index=True, how='inner')
# Plot correlation
merged_symbols.plot(figsize=(14,6), title='GOLD vs EURUSD - Merged')
Which merge do you want to build?
1. Same symbol, different timeframes (M1 + H1) - for trend filter
2. Different symbols together - for correlation
3. Merge MT5 data from a CSV file + live MT5
Tell me which one and your symbol, I'll give you the exact code for it.
Similar orders
EA Application & MT5 Account Verification Requirements To apply, you must already have your EA running on an active MT5 trading account connected to the market. The account must have genuine trading history that can be independently reviewed and verified. EA Requirements 1. Prop-Firm Compatible Risk Management - The EA must include daily and overall drawdown protection. - Required inputs: "MaxDailyLoss = 5%"
Can you create a Smart Tool Like a Smart Fib Just one click on where you position your highest point or the Low to high. with color for each percent
the job underlying algorithms. An algorithm is a set of actions that need to be performed in response to certain events. For example, the most common task in algo trading is the identification of the "New bar" event . When the event occurs, the robot checks the emergence of trading signals and acts accordingly. Before you decide to program or order a trading robot, you need to formulate a trading system with clear
I have an existing C# trading strategy that I’d like to integrate into Quantower’s Strategy Manager so I can manage, configure, and execute it directly within the platform. I’m looking for a developer familiar with Quantower C# to handle the integration
I am looking for a quantitative strategy researcher and MQL5 developer to help research, validate and prototype a fast automated XAUUSD trading system for MT5. The target is tick-level trading with positions typically held for seconds, closely spaced entries, and configurable bursts of multiple positions during a qualifying opportunity. IMPORTANT: We do not yet have a validated profitable strategy. I need someone who
Experienced Trading Software Developer Needed – Multi-Platform Development Hello! I'm looking for an experienced developer to create a custom trading indicator and convert it into an automated trading bot for the following platforms: MT5 NinjaTrader 8 Quantower cTrader The plan is to develop the same indicator and trading bot for all four platforms, one after another. Project requirements: Custom trading indicator
un écosystème logiciel asynchrone multi-comptes dopé par un module de supervision par Intelligence Artificielle (Guardian AI). La solution assure le pilotage automatisé, le filtrage de marché en temps réel et le contrôle des risques pour 20+ comptes MetaTrader 4/5 (via MetaApi) et Deriv sur VPS Equinix NY4. vous aurez plus de detail dans les échanges
Hi! I need an experience developer with order flow, volume delta, and futures scalping, and I wanted to ask you a few questions. Have you personally developed and tested fast-paced strategies for Gold Futures (GC), particularly those that enter during short-term price impulses and scale into positions as momentum builds? From your experience, what indicators or signals help you determine whether an impulse has enough
I am looking for an experienced MQL5 developer for the first milestone of a larger MetaTrader 5 project: a multi-symbol, multi-timeframe signal scanner with alerts. This milestone covers indicator integration only. There is no order placement or trade management at any stage. Scope of this milestone Read outputs from three custom indicators (provided as compiled files after selection and NDA) reliably via iCustom and
//@version=4 study(title="UT Bot Alerts", overlay = true) // Inputs a = input(1, title = "Key Vaule. 'This changes the sensitivity'") c = input(10, title = "ATR Period") h = input(false, title = "Signals from Heikin Ashi Candles") xATR = atr(c) nLoss = a * xATR src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close xATRTrailingStop = 0.0 xATRTrailingStop := iff(src >