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.

To post a new code, please log in or register
latest|best

It's an expert to use price action and trade level to open each order. The expert can trade up 12 pairs, uses the corresponding default setting for each pair. Default settings are good for EURUSD pair and IC Markets broker. For more information, please visit product's page: https://www.mql5.com/en/market/product/43249

An old forum indicator that's been updated

The "Gonna Scalp" EA is a scalper , works with all time frames major forex pairs and stocks NASDAQ.

Will scale up after N consec losses and will reset after same amount of consec wins

The "Smart AC Trader" EA trades with 2 moving averages , If we lose a trade then the EA will take a new trade with the opposite conditions

The "Martingale Smart" EA trades with 2 strategies , If we lose a trade then the EA will change strategy and take a new trade with a multiplied/increased lot size,

"ROC" EA Trades with "ROC" indicator, has Trailing Stop Loss &Take Profit works on all time frames major forex pairs and stocks NASDAQ.

Indicator calculate the average price

A basic ea template with trailing stop for further development

A ready made expert adviser template to use for further development or use 'as is'

The code is based on indicator ZigZag which is in-built in MT4. I have changed it so that it isn't calculated on highest Highs and lowest Lows, but instead uses highest Close and lowest Close of chart price history. See attached chart for differences: ZigZag (red) versus ZigZagClose (yellow).

Grid Template EA - A ready made expert adviser template to use for further development or use 'as is'

This expert is a tool to test any of my histo indicator (8) for testing and find better settings to trade. You can use separately one by one indicator or more of one or all together as a system. Expert need all indicators for working and generate signals.

The expert uses iFollowLine and iCompass indicators to generate signals. It's an easy and quick way to test both indicators. 27/09/2019 updated expert and indicators.

The indicator is shown in a histogram the ADX uptrend and downtrend uses a different way. You can set period of indicator and bars count averages levels.

The indicator is shown in a histogram the Bands uptrend and downtrend uses a different way. You can set period of indicator and levels for trend.

The indicator is shown in a histogram the MACD uptrend and downtrend uses a different way. You can set period of indicator and levels for trend.

The indicator is shown in a histogram the Stochastic uptrend and downtrend uses a different way. You can set period of indicator and levels for trend.

The indicator is shown in a histogram the Bull and Bears uptrend and downtrend uses a different way. You can set period of indicator and levels for trend.

The indicator is shown in a histogram the ATR uptrend and downtrend uses a different way. You can set period of indicator and levels for trend.

The indicator is shown in a histogram the CCI up and downtrend uses a different way. You can set period of indicator and levels for trend.

The indicator is shown in a histogram the RSI up and downtrend uses a different way. You can set period of indicator and levels for trend.

5MinutesScalpingEA uses indicators (5) from 5MinutesScalpingSystem. This expert is to help any user of the system to try some different settings of indicators easy and quickly. Expert need indicators to generate signals. Has the ability to use all of the indicators, or some of them.

You can send pending order on closed market between StartTime and EndTime at specific minumum and maximum price.

It's an expert to help any user to find better settings for FolowLine indicator. Expert works only with FolowLine indicator.

This expert uses iDoubleChannel indicator. You can use to make backtesting to find best settings for indicator.

It is an indicator of technical analysis that aims to assist every trader in his manual trades.

It is a manual trading system consisting of 5 indicators. We buy when all indicators are in blue, and we sell when all indicators are in red. Indicators auto turn chart in M5 time frame, there is a switch to skip it.

Simple utility that makes use of offline charts to facilitate training by enabling bar-by-bar display - both forward and backward, as well as reset to a pre-defined date/time.

Adaptive ATR

Detects intersections between MA3, MA20 and MA150.

It's a multi-currency grid and martingale system that can trade all input pairs from one chart. The expert will close all orders for each pair using a profit level. The expert has the possibility to trade up to 100 pairs. It's a grid, hedging and averaging system. For more information, please visit product's page https://www.mql5.com/en/market/product/30282

NewsReleaseEA is an expert to trade about economic news uses pending orders.

This Expert Advisor is a pure scalping system. The expert place and manage pending orders. Runs perfectly on pairs with tight spread and low commission broker (commission plus spread equal or less than 1.0 pip). Choose a broker with zero stop level and fast execution to use the expert. The code is available for testing and studying. For more information please visit the product's page: https://www.mql5.com/en/market/product/31899

This Expert Advisor is a pure hedging system. The expert place and manage two market opposite orders. Runs perfectly on pairs with tight spread and low commission broker (commission plus spread equal or less than 0.5 pip). The code is available for testing and studying. For more information please visit the product's page: https://www.mql5.com/en/market/product/33295

Used to compare 2 currencies on one chart, the Original indicator will recenter its calculation on every bar, and hence the price will keep shifting up and down and so the historical relative values do not remain constant. This indicator was modified so that the 'center' or initial relative reference point stays fixed and does not update each bar. It will only reinitialize when the indicator is reloaded or settings are changed.

Currency Index that calculates evenly on all 7 major pairs. Can also change base currency. Based on No Nonsense Forex podcast.

Let say you have an EA and you want it to trade in between an interval of time but you do not have the source codes to modify the EA. This utility allows you to automatically enable or disable the automated trading button. You can use the codes as an EA, Indicator or script but I used as an EA. You can remove Ordersend command because I set it only for the codes to past the test but it is meaningless.

EA with candle size filter and scale on loss

Arrow trends by iBearsPower and iBullsPower indicator for MT4.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990