Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Access the CodeBase from your MetaTrader 5 terminal
Couldn't find the right code? Order it in the Freelance section
How to Write an Expert Advisor or an Indicator

MQL5 Source Code Library for MetaTrader 5 - 5

icon

This is the largest free source code library for MetaTrader 5 platform programs. Here you can find ready-made Expert Advisors, technical indicators, scripts and libraries. Use the code library when learning MQL5 language and develop your own automated trading applications based on the provided codes.

You can freely download and test published codes, as well as launch them in MetaTrader 5. The library is also available directly from MetaTrader 5 platform and MetaEditor development environment.

Submit your code

Attach it to a chart, type the name of any custom indicator, and it alerts you on that indicator's own buffers - popup, sound, push notification to your phone, or email. It reads the indicator through iCustom, so no source is needed: a compiled .ex5 you downloaded is enough. It can also read that indicator from a higher timeframe, and it re-checks closed bars to tell you whether the indicator repaints or merely lags. It opens in EXPLORE mode, which lists every buffer the indicator has and what is in each one, because "which buffer holds the signal" is the question that stops most people using iCustom at all.

A SuperTrend that returns the same values as TradingView's ta.supertrend, shipped with the tool that proves it bar for bar against the Pine reference

Read-only panel that checks a BUY STOP or SELL STOP against the symbol contract before you send it: price tick grid, volume minimum/step/maximum, stop distances and order permissions. It never sends, changes or suggests anything.

An MT5 dashboard that classifies completed-bar trend regimes using EMA structure, ADX/DI, higher-timeframe confirmation, ATR, breakout position and spread context.

Draws Sydney, Tokyo, London and New York as high/low boxes with the London-New York overlap outlined and the rollover hour shaded. Session times in GMT, broker offset detected automatically, average range of the last N sessions on every label, optional alert at session open.

A lightweight memory meter dashboard that reveals current MT5 memory usage and key resource statistics directly on the chart.

Customize your MetaTrader 5 AI Assistant with selectable language, personality, menu and behavior using a simple prompt file.

Everyone running a grid asks: is my account big enough? The usual answer - the loss at the last grid level - is the wrong number. What ends the account is the margin level reaching the broker's stop-out, while the chain is still open and still looks recoverable. This EA computes the real figure, then counts how often a move that large has already happened on the symbol's own M1 history. Three mistakes it fixes, all erring in the reassuring direction: a chain of N legs floats at step x N(N-1)/2, not step x N (at 10 legs, 45 steps of loss, not 10); open positions also lock up margin while they float; and stop-out is a percentage, not zero - at 50%, losing half the equity is enough. "You need 86 dollars of room" is an abstraction. "A move that size happened 71 times in 100 days, one every 1.4" is a decision. Set InpEquity to a size you do not have yet to see what the configuration would really need. Strictly read-only: it never opens, closes or modifies a position.

The Advanced Harmonic & RSI Reversal Scanner solves both problems. By combining precise Fibonacci geometry (to find the location of a reversal) with an RSI exhaustion filter (to time the exact moment of the reversal), this script prevents you from catching falling knives

Reports, month by month, whether your symbol really has ticks or only bars - so you know which part of your backtest ran on generated ticks before you trust the curve. The Strategy Tester gives you one History Quality figure after the test has finished, and it never says which months were the problem. This script asks first.

A safety EA that watches every open position on the chart symbol: it reports any position left without a stop loss, optionally attaches an ATR-based stop, and enforces a daily and a total drawdown limit that re-arms after a cooldown.

This Expert Advisor is that missing bridge. Attach it to any chart and it periodically writes the calendar to a CSV file in `MQL5\Files`, where anything outside the terminal can read it.

Exporting your deal history is easy and a dozen scripts already do it..

Records the maximum favourable and adverse excursion of every position in R multiples and writes one CSV row per closed trade.

Session-range breakout EA with ATR filtering, stop-distance sizing, optional break-even/partial close, and a shared chart desk. Hedging accounts; educational source with documented execution and coordination limits.

Concept: Identifies market microstructure turning points based on ICT/SMC principles.

Detects order blocks — the last opposing candle before an impulsive move that breaks market structure — and draws them as zones that extend live until price returns and mitigates them. Structure breaks and mitigation are both evaluated only on closed bars, so nothing repaints.

Equity guard that enforces a daily loss limit and a total drawdown limit, flattens the account on breach and blocks trading until the next daily reset. Includes the guard as a reusable include file plus a self-test expert that proves the behaviour in the strategy tester.

A closed-bar M5 indicator combining market structure, liquidity sweeps, BOS/CHoCH and momentum to display Entry, SL, TP1 and TP2, with retail-frequency signals and clickable setup history.

An MT5 fair value gap scanner that marks bullish and bearish imbalances and tracks when each zone is filled.

A broker time session map for MT5 that displays Asia, London and New York ranges with their confirmed highs and lows.

A clear MT5 market structure indicator that labels confirmed HH, HL, LH and LL swings directly on the chart.

A compact MT5 trend dashboard that compares EMA alignment and ADX strength across six timeframes.

The script prices one night of holding: for every open position and every Market Watch symbol it prints the swap per night in your account currency, the annualized cost in percent for both directions, the broker's rate-independent markup (|swap long| + |swap short| never depends on interest rates - it is pure broker margin), and the triple-swap day. Honest "n/a" where a swap mode cannot be converted reliably.

A small educational Expert Advisor for MetaTrader 5 showing one simple way to combine classic fixed-size Renko bricks with a SuperTrend-style trend state.

Manage orders, existing orders, limit orders, trailing, break event & Lot size calculator in one tool

A small educational Expert Advisor for MetaTrader 5 showing one simple way to automate support and resistance reactions with internally built classic Renko bricks.

GDS Renko Fast Demo is a small educational Expert Advisor for MetaTrader 5. It demonstrates how two internal fixed-size Renko streams can be used in a simple mechanical trading example without offline charts or custom symbols.

A simple real-time classic Renko chart for MetaTrader 5. Set the brick size and the indicator builds equal-width Renko bricks directly from tick data. No offline charts, custom symbols or external libraries are required.

A simple MT5 indicator that shows the current fixed-size Renko run and the exact price level required to confirm a classic two-brick reversal.

Free MT5 indicator that automatically maps Fibonacci levels across multiple timeframes and highlights confluence zones, market structure, premium/discount areas and key price reactions.

Marks the start/end of up to three trading sessions (Asian, London, New York, or any custom windows) with vertical separators and/or shaded background boxes, repeated daily across a rolling recent window. Purely visual — no calculations, no signals, just clean session boundaries.

Automatically detects swing pivots and labels a rule-validated Elliott Wave count (1-2-3-4-5 impulse and A-B-C correction) directly on the chart, with a Fibonacci info panel. For guidance only, always confirm manually.

A lightweight MT5 chart indicator that displays live broker and symbol trading specifications including spread, tick size, tick value, volume limits, stop level and freeze level.

Calculates a non-repainting Nadaraya-Watson envelope using Gaussian smoothing and marks price crosses beyond the upper and lower bands with arrows.

A draggable MT5 risk calculator that converts the selected entry and stop distance into a broker normalized position size using tick size, tick value and account risk.

A read only MT5 script that reports broker symbol specifications, volume limits, price settings, execution modes, trading permissions, margin requirements and estimated profit values.

Market Structure & Smart Trade Tracker (MT5) An advanced all-in-one Smart Money Concepts (SMC) indicator that combines automated market structure mapping, momentum heatmap candles, and institutional trade execution tracking.

Adaptive MACD is a dynamic momentum indicator that adjusts its smoothing based on market conditions. It calculates a Pearson correlation coefficient between price and bar index over a user-defined period, then uses the resulting R² to blend two different MACD coefficient sets. This makes the MACD line more responsive during strong trends and smoother in sideways markets. The indicator plots a color-coded histogram (strong/weak bullish/bearish) and an optional auto-contrast MACD line that adapts to the chart background. Inputs allow customization of the R² period, fast/slow lengths, signal period, and colors. Suitable for trend-following and detecting momentum shifts.

Market Replay Tool is an MT5 utility that seamlessly merges a Market Replay simulator with interactive TradingView-style Long & Short drawing tools. It allows traders to backtest strategies on historical data with adjustable playback speeds, while effortlessly mapping out risk-to-reward setups using dynamic, draggable entry, stop-loss, and take-profit visual boxes directly on the chart.

123456789101112...209