Bibliothèque de code source MQL4 et MQL5
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 !
- Applications de trading gratuites
- Plus de 8 000 signaux à copier
- Actualités économiques pour explorer les marchés financiers
Autorisez l'utilisation de cookies pour vous connecter au site Web MQL5.com.
Veuillez activer les paramètres nécessaires dans votre navigateur, sinon vous ne pourrez pas vous connecter.
Vérifie l'historique des ticks que reproduisent les backtests « Chaque tick basé sur des ticks réels ». Cinq vérifications par symbole sur les N derniers jours : cotations impossibles et croisées, horodatages inversés ou répétitifs, inversions de cours d’un tick dont l’amplitude est un multiple du spread médian du symbole, silences au sein des sessions de cotation déclarées par le courtier, et minutes où les ticks et les barres M1 ne concordent pas. Chaque anomalie est enregistrée dans un fichier CSV avec son horodatage à la milliseconde près, et l’outil affiche ses propres calculs afin que le rapport puisse être revérifié. En lecture seule : aucune fonction de trading, aucune DLL, aucune connexion réseau.
Un EA gratuit et entièrement ouvert pour le JPN225 (Nikkei 225) sur la timeframe M15. Il achète lorsque le cours affiche une tendance haussière, que la dynamique n'est pas excessive et que le volume est faible. Backtest de 2022 à 2026 : facteur de profit de 1,68, +18,5 % par an, a passé avec succès 15 tests de résistance. Position neutre à 17 h.
Draws the daily opening range and its breakout levels, with a dashboard showing how the range resolved over your lookback: broken up, down, both ways or not at all, and how often a breakout hit its target before the opposite side.
Prop Firm Guard Panel is an on-chart panel for prop firm challenges and funded accounts. It shows in real time the daily loss used and the room left, the max loss room and equity floor, and the progress toward the profit target. The start-of-day balance is rebuilt from today's closed deals, so the values stay correct after a restart. Colors change from green to orange to red as limits get closer, with optional popup and push alerts. Auto, dark or light theme. Display only: it never opens, modifies or closes trades.
Trending up, trending down or ranging: a verdict for every bar, and how long it has held. Each stretch of one regime is boxed on the price chart, ADX columns below show how strong it is, and a one-line panel gives the regime, its age and the ADX. Values for Expert Advisors and an alert on closed bars.
Reads your closed positions and the M1 bars after each exit. Shows how many stopped-out trades later reached their take profit, how far take-profit trades kept running and how much move was left after manual or EA exits. Summary panel, per-position log table and CSV.
Free educational EA — a single-position trend-following EMA crossover system for XAUUSD M30, released as open source for beginners to study trade ownership guards, preflight order validation, risk-based lot sizing, and server-time session filtering. This code demonstrates how a strategy - identifies and manages only its own positions and orders through MagicNumber and comment tags, - wraps CTrade with an OrderCheck preflight that blocks invalid or margin-breaking requests, - sizes each trade from a fixed stop-loss and risk percentage, - and restricts entries to a configurable broker session window with a daily close-all — all evaluated on completed bars only, so signals never repaint.
Trace les fourchettes de variation des séances asiatiques, londoniennes et new-yorkaises et signale les « liquidity sweeps » : une barre fermée dont la mèche dépasse le plus haut ou le plus bas d'une séance terminée, mais qui se referme à l'intérieur de cette fourchette. Flèches sans redessin, niveaux de séance étendus, alertes et zones tampons compatibles avec iCustom.
Modèle d'EA « Opening Range Breakout » avec protection du compte intégrée. Identifie les plus hauts et les plus bas des N premières minutes suivant l'ouverture de la séance et place des ordres stop OCO au-dessus et en dessous de la fourchette. Comprend le dimensionnement des positions en fonction du risque, une limite de perte journalière, une limite de drawdown maximal, un filtre de fourchette ATR, un filtre de direction de trade et une protection contre les positions portées au lendemain. Toutes les durées de séance sont des paramètres configurables. Modèle à but pédagogique, ce n'est pas un système garantissant des profits. Testez-le sur un compte démo avant toute utilisation en production.
Non-repainting fair value gaps on closed bars, with zone states (active, touched, mitigated) and iCustom buffers for EAs.
Real-time daily drawdown buffer monitor and exact breach price line indicator for prop firm accounts. Features 00:00 server-time deal history reconstruction (including entry commissions), 00:00 HWM snapshot locking, two-stage OrderCalcProfit cross-rate calibration, and iCustom() data buffers for Expert Advisors.
Colore l'arrière-plan du graphique en fonction du régime de volatilité (Compression, Normal, Expansion) sur la base du rang centile de l'ATR actuel. Affiche le régime actuel sur le graphique, signale les changements de régime et met à disposition des zones tampons pour les Expert Advisors.
Colore l'arrière-plan du graphique en fonction du régime de volatilité (Compression, Normal, Expansion) sur la base du rang centile de l'ATR actuel. Affiche le régime actuel sur le graphique, signale les changements de régime et met à disposition des zones tampons pour les Expert Advisors.
Ouvre en un clic les graphiques de tous les symboles de Market Watch ou d'une liste de symboles personnalisée, sur n'importe quelle période, avec un modèle facultatif appliqué à chaque graphique. Ignore les graphiques déjà ouverts et limite le nombre de graphiques ouverts simultanément.
Cette fonctionnalité exporte les transactions clôturées au format CSV, en indiquant l'écart maximal défavorable (MAE) et l'écart maximal favorable (MFE) en points et en montant, calculés à partir de l'historique M1, ainsi que le pourcentage de la variation disponible capturé par chaque transaction.
See the real leverage of every Market Watch symbol, including floating margin tiers, with swap, commission and live spread in one panel.
Watches the whole account and closes everything before the daily loss or max drawdown limit is breached, then keeps the account flat until the block ends. Does not trade.
Expert Advisor template that shows safe execution practices: closed-bar signals once per bar, no duplicate entries after an MT5 or VPS restart, spread and stop-level checks, normalised volume and a log line for every decision.
Shows the current spread next to its recent average and maximum and compares it with ATR, so you can see at a glance when trading costs are too high relative to the symbol's normal movement.
On-chart panel that calculates the lot size for a given risk (% of balance, % of equity or fixed money) and stop-loss distance, using the broker's tick size and tick value. Works on forex, metals, indices and crypto.
Trailing stop and breakeven manager for Gold (XAUUSD), forex and any symbol: moves the stop to breakeven with an offset, then trails it in points or ATR multiples on manual trades and on any EA, filtered by magic and symbol. Open source code.
Script that reads the deal history of your account and writes a plain note on how an Expert Advisor really trades: entries, stops and trailing, lot changes, martingale, averaging, trades at once, hours and holding time, plus what to watch out for. It never trades and says nothing about profit
Automatisation pilotée par les signaux pour l'oscilloscope WaveMaster. Moteur d'exécution automatisé pour l'oscilloscope WaveMaster. Lit les tampons de signaux en temps réel. Gestion complète des risques, suivi et seuil de rentabilité intégrés.
Vérifie l'historique des barres effectivement stocké par votre terminal, c'est-à-dire l'historique utilisé par chaque backtest et chaque indicateur. Six contrôles par symbole : valeurs OHLC impossibles, horaires de barres erronés, barres manquantes alors que le tableau de session du courtier indique qu'il y avait cotation, barres vides ou plates, barres en contradiction avec la série M1 du courtier lui-même, et cohérence des spreads. Le chiffre clé est la couverture des sessions, et non un pourcentage de grille qui mesure principalement le nombre de week-ends que vous avez audités. Chaque résultat est exporté au format CSV avec l’heure de la barre correspondante, et les barres auditées ainsi que le tableau des sessions peuvent être exportés afin que l’ensemble du rapport puisse être réexaminé à l’aide d’un autre outil que celui-ci.
Draws the previous day, previous week and previous month high and low, plus automatic round-number levels around the current price. Every level carries a label with how many times price touched it and how many times a bar swept it (pierced the level and closed back on the original side). Counts use closed bars only, so they do not repaint. Optional alerts (popup, push, email, sound) for sweeps and new touches. Touch tolerance is a fraction of ATR or a fixed number of points. The 6 previous-period levels and their touch counts are exposed in 12 indicator buffers for use from an Expert Advisor with iCustom(). Works on any timeframe up to H4. Read-only: it never opens, modifies or closes a trade. No DLLs, no web requests.
Draws the opening range of a configurable session (start time and length in minutes, with a server time zone adjustment), the 1R and 2R levels above and below the box, and the session VWAP (tick volume, or real volume when the broker provides it). A small panel counts, over the last N finished sessions, how many broke the range up only, down only, on both sides, or not at all, and how often price reached 1R and 2R after the first break. The statistics are historical counts: they describe the past and do not predict anything. Only closed bars are used, so nothing repaints; optional popup, push and sound alerts fire once per direction per session when a closed bar closes outside the box. Eight buffers (range, targets, VWAP, break state) can be read from an Expert Advisor with iCustom(). Works on M1 to M30, recalculates only new bars and deletes its chart objects when removed. Read-only: it never trades. No DLLs, no web requests.
Draws the high and low of the Asia, London and New York sessions as boxes or lines extended to the end of the day, with configurable session hours and a server time zone adjustment. Optional previous day and previous week high/low. When a CLOSED bar breaks the high or low of a session that has already finished, it can raise a popup alert, a push notification and/or a sound, once per level per day. Alerts are evaluated on closed bars only, so they do not repaint. The 10 levels are exposed in indicator buffers, so an Expert Advisor can read them with iCustom(). It recalculates only new bars, works on any timeframe up to H1, and deletes all its chart objects when removed. Read-only: it never opens, modifies or closes a trade. No DLLs, no web requests.
Marks bullish and bearish engulfing, bullish and bearish pin bar and inside bar patterns with arrows, using closed bars only, so nothing repaints. The definitions (wick and body proportions, minimum bar size in ATR) are inputs, with an optional EMA trend filter. For each pattern a small panel shows a rolling historical statistic: the share of the last N resolved cases where price moved X ATR in the pattern direction before moving Y ATR against it, together with the number of cases. X, Y, N and the waiting time are inputs. The numbers describe what happened on your chart history; they do not predict the next trade. Optional alerts on closed bars (popup, push, sound). 20 buffers (signal, hit rate and sample size per pattern) can be read with iCustom(). Uses prev_calculated, deletes its chart objects when removed. Read-only: it never trades. No DLLs, no web requests.
Utility Expert Advisor that watches the account equity against two limits: a maximum daily loss and a maximum total drawdown. Each limit can be set as a percentage or as a money amount, and the daily loss can be measured from the balance or from the equity at the start of the day, as many prop firms do. When a limit is touched the EA closes all positions, deletes all pending orders and keeps the account locked until the next trading day: anything opened in the meantime, by another EA or by hand, is closed again. Optional early warning at a percentage of the limit (Alert and push), a small on-chart panel, a magic number / symbol filter, a configurable day-reset time and retries when a close fails. The state is stored in terminal global variables, so a restart does not unlock the account. Works on hedging and netting accounts. No DLLs, no web requests. It never opens trades (only the optional Strategy Tester demo mode does).
Exports your closed trade history to a CSV file with one row per position (not per deal), ready for Excel, Python or any journal. Each row has ticket, symbol, magic number, comment, side, volume, entry and exit time and price, duration, initial SL and TP when known, gross profit, commission, swap, net result and R multiple. It also calculates MFE and MAE (best and worst price reached while the trade was open, in points and in money) from the M1 bars between entry and exit, plus the entry session (Asia, London, New York) and weekday. Filter by magic number (lists and ranges) and symbol (wildcards), pick the period, the column separator (; or ,) and the decimal mark, and save to MQL5\Files or the common folder. Tested on hedging accounts and in the Strategy Tester (netting logic included; feedback welcome), where the file is written when the test ends. Read-only: it never opens, modifies or closes a trade. No DLLs, no web requests.
XAUUSD grid EA that opens a basket when RSI leaves oversold or overbought on a closed candle, adds levels with a lot multiplier and closes the basket at a money or points target. Open source code.
Reproduit les positions ouvertes, modifiées et clôturées par un autre EA sur le même compte de couverture, sélectionné par son « magic number ». Par défaut, il inverse les directions (Achat ↔ Vente, SL ↔ TP), ce qui vous permet de tester rétrospectivement l'inverse d'une stratégie en tenant compte des spreads réels, du slippage et des conditions d'exécution.
Une adaptation du moteur « Alpha Engine » du groupe Olsen : huit agents utilisant des ordres à cours limité négocient des changements de tendance en temps intrinsèque sur un compte de couverture. Ils renforcent leurs positions lors des dépassements et les réduisent lorsqu'ils réalisent des bénéfices lors des retournements de tendance.
Manages positions that are already open: it adds a missing SL/TP, moves the stop to break even, trails it, caps the position count and applies daily equity limits. It never opens trades.
Draws the high and low of a chosen time window and alerts on the first break on each side. The levels are also available through iCustom.
Close all positions panel for MT5: seven buttons to close all, buys, sells, winners, losers, the chart symbol or delete pending orders, on Gold (XAUUSD), forex or any symbol, for manual trades and any EA. Open source code.
Auto Fibo Extended is a MetaTrader 5 indicator designed to automatically identify significant swing highs and swing lows and draw Fibonacci Retracement and Extension levels directly on the chart.
A stop distance in points is not money until the tick size and tick value make it one. This library turns four risk bases into a lot size, floors it to the volume step, caps it against free margin and tracks a daily loss limit. Two MQL5 headers, no DLL.
A one-file library that handles how an EA trades: pre-trade checks, normalisation to broker limits, safe retries, one order per signal, isolation by magic number and state recovery after a restart. Lot by risk, daily loss limit and equity floor included. Verified in the Strategy Tester.