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 - 5

Submit your code

Super pass-band filter as described by John Ehlers

This function allows you to retrieve and return the filling policy of a symbol in MetaTrader 5. This is useful for making trading decisions based on the filling policy of a specific financial instrument.

This is an edit of the Mod_ATR_Trailing_Stop by MQL5 user @Scriptor found here https://www.mql5.com/en/code/20423 . MT5 indicator .mql5 and .ex5 files, report any bugs, I'll fix.

Multi_BreakEven is a script file that enables setting multiple entry positions to breakeven, either through pips or a target price, once the trade becomes favorable.

This Expert Advisor does not trade. A simple panel, implemented using the standard Canvas library, allows you to draw digits with the mouse. The trained mnist.onnx model is used to recognize the digits.

The EA only trades buy positions and does not use Sl and TP.

CDateTime milliseconds extension + datetime supervisory variable extension

Historical Strong S/Rs Levels

Average Daily Range Indicator.

Know Sure Thing (KST) oscillator indicator based on the rate of price change (ROC)

Select the last closed deal (trade) to further work.

Ergodic oscillator Stochastic Momentum Index (SMI)

This is a first for MetaTrader 5. Now you can click on the chart to create price alerts.

MovingAverages.mqh Part II A multi timeframe version is available with colors for orientation, for developers or profitable traders for free. Offer under conditions. Other multi timeframe indicators are also available.

This script saves all the OHLCV data available on the chart to a CSV file.

PTB

Indicator Description: PTB.mq5 Overview: The PTB.mq5 indicator for MetaTrader 5 calculates short-term and long-term high and low prices, along with Fibonacci retracement levels based on these extremes. Features: Short-Term High and Low: Identifies immediate support and resistance over a user-defined short length. Long-Term High and Low: Analyzes broader market trends over a longer period. Fibonacci Levels: Plots key retracement levels (23.6%, 38.2%, 50%, 61.8%, 78.6%) for potential reversal points. Input Parameters: shortLength: Number of candles for short-term calculation. longLength: Number of candles for long-term calculation. Visual Representation: Distinct colors and widths for each line to differentiate between high/low and Fibonacci levels. Usage: Helps traders identify entry/exit points and monitor market trends based on historical price levels.

This code shows how you can create a dashboard to display all the relevant information on the chart

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

Support and Resistance MetaTrader indicator — as the name of this indicator suggests, it displays the support and resistance levels. It shows them directly on the chart, providing an easy help when you want to set stop-loss or take-profit level, or when you want to see the next market target. This indicator uses the standard MetaTrader Fractals indicator (by Bill Williams' method) and has no changeable input parameters. This indicator is available for MetaTrader version 4 and 5.

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

The Clean Market Watch script is a simple utility tool designed to quickly remove all symbols from your MetaTrader 5 Market Watch window with a single click. This is particularly useful when you want to start fresh with a clean workspace or when your Market Watch has become cluttered with too many symbols. Purpose Over time, traders often accumulate numerous symbols in their Market Watch window, making it difficult to focus on the instruments they actively trade. Manually removing symbols one by one can be tedious and time-consuming. This script automates the entire process, clearing all symbols in seconds.

123456789101112...195