MQL5 Source Code Library for MetaTrader 5 - 4
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
Clean and efficient Anchored VWAP (AVWAP) indicator for MetaTrader 5. Calculates volume-weighted average price from a user-defined anchor date with optional volatility standard deviation bands.
Smart Money Concepts market structure on pullback swings: trend, BoS, CHoCH, IDM and liquidity sweeps. A level counts as taken only on a close — a wick through it is marked as a sweep (x) and relocates the swing. Self-contained, closed bars only.
QCL Heikin Flow applies two-stage smoothing to Heikin Ashi candles, helping traders filter price noise and visualize trend direction. Features adjustable smoothing periods, four moving average methods, and customizable candle colors.
EMA(10) x EMA(30) scalper for XAUUSD on the M15 timeframe with a Jakarta session filter. Educational example: fixed lot size, SL/TP in points, maximum of 1 position, spread filter. Tested on 100% real ticks.
Support and resistance channels built from price pivots and ranked by strength: each pivot inside a channel and each bar that touched it adds to its score. The strongest channels run across the whole chart, colored by where price is, with break arrows, pivot marks, two averages and alerts.
Exports bars to a CSV file that pandas.read_csv() loads without encoding, separator or date-format arguments: ISO 8601 timestamps, prices at the symbol's own digits, single-byte encoding. Two modes (last N bars or a date range) and a switchable separator for Excel.
Shows the range of every bar in points, its moving average (SMA or EMA) and a suggested stop distance (average x factor). A stop tighter than the typical bar range gets taken out by ordinary noise; the indicator makes that threshold visible in points, the same unit a stop loss is set in.
Shows what every buffer of an indicator holds - arrows, a line or a colour index - and labels the arrows on the chart with their buffer numbers. Works with compiled indicators without source code.
Asian, London and New York session high/low boxes with ICT killzone shading, breakout alerts and average-range statistics panel.
open-source grid trading EA with on-chart control panel
Shows the prices of the current symbol at which the account reaches margin call and stop out, with a what-if mode for extra volume, the maximum volume you can add and pending orders that trigger on the way.
Overlay higher timeframe candles directly onto your lower timeframe charts with customizable body fills, independent borders, and precise wicks. Effortlessly spot macro bias, session openings, and liquidity ranges without switching screens. Ultra-lightweight engine featuring separated box bounds and rock-solid chart change auto-recovery.
Calculates the lot size for a chosen risk percent and stop loss distance, and shows the result in a clean panel on the chart.
Before configuring a basket, see which target weights fit your broker's minimum lots. Portfolio Allocation Planner turns an explicit hypothetical notional budget and percentages into a chart table: minimum-lot notional, lots rounded down, calculated allocation, target shortfall and row status. Recalculate on demand, inspect row tooltips, paginate longer lists, and optionally export the displayed snapshot to CSV. No trades are sent and no account balance, equity or positions are read.
Read-only MT5 script for exact Market Watch symbols: contract and volume rules, quote age and spread, isolated BUY/SELL margin, one-tick price moves and spread-only results in account currency. MIT source; Experts journal output.
Independent Risk Guard for AI Agents in MetaTrader 5.
A lightweight manual trading panel for MetaTrader 5 with market order execution, risk-based position sizing, Break-Even, partial close and position management. Works in both live trading and the Strategy Tester.
Writes the trading specification of every symbol to a CSV file: volume step, filling modes, stops level, tick value and more.
DailyLossGuard — Hard Daily Loss Protection (Prop-Firm Challenge Essential)
Reads the server clock from the symbol's own H1 history. The forex and CME week closes at 17:00 New York, so the server time of every weekly close gives the server's UTC offset for that week. Over 60 weeks it flags irregular closes, dates every clock change and tests it against the US and European daylight saving calendars, cross-checks TimeTradeServer minus TimeGMT, and lists the server time of the London, New York, Tokyo and Sydney opens for the coming weeks. Writes every close to CSV. Read only: no trade function, no DLL, no network.
Shows how much of the daily loss limit of a prop firm account is already used, and how much is left. Read-only indicator.
Measures how far your PC clock is from the trade server's clock, from the server time stamped on live ticks, and tells you how to fix it.
Regular and hidden divergences between price and ten oscillators calculated inside the indicator: MACD, MACD histogram, RSI, Stochastic, CCI, Momentum, OBV, VWMACD, Chaikin Money Flow and MFI. Lines on price, a box naming every oscillator that agrees, and alerts.
Session Levels draws the reference levels intraday traders watch most: Asian range, London and New York sessions, previous day and week high/low, daily VWAP, swing points and round numbers. Hover any level to read what it is and why it matters. Optional alerts when price breaks the Asian range or the previous day high/low.
Real-time multi-timeframe side panel mini-chart with smart color matching, independent price scale, and candle countdown timer.
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.
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.
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.
Displays the symbol properties that cause the same EA to behave differently on a different broker: trading hours, contract size, tick value, spread statistics, swap cost and real-session coverage. Read-only; does not execute trades.