Watch how to download trading robots for free
Find us on Telegram!
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

Top MQL4 and MQL5 source codes based on user ratings - 7

Submit your code

Function for modifying open positions and pending orders

Allow the EA to determine whether there are duplicate EAs on the chart based on conditions.

A simple binary trading strategy that counts candle colors.

This indicator combine WPR and total profit/loss. I don't know how to tell you more about this indicator but you can try it.

Trend based grid Expert Advisor for MetaTrader 5 using EMA and RSI indicators. Dynamic lot size is calculated from account balance with minimum and maximum lot protection. Initial trade opens when price confirms trend direction relative to EMA and RSI levels. Grid orders are added at fixed point distance using controlled multiplier. All trades are managed as a basket and closed at defined profit target or maximum loss level. Includes optional news hour pause and market close filter. No DLL or external services required.

Include-file class that measures inter-tick latency, filters false alarms via a self-normalising ATR volatility gate, and broadcasts persistent lag alerts to other EAs via GlobalVariable IPC.

ExMachina Safe Scalping is a professional-grade Expert Advisor built for conservative breakout scalping on Gold (XAUUSD), Silver (XAGUSD), and Forex majors.

Real-time prop firm rule tracker: daily drawdown, max drawdown, profit target progress, trading days count, and challenge status with visual progress bars. Presets for FTMO, MyFundedFX, E8, TFT, and Bulenox. Pure indicator — no trade interference.

A lightweight tick-driven dashboard that reveals short-term Bid-Ask pressure directly on the chart.

Trade With MA Trends ATR TPSL Line and The Line Of Pivot Point

Highlights Inside Bar candlestick patterns on the chart and provides optional popup and push alerts when a new pattern is detected.

Complete SMC toolkit: BOS/CHoCH detection, Order Blocks (internal + swing), Fair Value Gaps, Equal Highs/Lows, Premium/Discount zones, Strong/Weak H/L, trend candles, dashboard, 4-channel alerts. Free.

The standard MACD on MT5 platform seem to be not enough so I code this version by copying from the pinescript.

Portfolio Scorer is a standalone MQL5 script that evaluates the quality of a multi-EA portfolio across three critical dimensions that most algo traders overlook. The script reads daily profit and loss data from CSV files (one per Expert Advisor), computes a full Pearson correlation matrix between every strategy pair, maps trading activity by UTC hour and weekday, detects asset class diversity, and produces a weighted composite score with a letter grade from A+ to F. How it works: The tool runs in four sequential stages. First, the Data Loader reads and validates CSV files containing daily returns for each EA in the portfolio. Second, the Correlation Engine calculates the complete NxN Pearson correlation matrix and flags pairs that exceed a configurable threshold. Third, the Coverage Analyzer maps which hours and weekdays have active trading and identifies blind spots. Fourth, the Scoring Function combines all three dimensions into a single composite score using adjustable weights.

MT5 indicator showing bar index, price difference in points, and percentage change. Ideal for EA integration and fast analysis.

Institutional-grade forex session detection and analysis library for MetaTrader 5.

Runtime trade frequency adjustment library for MetaTrader 5.

Professional Telegram integration library for MetaTrader 5 EAs.

Institutional risk analysis library for MetaTrader 5. Zero external dependencies. Pure MQL5 mathematics.

Centralized indicator handle management library for MetaTrader 5 EAs.

On-chart candle analysis indicator with structure tags, sentiment, and trend arrows for MetaTrader 5.

Hon-APS (Advanced Pattern Scanner) is a sophisticated, open-source Expert Advisor for MT5. Unlike typical retail bots relying on lagging indicators, Hon-APS trades structural breakouts backed by quantitative Order Flow algorithms. It actively scans for classical chart patterns (e.g., Head & Shoulders, Bottoms, Triangles) and validates entries using L2 Order Book absorption and bid/ask imbalances. Complete with a polished on-chart UI, true Kelly Criterion risk management, and a robust macroeconomic news scraper, it's designed for prop-firm viability and high-end capital preservation.

ASQ PropGuard is a real-time prop firm rule monitor for MetaTrader 5. It tracks daily loss limits, maximum drawdown, profit targets, and trading day requirements — all displayed on a dark-themed chart overlay with color-coded progress bars and a live pass/fail verdict.

An unsupervised machine learning indicator that applies the K-Means clustering algorithm to historical price action, mathematically detecting and plotting the true institutional liquidity pools without human bias.

Swap Monitor Panel is a lightweight, fully customizable indicator that overlays a live swap rate dashboard directly on your MT5 chart. It scans every symbol in your MarketWatch window and presents long swap, short swap, estimated daily cost, and weekly cost side by side — all in one clean, readable panel.

Symbol Summary is a service for MT5 that opens a separate viewer window and shows a detailed report on a trading symbol. It supports Russian and English language, window resizing, scrolling, automatic report update when changing symbol or timeframe of the chart without restarting the service.

This mini custom-built MetaTrader 5 dashboard is a robust, comprehensive risk management and performance based monitoring tool and utility created to give both Prop firm and personal funded traders full visibility and control over their trading activity in real time.

Interactive Correlation Heatmap using high-performance MQL5 matrix functions. > Features a draggable, minimizable dashboard with instant multi-timeframe switching and a vivid 5-band color scale for real-time currency relationship analysis.

ASQ Order Executor — Institutional order execution wrapper for MQL5 EAs ASQ Order Executor provides institutional-grade order execution with automatic retry logic, slippage monitoring, partial fill handling, requote management, and comprehensive execution statistics. Drop it into any EA for production-ready trade execution.

A chart-cleanup + quick-trading layer for MT5

Utility script that exports your MetaTrader 5 trading history to a CSV file. It automatically calculates Maximum Favorable Excursion (MFE), Maximum Adverse Excursion (MAE), and Forward Returns (Time-Based Excursions) in whole points for deep quantitative analysis in Excel. It will allow you to understand whether you close your trades too early and can help optimize overall trading execution.

The Weekend Gap Statistics & Distribution Analyzer is a purely analytical MQL5 indicator designed to evaluate the historical behavior of weekend price gaps. It scans chart data to calculate gap closure rates and measures the adverse excursion (drawdown) experienced before a gap successfully closes. By providing statistical distributions—including the 70th and 90th percentiles of adverse heat—this tool enables traders to make data-driven decisions. It moves beyond simple averages, allowing traders to properly assess risk, filter out low-probability instruments, and optimize stop-loss placement when fading weekend gaps.

A quantitative Information Theory engine that calculates the Shannon Entropy of price distribution to mathematically measure market randomness and algorithmic predictability.

An aerospace-grade state estimation algorithm that dynamically filters out market noise and manipulation wicks to reveal the true underlying execution price with zero static phase-lag.

Triple-barrier labeling pipelines frequently use an arbitrary constant (0.5–1.0%) or a legacy spread assumption as the min_ret threshold. A threshold set below the actual round-trip transaction cost causes the pipeline to label cost-driven noise as tradeable signal. The labeled dataset then systematically overstates edge, and any model trained on those labels overfits to an artifact of the labeling scheme rather than to genuine market structure. TransactionCostCollector.mq5 is a standalone script that resolves the data-collection step of this problem.

Script to set Stop Loss on every open position based on a target loss in the account's currency (e.g. $50 per position). Works on any deposit currency and any forex symbol. Validates broker stops/freeze levels. Currency conversion handled automatically.

Educational MT5 chart panel for XAUUSD showing live spread, ATR volatility, EMA trend bias, RSI condition, daily range and active trading session.

A simple Expert Advisor based on the crossover of two EMAs (fast and slow), with configurable Stop Loss, Take Profit, lot size, and Magic Number.

Spread Meter — Live Single-Symbol Spread Tracker with Max/Min Record Spread Meter by Fox Wave is a sleek, single-symbol dashboard that displays the live spread of your current chart symbol in real time, while permanently recording the widest and tightest spread ever seen — with exact timestamps.

Swap Meter displays the live SELL and BUY swap rates for your current chart symbol in a clean, color-coded panel — and instantly alerts you the moment your broker changes either rate.

1234567891011121314...200