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

an in-place comparison sort

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

Expert Advisor

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

without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later

McGinley dynamic (official version - as described by John R. McGinley)

Minimum / maximum support resistance zones

For day traders. 2 highly important indicators to turn strategies into extreme winning ones. The Win/Loss ratio and the Reward/Risk ratio will allow us to identify the best times and days our strategy works the best

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171