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

Submit your code
PNG

Forget about BMP files like a bad dream. Thanks to this library, you can now use the PNG format, which has a number of advantages, such as being more compact without losing image quality and maintaining transparency.

In the fourth part of the book, we will focus on mastering built-in functions (MQL5 API) and will gradually delve into specialized subsystems. Any MQL5 program can utilize a plethora of technologies and functionalities. Therefore, it makes sense to begin with the most simple and useful functions that can be utilized in most programs.

The Heiken Ashi indicator with no repaint or repaint mode input option.

This indicator is designed to draw a Fibonacci retracement, using as a basis the ZigZag indicator.

Translate risk percentages to the monetary figure based on the account balance

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.

Time-related functions for empirical detection of server time zone and daylight savings mode (DST) from history of quotes

This script saves a predefined set of economic events from the MetaTrader's built-in economic calendar into CSV file.

Marking the extreme highs and lows (OHLC) together with the extreme bid and ask prices

This indicator displays current events on the chart and allows you to export the calendar to archives for backtesting, automatically fixing time discrepancies between the history of bars and the history of events. This is an improved version of CalendarMonitorCached indicator from the algotrading book.

BollingerBandsEA trades according to Bollinger Bands.

Unfortunately, I discovered that some brokers are a bit sloppy with the server time change due to the daylight saving time (DST), which I did not expect and which surprised me a lot. Here is a script with which anyone can check their broker.

BMA MetaTrader indicator or Band Moving Average — was created by using the original moving average indicator and the idea from one of the site's visitors. The indicator displays itself in the form of three lines: the central one is the standard MT4/MT5 moving average (which can be simple, exponential or weighted), the upper line is the same as the central one but lifted up by 2% (by default), the lower line is the same as the central one but pushed down by 2%. Those two additional lines serve as the support and resistance levels. The indicator is available for both MT4 and MT5.

Bollinger Squeeze Advanced MetaTrader indicator — is a complex indicator consisting of two components: A measure of trendedness based on the Bollinger bands and Keltner channel "squeeze". A trend direction and strength histogram based on one of the following eight oscillators: Stochastic, CCI, RSI, MACD, Momentum, Williams % Range, ADX, DeMarker.

Coppock MetaTrader indicator — is an implementation of the famous Coppock curve indicator first created by Edward Coppock in 1962. The indicator shows long-term buy and sell opportunities (classically, it is used for only buying) by measuring the weighted moving average (with a period of 10) of the sum of two rates of change (with a period of 14 and 11). It is the classical version. In this MetaTrader version, you can modify the parameters of the basic indicators. You can use this Coppock indicator in MT4 and MT5.

Laguerre MetaTrader indicator — a completely custom indicator that doesn't rely on the standard MT4/MT5 indicators. It shows the weighted trendline in the separate window of the chart. It can be used for simple entry and exit signals. The indicator is available for both MT4 and MT5.

TD Sequential Ultimate MetaTrader indicator shows all parts of the TD Sequential method developed by the legendary technical analyst, Tom DeMark. TD Sequential Ultimate displays Buy and Sell Setups, including the Setup Perfection arrows, Buy and Sell Countdowns, including the failed count 13 attempts, and TDST Support and Resistance levels. Unlike many other implementations of the TD Sequential method, this indicator offers multiple improvements:

An indicator which visualizes how volume changes over time within each bar. It shows tick volume in a rolling histogram format.

This is a simple indicator to display histogram of custom bars' durations in minutes. Applicable for renko boxes, PnF, equivolume bars, etc.

A SuperTrend indicator that plots trend direction using ATR volatility to create dynamic support/resistance levels for MetaTrader 5.

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.

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

Dynamic VWAP level which can be averaged over multiple days

Calculate DST for USA, EUR, AUD and RUB and the offset time of the broker automatically from the 70's until 2030 - even in the Strategy Tester of MQ.

The final seventh part of the book discusses the advanced capabilities of the MQL5 API, which will be useful when developing programs for MetaTrader 5. These include custom financial symbols, built-in economic calendar events, and general-purpose technologies such as networking, databases, and cryptography.

In Part 5 of the book, we'll delve deeper into the APIs associated with algorithmic trading, including financial data analysis and processing, chart visualization, automation, and user interactions.

The source codes written during the development of the library for creating multi-currency Expert Advisors that combine many instances of various trading strategies.

This EA help you for Auto set the TP & SL by default parameter, Auto trailing stop & step for any order that you place from any device, Easy way to close all orders with 3 Button "Close All" "Close Profit" "Close Lose", Auto close all orders by profit or lose treshold value

Linear Regression Value indicator with an option that allows it to be applied to another indicator

WeekDays indicator displays Day Of Week, Week Of Year, Day Of Year or Bar Index in the Data Window, and optionally in labels on the chart.

Part 2 "MQL5 programming fundamentals" is an introduction to the key concepts of this programming language. This part of the book is devoted to data types, identifiers, variables, expressions, and operators. You will learn how to combine different instructions to form the program logic.

AO - Awesome Oscillator - without iAO() beginner tutorial to learn how to code in MQL5

Copy and paste selected graphical objects between charts via Windows clipboard as text. Use Ctrl+Q on a source chart, then Ctrl+J on a target chart.

A new interface library has been developed to simplify the process of converting MT4 indicators and Expert Advisors (EAs) to MT5. This library supports most of the MetaTrader 4 functions, offering developers a unified solution for cross-platform compatibility.

Rsi without Irsi() beginner tutorial to learn how to code in MQL5

Correlation Coefficient" indicator

Linear Regression Slope

Rsi Indicator

An advancement of the MetaQuotes zigzag with an oscillator mode, current bar leg tracking, fib levels, and dynamic scaling

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189