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

Look after open positions in an Expert Advisor: break-even, trailing stop, two partial closes, and a stop and target for positions that have none. It never opens a trade.

Checks the broker's session table against the M1 history. For every minute of the week it counts on how many of the last N days the symbol really has a bar, and sets that next to SymbolInfoSessionQuote and SymbolInfoSessionTrade: declared minutes that are usually empty (rollover holes), bars in minutes the table calls closed, trade and quote tables that disagree, and one-off outages such as an early holiday close. Prints the real sessions per weekday, writes every finding to CSV and prints its own arithmetic. Read only: no trade function, no DLL, no network.

A manual trading panel with a built-in prop-firm risk guard and a hidden Support/Resistance finder for MetaTrader 5.

A MetaTrader 5 utility that treats the bid and ask quote streams as two independent physical trajectories and fits a local quadratic to each, producing position, velocity, and acceleration with honest error bars and an out-of-sample forecast scoreboard.

Draws ICT structure on the chart (liquidity pools, sweeps, market structure shift, fair value gaps) from closed bars only, adds a trade plan for every confirmed setup and keeps an honest statistics panel of what those setups did on your symbol. Analysis only – it does not trade.

Tous ceux qui utilisent une stratégie de grid se posent la question suivante : mon compte est-il suffisamment approvisionné ? La réponse habituelle – à savoir la perte enregistrée au dernier niveau du grid – n’est pas le bon indicateur. Ce qui met fin au compte, c’est lorsque le niveau de marge atteint le seuil de stop-out fixé par le courtier, alors que la position est encore ouverte et semble encore récupérable. Cet EA calcule le chiffre réel, puis détermine combien de fois un mouvement d’une telle ampleur s’est déjà produit dans l’historique M1 du symbole concerné. Il corrige trois erreurs, toutes commises dans un excès de confiance : une chaîne de N positions flotte à l’étape x N(N-1)/2, et non à l’étape x N (pour 10 positions, 45 étapes de perte, et non 10) ; les positions ouvertes immobilisent également la marge tant qu’elles sont en cours ; et le stop-out est un pourcentage, et non zéro — à 50 %, perdre la moitié du capital suffit. « Il vous faut 86 dollars de marge disponible » est une abstraction. «« Un mouvement de cette ampleur s’est produit 71 fois en 100 jours, soit une fois toutes les 1,4 » est une décision. Définissez InpEquity à un montant dont vous ne disposez pas encore pour voir ce dont la configuration aurait réellement besoin. Strictement en lecture seule : cela n’ouvre, ne clôture ni ne modifie jamais une position.

Personnalisez votre assistant IA MetaTrader 5 en choisissant la langue, la personnalité, le menu et le comportement à l'aide d'un simple fichier de commande.

One panel for the rules of a prop firm challenge: daily loss, maximum loss (static or trailing), profit target, minimum trading days and the best-day (consistency) rule. For each one it shows how much is used and how much room is left, in money. "One more trade" tells you the largest lot size that still keeps a stop-out inside the room left today and in the max-loss room. Read-only: it never opens, changes or closes a trade. The presets hold typical values; firms change their rules, so check yours and use the Custom preset. Built on the ATS Risk Library (ATS_RiskLib.mqh, included).

A small include file for Expert Advisors and trade managers. It turns your risk rules into yes/no answers: how many lots does this stop allow, is the daily loss limit reached, is the maximum drawdown (static or trailing) reached, how much is at risk across all open positions, and are spread and session acceptable. The lot is never rounded up: if the broker minimum lot would risk more than allowed, the trade is skipped and the reason is returned. Limits survive a terminal restart. The library only measures: it sends no order. Includes a demo account guard (no trading by default) and a self-test with 78 checks.

The Trend BOSS Indicator identifies regimes such as trending, ranging or volatile using a Bag-of-SFA-Symbols (BOSS) classifier. Gate your strategies behind specific regimes or use the indicator to identify various market conditions.

Measures market activity from the waits between quotes. An ACD model with the daily rhythm removed gives one ratio per tick: 1 is normal, 2 twice as busy.

Extrapolator fits a sum of sinusoidal harmonics to the recent price history and extends the fitted curve to the right of the last bar as a forecast.The forecast is a mathematical extrapolation of past cyclical behaviour, not a guarantee of future price movement. The last part of the line is redrawn while the current model bar is forming, and the fitted curve changes with each refit.

A free, fully open JPN225 (Nikkei 225) EA for M15. Buys when price leans up, momentum isn't stretched and volume is quiet. Backtest 2022 to 2026: profit factor 1.68, +18.5% a year, passed 15 stress tests. Flat by 17:00.

EA de breakout sur une plage de séance avec filtrage ATR, calcul de la distance du stop, option de clôture à seuil de rentabilité ou clôture partielle, et un tableau de bord partagé. Comptes de couverture ; ressource pédagogique avec documentation sur les limites d'exécution et de coordination.

Enregistre l'amplitude maximale favorable et défavorable de chaque position en multiples de R et génère une ligne CSV par transaction clôturée.

Audits the tick history that 'Every tick based on real ticks' backtests replay. Five checks per symbol over the last N days: impossible and crossed quotes, timestamps that run backwards or repeat, one-tick price reversals sized in multiples of the symbol's own median spread, silences inside the broker's declared quote sessions, and minutes where the ticks and the M1 bars disagree. Every finding goes to CSV with its millisecond timestamp, and the tool prints its own arithmetic so the report can be recounted. Read only: no trade function, no DLL, no network.

A specified moment in time can be analyzed through multiple synced timeframes from 1 host chart for a symbol.

Opening Range Breakout EA template with built-in account protection. Marks the high and low of the first N minutes after the session open and places OCO stop orders above and below the range. Includes risk-based position sizing, daily loss limit, maximum drawdown limit, ATR range filter, trade direction filter, and protection against positions carried overnight. All session times are configurable inputs. Educational template, not a profit-guaranteed system. Test on demo before any live use.

Détecte les blocs d'ordre — la dernière bougie opposée précédant un mouvement impulsif qui rompt la structure du marché — et les représente sous forme de zones qui s'étendent en temps réel jusqu'à ce que le cours revienne et les neutralise. Les ruptures de structure et leur neutralisation sont toutes deux évaluées uniquement sur les barres clôturées ; ainsi, aucun tracé n'est modifié a posteriori.

Affiche les propriétés qui font qu'un même EA se comporte différemment chez un autre courtier : horaires de trading, taille du contrat, valeur du tick, statistiques sur les spreads, coût des swaps et couverture des sessions en temps réel. En lecture seule, n'effectue aucune opération de trading.

Exports closed trades to CSV with Maximum Adverse Excursion (MAE) and Maximum Favorable Excursion (MFE) in points and money, calculated from M1 history, plus the percentage of the available move each trade captured.

Opens charts for all Market Watch symbols or a custom symbol list in one click, on any timeframe, with an optional template applied to each chart. Skips charts that are already open and limits how many are opened at once.

Shades the chart background by volatility regime (Compression, Normal, Expansion) based on the percentile rank of the current ATR. Shows the current regime on the chart, alerts on regime changes and exposes buffers for Expert Advisors.

Shades the chart background by volatility regime (Compression, Normal, Expansion) based on the percentile rank of the current ATR. Shows the current regime on the chart, alerts on regime changes and exposes buffers for Expert Advisors.

Draws Asian, London and New York session range boxes and marks liquidity sweeps: a closed bar that wicks beyond a completed session's high or low and closes back inside. Non-repainting arrows, extended session levels, alerts and iCustom-ready buffers.

Writes a CSV journal of every trade with the exit reason, and a report that shows how far each trade ran, in R. It never trades.

ICT killzones for MetaTrader 5: Asia, London and New York sessions drawn in New York time with automatic daylight-saving conversion, session highs and lows carried forward until price takes them, previous day, week and month levels, opening prices and time markers. One file, no DLL.

Arixis Market Regime Map is a non-repainting MT5 indicator that classifies market conditions as Trend Up, Trend Down, Range or Transition using price efficiency, normalized slope, volatility, market structure and multi-horizon agreement.

Resamples your closed trades 10,000 times to show whether your average trade is an edge or could still be luck: the 95% range of the average and the chance it is below zero.

Shows the day's result against the daily and max loss limits of a prop firm account, with a warning alert, in a panel on the chart.

The Market Behavior Analyzer is a practical indicator designed to make market structure easier to read directly from the chart. It identifies significant swing points, classifies them as Higher Highs, Higher Lows, Lower Highs, and Lower Lows, and tracks the movement between them in pips. It also provides a Market Story panel and an interactive Swing Inspector for examining impulses, pullbacks, retracements, swing duration, and the developing market structure.

Un indicateur MT5 permettant de visualiser clairement la structure du marché, qui identifie directement sur le graphique les pics et creux confirmés (HH, HL, LH et LL).

Un graphique des sessions boursières pour MT5 qui affiche les fourchettes de cours de l'Asie, de Londres et de New York, ainsi que leurs plus hauts et plus bas confirmés.

Un outil d'analyse des écarts de juste valeur sur MT5 qui signale les déséquilibres haussiers et baissiers et suit le moment où chaque zone est comblée.

Un indicateur M5 à barres fermées combinant la structure du marché, les balayages de liquidité, les indicateurs BOS/CHoCH et le momentum pour afficher les points d'entrée, le stop-loss (SL), le take-profit 1 (TP1) et le take-profit 2 (TP2), avec des signaux à fréquence de marché de détail et un historique des paramètres configurables accessible par clic.

Audits the bar history your terminal actually holds, which is the history every backtest and every indicator reads. Six checks per symbol: impossible OHLC values, broken bar times, bars missing while the broker's own session table says it was quoting, empty and flat bars, bars that disagree with the broker's own M1 series, and spread sanity. The headline figure is session coverage, not a grid percentage that mostly measures how many weekends you audited. Every finding goes to CSV with its bar time, and the audited bars plus the session table can be dumped so the whole report can be recounted by something other than this tool.

Gold EA that trades both directions: when the stochastic signal line turns, it places a stop order at yesterday's high or low, filtered by a Bollinger band. Self-contained, no custom indicators. Backtest on XAUUSD H1, July 2021 to September 2026: +245% on a 1,000 USD deposit at a fixed 0.01 lot, 23.9% maximum equity drawdown.

Calculates position size and daily / max loss limits for prop firm accounts and shows them in a panel on the chart.

Gestion des ordres, des ordres existants, des ordres à cours limité, des ordres suiveurs, du seuil de rentabilité et du calculateur de taille de lot, le tout dans un seul outil

Un petit Expert Advisor pédagogique pour MetaTrader 5 présentant une méthode simple pour combiner des « briques » Renko classiques de taille fixe avec un indicateur de tendance de type SuperTrend.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208