Download MetaTrader 5

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 Source Code Library for MetaTrader 4

The largest library features codes of free trading Expert Advisors, technical indicators and scripts. With the available applications you can trade in automated mode and analyze price dynamics. Use the library of codes to learn more about financial market sentiments.

Download free applications, test them and run in your MetaTrader 4. You can access them from the MetaTrader 4 platform and the MetaEditor development environment.


The header file contains functions and input variables for a time management.

The Proper Bot is for those who like Martingale style trading. Features: Stop Loss, Take Profit, Trailing Stop Loss functions. All are calculated in POINTS.

Precision trend (histo) - MetaTrader 4

Precision trend for MetaTrader 4.

Detrended Synthetic Price (oscillator).

Detrended Synthetic Price (bars form).

Detrended Synthetic Price (histogram form)

Experimental indicator I wrote for myself. It's made to show some reference (it's more like a rifle scope, than a rifle). Main components are pip scale, ATR/pivot, MA level, RSI, and spread alert. Can be used on any timeframe, but since it's made for scalping it is somewhat adjusted for M1-M15.

Various helper functions for sending messages of different types to different sources.

One of the best indicators about with a slight tweak to make it less noisy. Shows ZigZag lines to help spot cycles and draws Fibonacci lines to indicate support and resistance levels.

DSL - DMI oscillator

This indicator detects the currencies in the chart and compares the current close value in all the pairs of the currencies trying to understand if the currency is strong or weak.

This script scans for open orders and sets a fixed stop loss and take profit to all of the relevant.

This indicator can show you the weekly/daily/hourly/... progress on a lower timeframe. High, low, middle and/or open-lines can be configured individually.

A script used to submit market or pending orders with take profit and stop loss levels, lot size, and optional trailing stop.

Vidya zone (metatrader 4).

Schaff trend cycle - adjustable smoothing.

Quantile bands.

Dsl (discontinued signal line) - stochastic.

Dsl (discontinued signal lines) - RSX

Dsl (discontinued signal lines) - MACD.

Dsl (discontinued signal lines) - RSI (MetaTrader 4).

NonLag smoothed inverse fisher transform of RSX.

Small Expert which sends email notification of last opened and closed order.

This script allows you to close orders with one click, filtering by profit, loss, magic number and comment.

OpenOrder script allows you to open an order defining the % of balance to risk, the Stop Loss distance in pips and the Take Profit distance in pips and a magic number.

Open positions in MT4 with absolute control of the risk / reward ratio, automatically calculating the lot size.

Expert Advisor which trades breakouts in several pairs during the London Session.

By using this indicator you can see the normalized price of any chart!

Displays current bid price and % change of (open price of) current bar or X previous bars, also High, Low, and range.

Automatically draws Fibonacci retracements on chart.

Example of a simple breakout trading robot. There are a lot of breakout methods, but this is the simplest one as I think. Please see the attached images to visualize what is the breakout trading...

Expert Advisor to trade Yen Crosses based on Major Pairs and USDJPY divergence/convergence.

Code example of MACD automated with advanced money management function.

Pivot indicator. Standard, Fibonacci, Camarilla, Woody's, Demark. Calculates pivot points from previous bar of chosen period (M5 - MN).

This code was written as an indicator. It adds top and bottom margin to the chart. Both can be adjusted separately.

This library has smart notification(alert, push and alert) function with an option of having a single notification per candle at a time.

This is a simple indicator that plots Signal History on the chart.

Moving Average based on Ultimate Oscillator. It calculates weighted average of three moving averages (Simple, Exponential, Smoothed or Linear Weighted).

The same EA's as previously released. The additional code allows the user to set parameters on RSI and Momentum.