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

Submit your code

CCI Arrows MetaTrader indicator — will show you where the CCI cross with the zero occur (marking it with the red or blue arrow) to help you decide whether to go short or long. It has a minimal lag and a relatively high accuracy. This simple indicator is a good choice for those traders that prefer to keep it simple and hate complex indicators. CCI Arrows supports all types of alerts. The indicator is available in MT4 and MT5 versions.

Donchian Ultimate MetaTrader indicator — is a classic Donchian channel indicator with multiple features added:

Easy Trend Visualizer is a MetaTrader indicator that does exactly what its name says. It shows where the trend begins, where it ends, and where there is no trend at all. It is based on standard MetaTrader ADX (Average Direction Movement Index) indicators and works quite fast. Easy Trend Visualizer displays itself in the main chart window. It offers a range of alerts: horizontal line appears, horizontal line cross, arrow up, arrow down, previous horizontal line cross (PHLC). Available for MT4 and MT5 platforms

A zigzag indicator that uses a single input to adjust the step size for detecting wave direction changes

This MQL5 custom indicator detects divergences between price action and the Awesome Oscillator (AO), signalling potential market reversals or continuations. It plots buy/sell arrows on the chart, displays the AO as a histogram, and draws trendlines to highlight divergences.

Indicator that displays the day's trend at any chart time. You can customise the colours and position of the text on the screen.

Good afternoon everyone) First time posting my code!!!

Countdown is an advanced indicator designed for traders who want to track the time remaining until the next candlestick or the next market open clearly and efficiently. With three flexible display modes (commentary, chart borders or next to price), this indicator offers a customisable solution to suit your trading needs.

The XMA_Ishimoku indicator with additional trend strength indication using colored dots based on the standard deviation algorithm. The original code in the attached link had plotting problems.

Trading XAUUSD (Gold) is often influenced by major economic news events like USD, GBP, or EUR releases. To mitigate risks during these volatile periods, using a News Filter in your Expert Advisor (EA) is essential. In this article, I’ll share how to create a simple News Filter on MT5 and apply it to XAUUSD trading.

This EA is meant to impose a few rules to manage baskets.

Logify is a logging library for MQL designed to simplify debugging, tracking, and monitoring of EAs and indicators. It provides structured, customizable, and organized logs directly on the chart or in the terminal, with support for log levels, flexible formats, and multiple handlers. A lightweight, elegant solution that is easy to integrate into your MQL projects.

This indicator is a utility that shows labelled trade levels on any chart. If you want to replace your native trade levels on a native chart, then turn off "Show trade levels" in your F8 Chart Properties and attach this indicator. If you want to show trade levels on a Custom Chart (where native trade levels cannot be shown), then simply attach this indicator. BaseSymbol - specify the Symbol from which the trade level data will be pulled--handy for unique Custom Symbols. TextBarsBack - specify the number of bars back in history from the current bar where the level labels will be drawn. Note: Although magic number is referenced in the code, it is not presently included in the trade lines. If you're running multiple EA's on the same Symbol, you can edit the code to show magic numbers and then run multiple instances of the indicator on one chart. You can also edit the font sizes and text spacing in the object properties as needed for different display resolutions.

Combines a Moving Average with ATR-based upper and lower bands to act as a trend filter and volatility channel.

The indicator displaying multi level of ATR Channel.

Fractal with CCI Filter - Indicator that combines traditional fractals with the CCI filter to reduce false signals. Shows red arrows above the candles for bullish fractals (sell) when the CCI is above the configured threshold and green arrows below the candles for bearish fractals (buy) when the CCI is below the negative threshold. Perfect for identifying reversal points with greater reliability.

PriceVar% is an indicator designed to measure the percentage difference between the price and a moving average, highlighting the strength of the market movement in relation to a reference value.

Instantly calculate the profit and loss potential of your trades directly on the chart. An essential tool for agile and precise risk management.

The script removes all autotrading icons from the current chart

WaveWeisBarForce is a custom indicator based on Weis Waves logic. It accumulates volume into directional waves (bullish or bearish) and displays them as histograms with intensity levels. Bullish waves: 4 levels of green, from light to Lime. Bearish waves: 4 levels of red, from light to Red. WaveMax (white): shows the bar with the highest volume inside each wave. WaveClimax (yellow): highlights record accumulated volume across waves. This indicator helps traders visualise market pressure by volume accumulation and wave intensity, improving intraday and swing analysis.

MACD Histogram

A simple indicator based on Bollinger Bands showing its narrowing and widening phases with red/green colours.

Scan multiple symbols and timeframes for wick-based rejection candles and display the latest signals in a clean on-chart dashboard with strength scoring, signal age, optional markers, and alerts.

Market Structure Expert Advisor use LightGBM (Light Gradient Boosting Machine)

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 Expert Advisor (EA) is designed to detect swing highs and lows on the H4 timeframe, then wait for sweeps (liquidity grabs) on the M15 timeframe to trigger buy/sell trades with defined risk management.

A comprehensive stop-loss and trade management module offering multiple stop-loss methods (Fixed Pips, ATR-based, Swing High/Low, and Percentage) and trailing stop options (Fixed, ATR, Step, and Breakeven). It includes automatic broker stop-level adjustment, risk-reward–based take profit calculation, and visual stop-loss lines on the chart. The code follows a clean, structured architecture with a dedicated `CStopLossManager` class, standardized enums and structures, and fully documented English comments for clarity and maintainability.

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.

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.

This Expert Allows You To Run and Play DOOM (The Game) on MetaTrader5! It's A Take On The Infamous "Can It Run Doom?" Challenge.

A professional trade management utility that completely hides your Stop Loss and Take Profit levels from brokers. It features a Spread Protector to prevent virtual stop-outs during news events or daily rollovers.

An institutional-grade dashboard that breaks down your open positions and calculates your true net lot exposure per individual currency, preventing invisible systemic risks and over-leveraging.

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.

12345678910111213...198