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 - 36


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.

Submit your code
latest | best

Easy EA for closing positions with profit or loss. All positions of chart's symbol are counted separately.

This indicator helps you display spread on a chart.

It synthesizes any symbol if you have the source symbols and then makes a real time virtual chart. Same concept with Triangle Hedge (SymbolSynthesizer.mq5 but for chart display in MetaTrader 4.

Draw your preferred pivot formulas: Standard, Fibonacci, Camarilla, Woody’s and DeMark with 4 Support and Resistance lines.

Close, Delete or Clean values from all orders by your choice.

Calculates volume for each currency on pair based on price movement.

Moving average with some extra features.

Simple indicator to show two levels of Standard Deviation Channel on your chart.

This indicator helps determine the end and the beginning of trends based on the inclination of the matches.

The Expert Advisor moves the Stop Loss in the direction of the price movement using various methods.

This indicator will Draw Fibonacci Tools such as Retracement, Arc, Fan, Expansion, Time Zones. Based on ZigZag indicator.

This Expert Advisor uses three indicators: MA(150), RSI(3) with the levels of 80 and 20, Stochastic(6, 3, 3) with the levels of 70 and 30. The direction of opening deals is based on MA. Entry by RSI and Stochastic. Exit by Stochastic.

The Expert Advisor reverses the orders after closing.

A simple indicator, which informs the trader about the appearance of "Bullish Engulfing" or "Bearish Engulfing" candlestick patterns on all timeframes.

Opens orders using the martingale and a virtual trailing stop.

The script analyzes the market based on two criteria: the moving averages and the support and resistance levels.

The function returns the lot size, which is calculated based on the stop loss size and the risk specified in the variable.

The function closes all locked orders. This really saves money on the spread.

Implementation of a trading system based on divergence detection.

The indicator registers the price level breakout moments and the significance of these levels.

The indicator shows the High, Close and Low of the previous day, week or month with time shift.

The function allows the execution of the specific code in the specified time interval.

The Expert Advisor trades based on the support/resistance levels set by the user, while trailing the Stop Loss order.

The Expert Advisor places a grid of pending orders in both directions several minutes before the specified time and trails the Stop Loss order after the orders trigger.

Tick volumes drawn by days as a histogram of clusters.

Tick volumes of a specified interval drawn as histogram of clusters.

An indicator template that draws arrows on the chart.

Script that closes orders and (or) deletes pending orders.

Indicator with several Moving Averages.

Tick volume of the candlestick drawn as clusters.

The Expert Advisor is based on the "On the MaZi" strategy.

The converter of the tick files created with the Ticks collector into different data representation formats.

Signal based on the ZigZag indicator.

A small improvement of the little known TVI indicator (

Collection of ticks with writing data to a file and plotting non-standard charts.

The idea behind the Expert Advisor is based on the volatility explosion in the pulse waves.

The Expert Advisor based on the "New Trading Dimensions" book by Bill Williams.

The virtual trailing stop can place stop loss, take profit and trail the order in a way that they are not visible to the broker.

Simple Expert Advisor based on the RSI indicator.

A trend strategy based on moving averages with colors as in a traffic light. The purpose of writing the EA — to test the strategy on history and pick working parameters.