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

MQL5 Source Code Library for MetaTrader 5 - 2

This is the largest free source code library for MetaTrader 5 platform programs. Here you can find ready-made Expert Advisors, technical indicators, scripts and libraries. Use the code library when learning MQL5 language and develop your own automated trading applications based on the provided codes.

You can freely download and test published codes, as well as launch them in MetaTrader 5. The library is also available directly from MetaTrader 5 platform and MetaEditor development environment.

Submit your code
latest | best

This EA collects information about the spread and shows the statistics on the chart. When the EA ends its working, it prints all statistics to the Journal, which can be useful for the Strategy Tester.

an in-place comparison sorting algorithm

Published by John Ehlers in "Stocks & Commodities Dec. 2020" (16-18).

This unit test frameworks eases the development of unit tests for more complex expert advisor programs. The MQL5 developer can test single components. The test framework starts the strategy tester so that there is test data available if required. I am using the framework to do test driven development (TDD) on my MQL5 programs.

an in-place comparison sort

This is a simple EA test code I made for adapting Candlepatterns.mqh

Kral is an example of an expert advisor, where you can see how and in what way, buy/sell signal can be generated based on an indicator color change. Of course, in order to be able to use this example, and apply them in your code, the NN indicator must have these options (buffer) available first.

This script is made to close all positions

a much more efficient version of selection sort

an efficient, general-purpose sorting algorithm

Ea working well on EURUSD1 H1 with initial parameters, using a simple strategy based on Bollinger bands and RSI.

A sorter class to sort an array based on other arrays.

The 8 effective steps to build a robust day trading plan using Fibonacci retracement

Copy trading has become such a critical feature of forex trading. Some people see this as a potential business opportunity, while for opensource die-hards like me, we believe in giving back to the community rather than putting a price tag on everything 'nice'. So here it comes. A free opensource trade copier, which you are freely allowed to modify and distribute according to MIT license terms. It still has limited features, but the essentials like lot normalization are there. Please note that this copier only works for trading terminals installed on the same machine. Please share back any upgrades, enhancements or bug fixes to the discussion. Enjoy!

a highly efficient sorting algorithm, based on partitioning of array of data into smaller arrays

The indicator displays a colored moving average.

A Sample of Averaging Up/Down Martingale EA.

represent an operation to be performed on the elements of an object structure. visitor lets you define a new operation without changing the classes of the elements on which it operates

define the skeleton of an algorithm in an operation, deferring some steps to subclasses. template method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure

Print info about a closed position by its position ticket or identifier.

Stock trading indicators. BIAS.

ADR,AWR,AMR,Draws Average Range Lines

define a family of algorithms, encapsulate each one, and make them interchangeable. strategy lets the algorithm vary independently from clients that use it

Reflex and Trendflex was created by John Ehlers ("Stocks & Commodities Feb. 2020 (6-8)").

Draws Pivot Points Level Lines for formula's Floor,Fibonacci,Camarilla,Woodie

The Stochastic RSI indicator (Stoch RSI) is essentially an indicator of an indicator. It is used in technical analysis to provide a stochastic calculation to the RSI indicator. This means that it is a measure of RSI relative to its own high/low range over a user defined period of time. The Stochastic RSI is an oscillator that calculates a value between 0 and 1 which is then plotted as a line. This indicator is primarily used for identifying overbought and oversold conditions.

The 8 effective steps to build a robust day trading plan using Fibonacci retracement

This is a module for MQL5 Wizard and Standard Library, which allows you to generate expert adviser based on arbitrary set of indicators and conditions.

allow an object to alter its behavior when its internal state changes. the object will appear to change its class

Doulble MA Cross Draw Histogram MT5

An (optional) include file to enhance error code handling experience.

Indicator Camarilla Points "Stocks & Commodities V. 31:3 (pg. 10-15)"

An (optional) include file to enhance debugging experience.

define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically

Indicator "The 2 Pole Butterworth Filter". was created by John Ehlers ("Cybernetic Analysis For Stocks And Futures", p. 192)

define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically

Keltner channel with standard averaging and averaged over the ATR indicator.

This strategy is the well known set & forget with the ALERTING system. It is very useful on different trading scenarios. I urge you guys to always use trading tools that will make your live easier. So instead of watching the charts and the time and all day long, you can use this indicator that will watch the charts for you.

Trend indicator

123456789...172