Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Twitter !
Rejoignez notre page de fans
Accédez à la CodeBase depuis votre terminal MetaTrader 5
Vous n'avez pas trouvé le bon code ? Commandez-le dans la section Freelance
Comment rédiger un Expert Advisor ou un indicateur

Bibliothèque de code source MQL4 et MQL5

icon

Vous souhaitez apprendre le langage de programmation MQL5 ou MQL4, mais vous ne savez pas par où commencer ? Divers programmes pour votre terminal MetaTrader sont disponibles ici. Téléchargez et étudiez les exemples de code publiés, développez vos propres indicateurs et Expert Advisors. Publiez vos applications dans la plus grande bibliothèque de codes MQL5 et MQL4, et elles seront disponibles dans chaque terminal MetaTrader et MetaEditor.

Vos exemples de code dans MQL4 et MQL5 seront distribués dans le monde entier, et des milliers de traders entendront parler de vous !

Soumettre votre code

Script de diagnostic qui compare les valeurs SYMBOL_TRADE_TICK_VALUE, SYMBOL_TRADE_TICK_VALUE_LOSS et SYMBOL_TRADE_TICK_VALUE_PROFIT pour chaque symbole de la fenêtre « Market Watch ». Il classe chaque symbole dans l'une des quatre catégories suivantes (ALL_EQUAL, TV_MATCHES_PROFIT, TV_MATCHES_LOSS, ALL_DIFFER) et fournit un résumé agrégé ainsi qu'une suggestion d'interprétation. Utile pour déterminer la propriété de valeur de tick à privilégier lors de la mise en œuvre d’un dimensionnement de lot basé sur le risque dans les EA. Exporte un rapport complet par symbole au format CSV dans MQL5/Files.

Script permettant de définir un Stop Loss sur chaque position ouverte en fonction d'un seuil de perte défini dans la devise du compte (par exemple, 50 $ par position). Fonctionne avec n'importe quelle devise de dépôt et n'importe quelle paire de devises. Vérifie les niveaux de stop et de gel définis par le courtier. La conversion des devises est gérée automatiquement.

A lightweight educational MetaTrader 5 indicator that maps Premium, Equilibrium and Discount areas from a selected market range.

Heiken Ashi avec tous les tampons configurés en série

Open-source MT5 script that records XAUUSD/GOLD symbol settings, spread, tick value, contract size, volume step, stop/freeze levels, swap, and account context to the log and optional CSV.

A native MQL5 script that measures how concentrated a strategy's profit is — whether the edge is broad or rests on a few lucky trades. It reads a per-trade CSV (Date,Profit) and reports the share of net profit from the largest trades, the Gini coefficient of the winners, a concentration profile, a survival test that removes the best few trades and recomputes net profit and profit factor, and the largest single day versus a configurable consistency limit, combined into a concentration-and-consistency score (A+ to F) with recommendations. If no file is found it generates a sample set, so it runs out of the box. No external libraries, no Python, no AI. The helper ExportTrades.mq5 writes the file from your trade history.

A native MQL5 script that analyzes the structure of an account's drawdowns, not just the single "maximum drawdown" figure. It reads a daily equity curve (Date,DailyPnL CSV), rebuilds the underwater curve, and splits it into individual drawdown episodes with their depth, duration and recovery time. It then reports the Ulcer Index, Pain Index, Recovery Factor and time spent underwater, and combines them into a single resilience score (A+ to F) with recommendations, printed in the Experts tab. No external libraries; if no file is found it generates a sample curve so it runs out of the box.

Les pipelines d’étiquetage à triple barrière utilisent souvent une constante arbitraire (0,5–1,0 %) ou une hypothèse de spread héritée comme seuil min_ret. Un seuil fixé en dessous du coût réel de transaction aller-retour conduit le pipeline à étiqueter du bruit lié aux coûts comme un signal négociable. L’ensemble de données étiqueté surestime alors systématiquement l’« edge », et tout modèle entraîné sur ces étiquettes présente un surajustement à un artefact du schéma d’étiquetage plutôt qu’à la structure réelle du marché. TransactionCostCollector.mq5 est un script autonome qui résout l’étape de collecte des données liée à ce problème.

A small educational MetaTrader 5 indicator that marks simple three-candle bullish and bearish Fair Value Gaps on the chart.

A small educational MetaTrader 5 indicator that marks confirmed swing highs and lows and labels market structure as HH, HL, LH and LL.

Un moteur quantitatif de densité de volume utilisant le calcul de la moyenne harmonique pondérée pour éliminer les valeurs aberrantes arithmétiques et déterminer le véritable centre de gravité de la liquidité institutionnelle.

Daily Range Tracker — Live Today's Range vs Average Daily Range. Daily Range Tracker shows you, at a glance, how much of the symbol's typical daily movement has already happened today — helping you judge whether the day still has room to run or is already exhausted.

Swap Meter displays the live SELL and BUY swap rates for your current chart symbol in a clean, color-coded panel — and instantly alerts you the moment your broker changes either rate.

Spread Meter — Live Single-Symbol Spread Tracker with Max/Min Record Spread Meter by Fox Wave is a sleek, single-symbol dashboard that displays the live spread of your current chart symbol in real time, while permanently recording the widest and tightest spread ever seen — with exact timestamps.

Open source MT5 spread logger with average, p50, p90, p95, p99, maximum spread, alerts and CSV export.

Clôturer les positions bénéficiaires

Open-source Expert Advisor for testing day-of-week reversal and continuation effects. Built for systematic research, strategy validation, and further development by the MQL5 community.

A simple Expert Advisor based on the crossover of two EMAs (fast and slow), with configurable Stop Loss, Take Profit, lot size, and Magic Number.

Asian Range Breakout day-trading EA. Multi-symbol, M15/M30/H1. Places pending stop orders during the London session outside the pre-London Asian range, using PSAR + MACD + Stochastic signals, with automatic London/NY DST handling, structural stops, trailing and break-even.

Cet indicateur identifie les zones de déséquilibre (Fair Value Gap) sur le graphique et signale par une flèche lorsque le cours y revient. Il convient à l'or, au Forex et à tous les instruments liquides sur des périodes allant de M5 à H4.

Session Boxes is a custom indicator for MetaTrader 5 that draws color-coded rectangular boxes on the chart representing the high-low range of the Asia, London, and New York trading sessions. The indicator uses H1 data internally and supports configurable session hours in GMT along with a broker server offset parameter

Implémentation en MQL5 de la méthode de différenciation fractionnaire à largeur fixe (FFD) tirée de l'ouvrage de López de Prado intitulé *Advances in Financial Machine Learning* (chapitre 5). Transforme une série de cours non stationnaire en une série stationnaire tout en préservant au maximum la mémoire historique ; les résultats sont validés par recoupement avec la bibliothèque Python afml avec une précision de l'ordre de 1e-12.

Oscillateur de momentum et de tendance à long terme basé sur un double filtrage TRIX et LWMA.

Un moteur physique quantitatif qui applique le calcul différentiel à l'évolution des cours, en extrayant la vitesse réelle du marché (dérivée première) et l'accélération du marché (dérivée deuxième) afin de prédire l'épuisement d'une tendance avant qu'il ne se produise.

This Expert Advisor combines an ADX-based trend strength filter with an EMA pullback entry technique, using ATR for dynamic stop loss and take profit sizing. It is designed for trading a single symbol with one position open at a time.

Expert Advisor for testing the Inside Bar continuation hypothesis. The EA places pending orders in the direction of the Main Bar after a valid Inside Bar pattern is detected, with optional ATR and pattern quality filters.

A state engine to provide geometric signal validation for indicator signals

Instead of having to analyze each pair individually, you can see at a glance what are the most promising pairs according to your own criteria.

Universal Breakout Study is a research-focused Expert Advisor for MetaTrader 5 designed to analyze and optimize range breakout strategies. It provides flexible parameter testing, fast optimization, and a structured framework for validating trading ideas using historical data and forward testing.

An econometric price-space indicator that utilizes the Ornstein-Uhlenbeck stochastic process to mathematically estimate the asset's true driftless equilibrium and its speed of mean reversion.

MSNR v5.31Plus AEU EA is an Expert Advisor for MetaTrader 5 based on Malaysian SNR body levels, Smart Money reaction logic, liquidity sweep, MISS, engulfing confirmation, trendline confluence, QML, CRT and DOL target projection. The EA is designed for XAUUSD and works best on the M5 timeframe. It scans higher timeframes such as W1, D1, H4 and H1 to build important support and resistance zones, then waits for price action confirmation on the execution timeframe. Main features: - Malaysian SNR body-level detection. - Higher-timeframe support and resistance scan. - Liquidity sweep, MISS and engulfing confirmation. - Trendline, QML, breakout-retest and CRT logic. - Confluence cluster system. - Session filter for Asia, Europe and US trading hours. - Risk management by account percentage. - Partial close at selected R multiple. - Break-even and safety guard options. Recommended settings: Symbol: XAUUSD Timeframe: M5.

Expert Advisor for testing the Turnaround Tuesday hypothesis. If Monday closes bullish, a Sell position is opened on Tuesday. If Monday closes bearish, a Buy position is opened. The EA supports an ATR-based filter, ATR-based Stop Loss and Take Profit levels, as well as position sizing using either a fixed lot size or percentage risk.

Breakout is a clean, automated MetaTrader 5 expert advisor designed to capture algorithmic breakout momentum in structural bull markets.

Multi-indicator EA for Gold (XAUUSD) and Silver (XAGUSD): RSI, ADX and MA signals, adaptive ATR trailing stop and built-in capital protection.

Prime Quantum AI est un Expert Advisor MT5 combinant un pré-filtre classique (ADX + Alligator) avec une confirmation graphique basée sur la vision artificielle des principaux fournisseurs d'IA (Anthropic Claude, OpenAI GPT, Google Gemini, DeepSeek, xAI Grok). Lorsque le pré-filtre détecte une tendance, l'EA capture trois captures d'écran de graphiques adaptatifs et les envoie au fournisseur d'IA configuré, qui renvoie la direction, la confiance, le stop-loss et le take-profit. Une transaction n'est ouverte que lorsque l'IA confirme le signal du pré-filtre avec suffisamment de confiance. Caractéristiques : deux modes de risque Courtier standard / Prop Firm, taille de lot configurable, martingale optionnelle, plusieurs modes SL/TP, trailing stop, clôture partielle, filtres news/heure/jour/spread, panneau d'information sur le graphique pouvant être déplacé, et paramètres d'indicateur entièrement exposés. Requiert MetaTrader 5, WebRequest activé pour l'URL de votre fournisseur, et une clé API valide. Le fournisseur est auto-détecté à partir du format de la clé.

A quantitative stochastic probability engine that utilizes Markov Chain transition matrices to mathematically forecast the percentage chance of bullish or bearish continuation on the next algorithmic execution cycle.

Dynamic Fair Value Gap (FVG) is an MQL5 indicator for MetaTrader 5 that automatically detects market price imbalances. This indicator is perfectly suited for traders utilizing the Smart Money Concepts (SMC) strategy.

IMR is a multi-layered quantitative reversal finder designed for discretionary price-action traders who refuse to trade blind. It helps traders understand what's the current market regime. Whether its an accumulation, distribution or continuation.

Un moteur de traitement du signal numérique (DSP) qui applique la transformée de Fourier discrète (DFT) aux données du marché, en isolant la fréquence cyclique dominante afin de prévoir les points de retournement et d'éliminer le décalage de phase.

L'indicateur Supertrend trace une ligne de tendance dynamique basée sur l'ATR sur le graphique MetaTrader 5, passant d'une ligne verte de tendance haussière à une ligne rouge de tendance baissière avec des signaux optionnels de flèche d'achat/vente à chaque renversement de tendance.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199