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

This EA calculates and visually displays Pivot Points on the chart, while also setting pending orders at R1, R2, R3, and S1, S2, S3 with your predefined stop loss (SL) and take profit (TP) levels.

Double ZigZag draws virtual Buy and Sell levels on the price chart.

This EA offers Alligator trend detection, customizable settings, and automated trade execution, with features like adjustable Moving Average parameters and close-on-next-signal functionality.

ProfitTrail Pro is a smart tool that sets a stop-loss for every trade once the price moves a distance you choose. It keeps the stop-loss at a set distance from the price and moves it automatically as the price changes, helping you lock in profits and control risk.

The indicator draws the nearest levels of the specified price range.

A new interface library has been developed to simplify converting MT4 indicators and Expert Advisors (EAs) to MT5. This library supports most of the MetaTrader 4 functions, offering developers a unified solution for cross-platform compatibility.

The same PNB from Yousufkhodja Sultonov.

The indicator displays the actual range of the hourly candle in percent and the calculated range based on average statistics.

The indicator searches for candles on the price chart that are larger than the size specified in the settings and marks them on the chart.

Backtesting Trade Assistant Panel

This expert opens trades based on signals from multiple technical indicators.

Fully customizable moving average, take profit, stop loss, close on crossover EA

Automatically closes all open trades when the total profit reaches your defined Profit threshold.

This EA allows you to open trades with predefined TP, SL, and Lot Size parameters with just one click. It automatically handles pipette conversions and displays real-time Buy and Sell profits directly on the chart.

The Doji Pattern Detector EA is designed to automatically detect the classic Doji candlestick pattern on any chart. A Doji pattern occurs when the open and close prices of a candle are very close to each other, signaling market indecision. This EA identifies Doji candles where the open and close prices are within a small range and positioned near the midpoint of the candle's high and low.

This EA monitors existing trades and automatically closes all profitable positions when a MA crossover signal is detected. Additionally, it provides real-time statistics for individual buy and sell profits, allowing traders to stay fully informed about their profits.

This EA provides traders with real-time overview of their trading activity directly on their chart. This powerful tool displays crucial metrics such as overall buy and sell profits, the number of open trades, and the current market spread, giving traders full visibility into their performance at a glance.

This EA works by automatically detecting all your profitable trades and closing them with a single click. Designed for traders who seek efficiency, this EA takes the hassle out of manually managing multiple positions and ensures your gains are locked in with precision.

"This is the Updated version of NoLoss EA" - As most of the indicators available in the market are lagging indicators that provide information after some time. This strategy eliminates the need to rely on indicators, candlestick patterns, chart patterns, or any price action. The EA employs a progressive system.

Smart MA Trailing Stop EA automatically adjusts stop losses based on your selected MA period and distance between SL and MA.

The Dual Profit Closer EA is a powerful automated tool designed to independently close all buy or sell orders once they reach your predefined profit thresholds.

The PrevDayLines.mq4 script is a tool for MetaTrader 4 that automatically draws three critical price levels from the previous trading day on your chart. These levels include the highest price (Max), the lowest price (Min), and the average price (Avg), providing traders with a clear visual reference for key support and resistance points.

The script creates a text object on the chart that continuously rotates and changes its position based on price levels.

This is a template switcher script mq4 file. This script will work with your MT4 (Metatrader 4) platform. It is to switch between templates.

The Trend Strength Index indicator measures strength of current trend.

This code can detect if its a friday of the first week of the month. It is usually to detect days with NFP. Sone trader dont want to trade at that day. Maybe this code can help some one who need it

change of MA curve to horizontal line and DPO curve shall represent the distance from close price to zero level (or MA curve)

Linear Regression Value (metatrader 4 version)

This EA is a demonstration of how you can implement your own Hedging strategy with the help of the include file.

A professional Grid advisor works according to RSI ( Relative Strength Index ) indicators. And has the function of Reducing the Drawdown on the account by overlapping unprofitable orders. The chart displays information about the profit. It can be a very useful tool, For manual trading.

HarmonicEA is an Expert Advisor (EA) developed for MetaTrader 4 (MT4) that utilizes harmonic pattern recognition and RSI-based signals to identify potential trading opportunities in the forex market. The EA is designed to detect various bullish and bearish harmonic patterns, including crab, butterfly, bat, deep bat, AB=CD, 3-drive, 5-drive, and shark patterns, across multiple timeframes. It incorporates risk management features such as dynamic lot sizing based on a percentage of account balance, maximum drawdown control, and a trailing stop mechanism to protect profits. HarmonicEA is suitable for traders seeking an automated solution to capitalize on harmonic patterns while managing risk effectively.

This EA will scan all the closed trades and then print the nth trade from the end

This EA will scan all the open trades and then print the nth trade from the end

This script will detect an end-of-trading day and notify

This script will scan all the open trades and then will close the biggest winning/losing trade

This script will place hedge trade of unbalanced type in MT4.

This script will close all active trades and delete pending orders based on the order type passed on the input.

This script will close all active trades sequentially. following the order in which they were opened

This script will calculate the total active and closed orders based on order types

Find the current winning / losing streak in MT4 based on filters

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102