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

MQL4 and MQL5 Source Code Library

icon

You don't know where to start learning the MQL5 or MQL4 programming language? Various programs for your MetaTrader terminal are available here. Download and study published code examples, develop your own indicators and Expert Advisors. Publish your applications in the largest library of MQL5 and MQL4 codes, and they will be available in every MetaTrader terminal and MetaEditor.

Your code examples in MQL4 and MQL5 will be distributed worldwide, and thousands of traders will know about you!

Submit your code

This indicator will shows the time remaining until the end of the candle. You can choose colour and the font size.

A moving average of pure tick volume with histogram bars tracking bullish/bearish candle color

Takes trades based on ICT silverbullet and 2022 model with trailing stops and partials, also keeps entry according to OTE, and risk minimal. It works in a small time window of silver bullet especially NY session, and if no trade found, 2022 model and fibonacci OTE jumps in to get a trade. But entry is so only after confirmation with these models being there, hence trades will be less for minimal drawdown and high winrate. To know more about these strategies, you may visit Inner Circle Trader YouTube channel.

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.

MACD Divergence indicator

Two Symbol Spread Indicator

Indicator for calculating the average price of open positions, you can use the magic number if you want to separate the positions of just one robot, but the zero number is for manual operations.

Better Volume is an advanced indicator designed to analyse the behaviour of volume on price charts. It combines volume information with metrics such as candlestick range and moving averages to identify important patterns in the market, such as buy/sell climaxes, churn and weak candles. With its dynamic visual interface and volume categorisation, the indicator offers valuable insights for traders who want to make informed decisions based on volume flow.

My first code on the site, which requires improvement. The idea to create an ideal tool for traders, in the work on the main component of any trading system-Risk Manager

This CalculateHistoryProfit script version 1.0 is designed to calculate profit for a specified period using a chart panel.

Volatility Stop - indicator of stop levels by volatility

Ergodic oscillator Stochastic Momentum Index (SMI)

The "Net Volume" indicator shows the volume taking into account the pressure of sellers and buyers

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

Correlation Coefficient" indicator

Chaykin Money Flow (CMF)" indicator

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.

A volume oscillator is a useful technical analysis indicator that predicts the strength or weakness of price trends

EquiPeak Drawdown Tracker is an indicator designed to monitor and record the maximum drawdown of your trading account in real time. It's not just a current drawdown indicator; it's especially useful for visually comparing your current drawdown with the maximum historical drawdown you expect or have previously recorded.

Kuskus Starlight is an oscillator that utilizes a Fisher price transformation to identify trends and potential reversals. The original MT4 code by Scriptor is available at: https://www.mql5.com/en/code/8365.

Candle Signature with Example | For Research and Development

This is a simple mean reversion EA

A logger with the ability to log specific modules or code sections

Chande Kroll Stop indicator - stop levels for short and long positions.

changing character prices on an interval

The indicator draws an arbitrary second timeframe on the chart.

This is a simple analytical (non-signal, one-time calculated) indicator that allows you to test the hypothesis that price timeseries represent a "random walk", specifically Gaussian "random walk". This can help to construct a parametric transformation of price increments into evenly distributed, more stable and predictable time series, at least in terms of volatility.

The indicator shows the angle or average speed of price change.

Fast JavaScript version of Report library from fxsaber for MT4-style trading commands implemented via MT4Orders or Virtual. Works up to 10 times faster, NTML file size is smaller, can upload and display up to 5.4 million report lines.

Strategy based on the standard indicator iCHO (Chaikin Oscillator, CHO) and custom indicator 'CCIDualOnMA'

Panel based on CDialog class. Work on the current symbol. Deleting, setting Take Profit, setting Breakeven on a group of positions

This library allows you to create displays to easily output text information to the chart at the most optimal rate

Multiple runs/optimisations in Tester.

Construct a moving line with a polynomial of 4 degrees. Extrapolates the sinusoidal and its axial. The constructed lines remove one value at each bar and a sliding line of extrapolated values is constructed which is not redrawn.

Trading system by iMA indicator (Moving Average, MA). Development of MA Trend.

Algorithm cycle: when there are no open positions, open two opposite positions. Wait for both positions to close.

This Bot detects the open of a new candle on any set timeframe, thereby making it easier to run a one-time code, place trades and call other functions. The code is written in the OnTick() function.

Detecting the start of a new bar or candle in an Expert Advisor's OnTick() event handler.

Calendar - fundamental analysis on history and real-time.

Tester's single pass data.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188