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 and MQL5 Source Code Library


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

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

This Include File checks for Market Open Hours. An EA to test it is also included.

ATR - Average True Range - beginner tutorial to learn how to code in MQL5

This function allows you to retrieve and return the filling policy of a symbol in MetaTrader 5. This is useful for making trading decisions based on the filling policy of a specific financial instrument.

AO - Awesome Oscillator - without iAO() beginner tutorial to learn how to code in MQL5

A Marubozo is a long-bodied candlestick with no shadow, from the Japanese word meaning "close-cropped". Candlestick charts look at the opening and closing price on a single day and are used by technical traders.

AMA - Adaptive Moving Average - beginner tutorial to learn how to code in MQL5

Alligator beginner tutorial to learn how to code in MQL5

Rsi without Irsi() beginner tutorial to learn how to code in MQL5

Fractals - adjustable period and prices for MT5

Here is my colored Hull Moving Average.

Wick Ratio Candlesticks are recognized by its upper and lower wick ratio instead of open and close properties.

"This advisor uses the RSI indicator to determine optimal entry and exit points in the market. A unique feature of the advisor is its martingale strategy, which allows for position reversal with an increased lot size during market reversals. The advisor offers flexible trading time settings: you can set a working time range and disable trading during specific hours to filter out news events."

A tool which refreshes the chart automatically and will make active indicators update if something stopped plotting on the chart.

Stochastic beginner tutorial to learn how to code in MQL5

It will automatically plot a colored horizontal line on the previous open/highs/lows/close of the selected period, and it will make the lines consistent on this price when switching timeframes.

This is a helper function which enables you to find the price of the symbol (the prices on the Y-axis) wherever you click the mouse on the chart. Using OnChartEvent, we don't have an MQL5 function in the API to do this, we can only obtain X and Y pixel values with mouse click.

Set TakeProfit by just dragging and dropping script on the desired price level.

Set StopLoss by just dragging and dropping script on the desired price level.

Momentum beginner tutorial to learn how to code in MQL5

With these classes you can create and test your signals runtime.

Ichimoku beginner tutorial to learn how to code in MQL5

MACD beginner tutorial to learn how to code in MQL5

Bands Bollinger beginner tutorial to learn how to code in MQL5

Rsi beginner tutorial to learn how to code in MQL5

Moving average beginner tutorial to learn how to code in MQL5

One of the latest version of this indicator at the moment. Huge base of different modifications of moving averages, with multitimesframe function, sending signals to e-mail and push notifications.

Monitoring of memory leaks in the strategy tester

Trend Dashboard Indicator MetaTrader 5 indicator — a multi-timeframe indicator that is based on three standard indicators: Stochastic oscillator, RSI (Relative Strength Index), and CCI (Commodity Channel Index). It displays current trend directions for M1, M5, M15, M30, H1, H4, D1, W1, and MN1 timeframes. When you follow such an indicator you have a clear picture of the trends across all important timeframes. It doesn't matter which timeframe you attach this indicator to. The indicator can be downloaded for MT4 and MT5.

I wanted to build a moving average which would create an alert when the price moves over the line by a user defined amount of points. It creates both bullish and bearish signals depending on the direction of market price moving through the MA. It is designed for slow length moving averages (default is 200-day MA). EDIT: I now added a second version of the indicator which uses Arrow buffers instead of ObjectCreate.

The EA trades using the Rectangle, EMA and SMA indicators.

This is a custom support and resistance indicator, signaling bouncebacks and key market levels.

Enables Programmers to create Martin Gale and Grid Trading strategies with ease.


Forget about BMP files like a bad dream. Thanks to this library, you can now use the PNG format, which has a number of advantages, such as being more compact without losing image quality and maintaining transparency.

The "Dynamic Support and Resistance" Indicator is a versatile tool that combines support and resistance levels with real-time market dynamics. By incorporating previous daily highs and lows, it provides valuable insights into market psychology and identifies potential areas of price reversals or breakouts. With its ability to adapt to changing market conditions and customizable options, traders can stay ahead of trends and make informed decisions. This indicator is suitable for various trading styles and timeframes, empowering both experienced and novice traders with a competitive edge.

On contrast with Trailing Stop which a stop loss trails price until the price hits the stop loss and the position gets closed in profit, introducing Trailing Take Profit which take profit trails price when a position is in loss and ultimately the position gets closed with loss.

Calculate DST for USA, EUR, AUD and RUB and the offset time of the broker automatically from the 70's until 2030 - even in the Strategy Tester of MQ.

provides clear arrows which clearly show the direction of the currency pair.

Tortured small print in the terminal? This indicator makes price numbers visible!

The AK-47 Scalper EA is fully automated. It employs a strategy of continuously entering Sell Stop orders and will modify them when the price moves against the pending orders.