Watch how to download trading robots for free
Find us on Twitter!
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 and MQL5 Source Code Library

icon

You don't know where to start learning the MQL5 or MQL4 programming language? Various programs for your MetaTrader terminal are available here. Download and study published code examples, develop your own indicators and Expert Advisors. Publish your applications in the largest library of MQL5 and MQL4 codes, and they will be available in every MetaTrader terminal and MetaEditor.

Your code examples in MQL4 and MQL5 will be distributed worldwide, and thousands of traders will know about you!

Submit your code

3 Ema moving averages identify trend change with rsi confirm

This Expert Advisor (EA) is designed for high-frequency trading on the 1-minute (M1) chart in both forex and crypto markets. It uses RSI and candlestick patterns to identify buy and sell signals, automatically executing trades with dynamic stop loss, take profit, and trailing stop levels based on market volatility.

Engulfing Bar Occurs below Ema moving Average that is rising - Buy Trade -

Rsi Indicator

2-Pair Correlation EA – Free, Adaptive Crypto Trading Automation The 2-Pair Correlation EA is a free Expert Advisor that trades BTC/USD and ETH/USD, capitalizing on their price correlation. The EA opens trades when the pairs diverge and closes them as they realign, automating your trading with minimal effort. Key features: Dynamic Lot Sizing: Automatically adjusts based on account balance and risk settings. ATR Volatility Control: Pauses trading during high market volatility. Drawdown Protection: Stops trading if your account hits a drawdown limit and resumes once the account recovers. Customizable Settings: Adjust risk levels, slippage, and profit targets to fit your style.

This is an indicator that combines swing high/low and Fibonacci Retracement to identify potential buying zones.

This is an indicator that helps identify Engulfing candle patterns.

The Fair Value Gap (FVG) Indicator identifies price gaps that occur when there is an imbalance between buying and selling pressure. It highlights areas where price is likely to return to fill the gap, providing potential trade entry points based on market inefficiencies.

A script which when run displays the maximum lot size permitted on the asset.

script to open a buy position at the current price in the MT5 window with a specified stop loss (in pips) and take profit (in pips)

A dialog to display the maximum lot size permitted on the underlying asset for different types of orders (buy, sell, pending buy, and pending sell).

The CDebugLogger class is a flexible and comprehensive logging utility designed for use in MQL4/5 environments. It allows developers to log messages at various levels of importance (INFO, WARNING, ERROR, DEBUG) with options to include timestamps, function signatures, file names, and line numbers in the log entries. The class supports logging to both the console and files, with the ability to save logs in a common folder and in CSV format. Additionally, it offers functionality to silence logs based on specific keywords, ensuring that sensitive information is not logged. This class is ideal for developers looking to implement robust logging mechanisms in their MQL4/5 applications, with customizable features that cater to a wide range of debugging and monitoring needs.

High and Low Line Indicator

This script saves all the OHLCV data available on the chart to a CSV file.

A customized bid and ask line which is labelled and clear to help visualize the bid and ask prices

The EA identifies discrepancies between theoretical and actual currency exchange rates to execute risk-minimized trading opportunities.

The Swing High/Low Identifier for MetaTrader 5 marks significant swing highs and swing lows directly on your chart with color-coded arrows. This tool helps traders quickly identify key price levels, which can serve as resistance and support, and is ideal for trend reversal analysis, support and resistance mapping, and enhancing price action strategies. By highlighting these crucial swing points, it provides valuable insights for making informed trading decisions and optimizing trading strategies.

higher confidence to get into trade

A demonstration on how to modify objects in an indicator without having the source code

Raymond Cloudy Day For EA, a revolutionary trading tool created by Raymond and expertly developed for the MT5 platform. This innovative indicator integrates a cutting-edge calculation method with advanced algorithms, surpassing traditional Pivot Points to enhance trading strategies with unparalleled precision.

main point is changing of MA curve to horizontal line and DPO curve shall represent to distance from close price to zero level or MA curve

This Indicator creates automatically a Risk/Reward Box on you all opened chart base on High, Low price with the old candles. You can use it easily to drag and change size and price to your desire wanted.

Indicator displays the value of defined stop loss and or take profit in the deposit currency. Note: It calculates an estimated value based on a simple calculation and does not take into account brokerage commissions.

This indicator is designed to draw a Fibonacci retracement, using as a basis the ZigZag indicator.

Beginner tutorial on CCI to learn to code in MQL5

Linear Regression Value indicator with an option that allows it to be applied to another indicator

Bollinger Bands with controllable outer band smoothing (post smoothing)

Bollinger Bands with controllable outer band smoothing (pre smoothing)

This code does not trace the iatr() because the iatr() or this code is a more modern version. This code uses original smoothing, a kind of SMA and not wilder smoothing. The analysis of the two smoothings can suggest opportunities elsewhere

Linear regression line with an option to be applied to another indicators

Linear Regression Line

Linear Regression Slope

Linear Regression Value indicator

RSI adaptive indicator based on tick calculations

How to use Metaquotes native smoothing functions in MovingAverages.mqh SimpleMAOnBuffer(), ExponentialMAOnBuffer(), SmoothedMAOnBuffer(), and 2 LinearWeightedMAOnBuffer()

Root Mean Square

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

Capture widescreen screenshots by pressing the 's' hotkey on the keyboard

This indicator shows you how to use native functions SimpleMA(), ExponentialMA(), SmoothedMA(), LinearWeightedMA which are in the MovingAverages.mqh library in the includes directory

Moving averages are useless. In fact, some argue that the best way to lose money for a beginner are MA-Price crossover strategies. But is it possible to make it work?

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184