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.


This indicator plots bullish and bearish gaps, and crosses/hides closed gaps.

Immediately deletes the SL/TP of all positions.

Total closure of all positions (winners/losers). You can also select which are of a single instrument.

Closure of all positions with a loss. (You can indicate a specific instrument if you want to).

Closure of all winning positions. (You can indicate a specific instrument if you want to).

Shows multi timeframe (M1, M5, M15, M30, H1 , H4, D1) RSI indicator in a separate window.

OBz library of trading functions: position size, open, close position etc.

Indicator detects the Inside Bars and marks them high/low (no redraw).

This is a great beginners' example of the function OnChartEvent() & creating objects on the chart to access them for some tasks.

Awesome Oscillator, customizable, 4 colors (as seen on some AIMS YouTube videos), and some more parameters.

This indicator is based on the moving average, but it doesn't use any standard moving average indicators.

Two EA's. One places Stop orders the other places Limit orders.

Renko chart generator using the tick values.

Fast time range checking function. Doesn't use slow string parsing.

The script modifies all orders (market and pending) on the symbol with specified Take Profit and Stop Loss.

Buy or sell just by looking at the "arrow" as a signal. Very easy and simple.

PricePosition indicator provides the position of price in the point of angle when the price rises above (BUY) or falls below the angle section line (SELL).

Calculates profit (loss) of the current orders on the symbol.

Modified version of FF Calendar Indicator with new features.

Continuously records tick data in format "DateTime, Bid, Ask, Volume" even after restart.

This script is used to calculate lot rebate.

This indicator provides an easy way to find out the current direction of a pair.

This EA uses different indicators: ADX, Stochatisc, Accelerator... This EA is optimized for USDJPY TF H4, but it can work on others if you optimize it.

Simple way to encode and decode using Base64.

A good oscillator for helping you count Elliot waves.

Shows simple channels for daily, weekly, monthly timeframes.

The EA is based on 5 MAs: 10-, 20-, 50-, 100-, 200- period and + ADX (the main line)

ATR MA Oscillator - Oscillator is based on the difference between the ATR oscillator and its signal line.

The script plots a "Tic Tac Toe" chart in the form of Japanese candlesticks.

Expansion and improvement of the script ver.2 and an example of accelerated processing of an indicator for use in conjunction with the script

Simply displays ticks on the price chart

Expert Advisor based on the Sidus indicator.

Visualizer indicator (what a terrible phrase to use!). Colors the chart bars according to the logic of determining the state of the fourth dimension of the Chaos Theory by B. Williams - Zone.

Modernization of the first version of the script with the ability to manage multiple indicators

The script allows to preview the indicator behavior on a real chart from the specified point with the minimum computation resources.

The indicator plots channels on three different timeframes (by default 1 hour, 4 hours, 1 day) and displays them on one chart. Also, for greater clarity, it displays the boundaries of each channel on the chart.

Expert Advisor for trend trading with lot increase

Semaphore indicator that predicts the future direction of the price

It responds to market faster than the MA (moving average)