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

MQL4 and MQL5 Source Code Library


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

Time Left To New Bar Watch

The script obtains information about the number, types and sizes of input and output tensors in an ONNX model

Script gets information about input and output tensors of onnx-model, their types and shapes

Official example involve complex wrapper classes, Here is a simple one

This Script will Refresh All Open Charts in MT5, Usually custom symbols in MT5 needs to be Refresh sometime so this script will help to refresh all open chart at once. We can also use this Script anywhere where we need to refresh all open charts.

Pivots based on Bar Prediction.

This expert advisor is based on the alligator indicator and bollinger bands indicator. Currency pair: GBPAUD Time frame: 15min

Reversal strategy using Moving Average, Standard Deviation and RSI

US: This is a very simple code regarding an information panel. It doesn't use external files or anything like that! simply copy and paste it into your code the way the code was written. The dashboard displays; Active asset price Your position(Bought or sold) Maximum and minimum price of the asset Username open profit Balance PT-Br:Esse é um codigo bem simples a respeito de um painel de informações. Não utiliza arquivos externos ou algo do tipo! simplesmente, copie e cole no seu codigo da forma que o codigo foi escrito. O painel exibe; Ativo Preço do ativos Sua posição(Comprada ou vendida) Preço max e minimo do ativo Nome do usuario Lucro em aberto Saldo

Rsi close/ mtf use

MTF divergence settings

Weighted deviation bands

Weighted deviation

Get commission of an active position in mt5 , its easy to use function.

The DD_Relative function calculates the drawdown (relative loss) of the current trading account in percentage. To do this, it uses the Current_LossOrProfit() function to get the current profit or loss for all open positions and divides it by the current account balance. The result is rounded to two decimal places and displayed in the chart comment. The Current_LossOrProfit() function loops through all open positions in the account and adds the commission, swap, and current profit or loss for each position. The result is rounded to two decimal places and returned as the current profit or loss of all open positions.

Hurst Exponent - optimized version

The function takes two arrays of integers as parameters: "allowedPeriods" and "periodsToCheck". "allowedPeriods" is an array containing all the time periods allowed by the system, while "periodsToCheck" is an array containing the time periods used by the user in the indicator. The function iterates through the elements of the "periodsToCheck" array and checks if each of them is present in the "allowedPeriods" array. If it finds any time period that is not allowed, the function returns "false". If all time periods are allowed, the function returns "true". In short, this function is used to make sure that the time periods used in an indicator are valid and allowed by the system.

CLS (ClearScreen) delets all object drawn on the chart with key press "C"

Advanced Line Chart based on Japanese candlesticks.

The code defines a function "RangeHighs" that calculates the highest price of a financial instrument within a specified time range (start and end time). The time range is defined by 4 input parameters (hour and minute of start and end time). The highest price is found using the "CopyHigh" function and stored in an array, from which the maximum value is returned.

a Template for Multicurrency system for Metatrader 5

An implementation of the Relative Strength Index indicator by John Welles Wilder Jr. as described in his book—New Concepts in Technical Trading Systems [1978].

An implementation of the original Average True Range indicator by John Welles Wilder Jr. as described in his book—New Concepts in Technical Trading Systems [1978].

Strategy that uses the CCI indicator 0-line cross to spot trades and the MACD indicator to confirm them.

Shows moving Last Price on Bid Line, LAst 24 hours percentage change, switch chart from arrow keys and more..

Forex Trade Manager MT5 simplifies managing open orders in MetaTrader 5.

Forex Trade Manager Grid MT5 helps you to managing orders and achieve the goal.

The 64-bit xoshiro256** Random Number Generator.

RSI Bot, send alert buy when RSI<=20, send alert sell when RSI>=80

Based on the original “Time Segmented Volume (TSV)” developed by Worden Brothers, Inc.

Parmis les 5% des traders les plus performant du desk ''Options Dérivées'' de la Société Générale. PnL 22MEUR entre 01/01/2022 au 27/12/2022

The equation of the straight line from the school, it is y = bx + с. (Conversion from

Volumes Spread mod

Smooth Algorithms - Corrected/Modified

Sort the input array in-place using comparison function less.

Volume Average percent spread mod

- This Bot use stratery Breakout of Daily Bar, I tested for 3 Pair currency : GBPUSD, EURUSD, XAUUSD - Default setting is not sure the best, you can test for your parameter. - This is version for MT5 that convert from MT4 - this EA is best for broker low spread

It is known that the market is mainly driven by two emotions: fear and greed. This should be seen as an attempt to implement these emotions in the form of a mathematical model.

for export/import of orders and trades between EAs and terminals

The Roofing Filter Indicator was created by John Ehlers ("Cycle Analytics for Traders" pg. 80 - 82).