Watch how to download trading robots for free
Find us on Telegram!
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

icon

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

Hedge with a stop order, instead of placing a Stop Loss.

Short description.

Close_on_PROFIT_or_LOSS_inAccont_Currency

Hedge Dollar index USIDX against its constitutive FOREX pairs EURUSD GBPUSD USDJPY USDCAD USDSEK USDCHF

Break on Code Error ! This script is a general example of using error brake in any strategy.

simple trail stop loss code example.

This is an indicator to calculate 14 types of moving averages based on close price.

This is a indicator to plot hidden and regular divergences on chart.

Many Expert Advisors (EAs) tend to close orders at the take profit level, considering the pip distance from the purchase price.

[@Buy_Sell_Close] Manual trading EA for trading newbies, EA can be used in backtesting visual mode, EA can also be used in live trading. You can practice your own trading system in backtesting.

AVA adapts its analysis based on current market dynamics. This adaptability makes it invaluable for predicting shifts towards higher volatility or calmer periods.

this shortcode will calculate the drawdown of a particular ea, where it is applied to a specified symbol.

The Breakeven Point, or Titik Impas, denotes the price level at which a trade's profit becomes zero. By setting a position to Titik Impas Breakeven, the stop-loss is aligned with the position's opening price. This strategy proves valuable when you aim to allow profits to accumulate while ensuring that the trade remains secure and does not revert to negative territory.

Displays the gains and losses for all candles where the given threshold is surpassed. The values are calculated in points and percentage.

mt4 version of original indicator

When we want to know how many times price will goes up and down 40 pips before breaking this channel, we will need Bounce Number tool.

SSH is popular indicator as it uses simply two moving averages. This version is a mylti-TF of SSH with TF change ability from screen.

This is the exact conversion of pivotshigh and pivotslow functions from pine script v4 as an mql4 indicator.

This strategy eliminates the need to rely on indicators, candlestick patterns, chart patterns, or any price action. This EA employs a progressive system that I have been using for the past six months and have backtested for over three years.

All open trades must be of same symbol and type, e.g. all GBPUSD and all BUY. This script will close out your position using one large trade to hedge your position then using CloseBy() function to close all trades against the one large trade until all trades are closed. There can be a maximum of 500 open trades.

A simpler way to display Heikin Ashi

a Simple Visual Strategy Tester / Manual Trade Training using Martingale.

The purpose of this indicator is to demonstrate newbie friendly way a structure of a multi time frame indicator based on recursion.

Few improvements from standart fractal: 1. You can chouse size of fractal. Standart version use 2 as constant 2. It does not draw fractals against the trend, which makes your chart much more informative

Show MACD directly on chart

Donchian Channel with mid line and moving average of mid line. Updated Dec 6, 2023 Minor code update

The Oscillator Indicator for MetaTrader 4 is a powerful tool that accurately identifies the perfect signal on the completion of trends.

Multi_BreakEven is a script file that allows multiples entry positions to set to breakeven using pips or target price when the trade is in your favor.

A combination of data analysis from the Awesome Oscillator and the resulting direction of the candles relative to the previous range

This is an indicator with a rainbow-like display, both for trend or pullback prediction.

Most EAs tend to close orders in take profit based on the distance in pips from the purchase price. However, this MQL4 code is based mainly on the current profit.

Simple Support, Resistance, and Mid-Line boilerplate

Indicator shows histogram of ratio of sum of lower time frame ranges to current timeframe bar range

Trend indicator based on the intersection of adaptive HMA and its smoothed line. I recommend using it together with the flat indicator to determine the beginning of a trend early

A Donchian Channel Strategy breakout EA Scalper. Best results at H1.

This indicator calculates the percentage of the probability of a price reversal from a given size of the maximum rollback based on the history of the chart movement

The Double Bollinger Band Strategy makes use of two Bollinger Bands in order to filter entries and exits in the forex market.

New level of trend prediction!

This is an mql5 Expert Advisor trading the breakouts and using Martin Gale risk management.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101