Codes sources MQL5 des bibliothèque pour MetaTrader 5

icon

Les bibliothèques sont de petits sous-programmes contenant une certaine fonctionnalité qui peuvent ensuite être utilisés pour développer de nouvelles applications. Une fois écrite et soigneusement vérifiée, une bibliothèque permet aux utilisateurs d'accélérer le développement de nouvelles applications MQL5. L'un des exemples illustratifs est la bibliothèque ALGLIB qui contient de multiples fonctions d'analyse numérique.

Les codes sources des bibliothèques peuvent être téléchargés et utilisés dans MetaEditor lors du développement de stratégies de trading. Ils ne peuvent pas être lancés indépendamment dans MetaTrader 5.

Soumettre votre code

A library for MetaTrader 5 that declares rules between the inputs of an Expert Advisor once in the code. OnInit rejects a combination that breaks a rule, with the reason in the Journal; before an optimization starts, OnTesterInit estimates which share of its passes the rules would reject and warns above a limit you set.

One include file that encrypts texts and bytes so only a program with the same key can read them. A wrong key or a changed message is refused instead of read as garbage, keys can come from a password, and the code is checked against the official NIST and RFC test vectors.

One include file that gives your EA or indicator keyboard shortcuts the user types into the inputs, such as Shift+B. Each press fires one action, Shift+B never fires on a plain B, and a shortcut that cannot work is refused at start with the reason.

Watches the equity like a prop firm does: daily loss limit and max loss limit, static or trailing, floating profit included. Stops new trades at a warning level, closes everything on a breach and remembers it after a restart.

Draws a live heatmap of two optimised inputs while the Strategy Tester optimises your EA, and scores every cell by its neighbourhood: the plateau score is the mean minus k times the standard deviation of the surrounding cells. It shows whether your best parameters sit on a stable plateau or on a single lucky cell, and writes an HTML report, a CSV and a picture of the map. Includes a Monte Carlo drawdown criterion and a small demo EA. Part of the free Robustness Lab set.

Builds H2 to D1 candles from H1 on the New York close clock, so your indicators see the same candles on every broker, no matter which server time it uses. Detects the server clock automatically.

One call before you send an order: is the session open, how long until it closes, are quotes still coming in, is trading allowed. Gives you the reason when the answer is no.

Une bibliothèque en un seul fichier qui gère le fonctionnement d'un EA : vérifications avant exécution, normalisation par rapport aux limites du courtier, nouvelles tentatives sécurisées, un ordre par signal, isolation par « magic number » et restauration de l'état après un redémarrage. Prise en compte du lot en fonction du risque, de la limite de perte journalière et du seuil de capital minimum. Testée dans le Strategy Tester.

A library for MetaTrader 5 that checks every trade request of an existing Expert Advisor in the Strategy Tester, with one include line and no other change. Volume, stops level, freeze level, margin, trade mode and the order limit are checked; the request then goes out unchanged, and the Journal and a CSV list each violation with the file and line that sent it.

Détection en ligne des variations de la moyenne ou de la volatilité (Adams-MacKay) : probabilité d'une variation au cours des k dernières barres, longueur actuelle du segment, prévision et indicateur.

Permet d'ajuster cinq copules bivariées sur les rangs, avec le coefficient tau de Kendall, la dépendance des queues, la probabilité de jours extrêmes conjoints, l'AIC et les probabilités conditionnelles des paires de transactions.

Include file with small functions to find the Gotobi days: the 5th, 10th, 15th, 20th, 25th and the last day of each month, moved back to the previous business day when they fall on a weekend or a holiday you list. Information only, no trading functions.

A library for MetaTrader 5 that puts trade management code behind an interface and tests it against a fake broker, without a trade server. The fake checks stops level, freeze level, tick grid and volume step, answers with retcodes chosen by the test and logs every request. An example break-even rule and 26 test cases come with it.

One include file that reads and writes JSON in MQL5. It refuses broken JSON and tells you the line and column of the mistake, keeps numbers exact, reads and writes UTF-8 files, and saves your EA's settings to a file and loads them back.

An include file that makes the way an EA sends its orders safe: the same signal is never traded twice. It has no trading strategy inside and comes with a small example EA.

La meilleure parmi plusieurs stratégies est-elle vraiment plus performante que l'indice de référence ? Le test SPA de Hansen, le « Reality Check » de White, le modèle StepM de Romano-Wolf et l'ensemble de confiance du modèle.

Decides if you can add to a running winner: only when all open trades in that direction are on break-even and the newest one is in profit. The open risk is never more than one add. Hedging accounts only.

Small MQL5 library that shares an EA's own runtime settings between charts of the same account, with edits from either chart, a file lock and per-field merge.

Bootstrap par blocs des résultats quotidiens : quelle peut être l'ampleur maximale de la baisse d'un compte ou d'une stratégie au cours des prochains mois, avec des centiles et un générateur initialisé permettant des simulations reproductibles.

Break-even and trailing stop for open positions, measured in R (distance to the first stop loss). Respects stops level and freeze level, only moves the stop in profit direction.

Probabilité de surapprentissage lors du backtest (PBO) d'une optimisation MT5 par validation croisée symétrique sur le plan combinatoire. Chaque itération envoie ses résultats quotidiens sous forme de trame, et la PBO est calculée à la fin de l'optimisation.

Small include file that gives you the lot size from risk in percent (or fixed money) and the stop loss distance. Rounds always down, checks min/max lot and free margin.

Converts session hours given in London, New York, Tokyo or Sydney time into broker server time, including US and EU daylight saving and the weeks when the two are out of step. Comes with a check script that verifies 15 hand-calculated cases.

A library for MetaTrader 5 that writes every pass of an optimization to a SQLite file: result, test statistics, your own metrics and the inputs of the pass. A demo Expert Advisor optimizes the Rosenbrock function in the mode "Math calculations".

Standalone MQL5 library for storing custom settings separately for each trade and following a verified pending-order-to-position lifecycle. It supports double, ulong and price-unit fields, terminal-local Global Variables, safe cleanup gates and an offline self-test. Includes a demo EA, source archive, and installation guide. A different-ticket transition, reconnection as a separate scenario, and netting behavior remain untested.

Converts broker server time to UTC and New York time with US and EU daylight saving rules. Works the same live and in the Strategy Tester, where TimeGMT() returns server time.

Minimal include file to license your own EAs and indicators: allowed account numbers, expiry date, demo-only trial mode and broker server filter. Example EA included.

Persistent MQL5 outbox with a Telegram demo and offline tests. An uncertain result is never retried automatically. Manual retry may duplicate a message; SENT means API acceptance, not a read receipt.

Gérer les positions ouvertes dans un Expert Advisor : seuil de rentabilité, stop suiveur, deux clôtures partielles, ainsi qu'un stop et un objectif pour les positions qui n'en ont pas. Il n'ouvre jamais de position.

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.

Exact maximum likelihood of an Ornstein-Uhlenbeck spread and Bertram's optimal entry and exit levels for a given cost, with the expected length of a trade cycle.

A lightweight tab bar for chart panels, drawn with the standard CCanvas class. One include file, several independent instances per chart, click selection, resizing and safe cleanup. Includes a demo Expert Advisor.

Parkinson, Garman-Klass, Rogers-Satchell and Yang-Zhang estimators, daily realized and bipower variance from intraday bars, and HAR volatility forecasts.

Five tests to tell a random walk from a mean-reverting series: KPSS, Phillips-Perron, DF-GLS, Zivot-Andrews with the break date, and the variance ratio.

Detects the broker's GMT offset and its daylight-time rule (fixed, US or European) from the weekly closes in the H1 history, the same way live and in the Strategy Tester, with functions that convert New York times to server time and back.

Unit root and cointegration tests (ADF, Engle-Granger, Johansen) with MacKinnon p-values, hedge ratio, half-life and z-score of the spread, and a pair scanner.

Kalman filter and smoother with an exact diffuse start, missing values and maximum likelihood: local level, local linear trend and a regression whose hedge ratio drifts.

Gaussian hidden Markov model fitted by Baum-Welch: regime probabilities without look-ahead, most likely path, expected durations and regime forecasts.

Holidays and early halts of the CME equity index futures (S&P 500, Nasdaq-100, Dow, Russell 2000, E-mini and Micro), computed from the US holiday rules for any year, with a script that checks the calendar against your broker's own M1 history.

Include for EAs running 24/7 on an MQL5 VPS or PC: run-where switch, order send with OK/FAIL/UNKNOWN result (no duplicate orders after a timeout), restart-safe counters, positions closed while the EA was off, append-only log and optional Telegram. No trading logic inside.

123456789101112