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 - 6


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

Simple stoploss script

cycle timeframes using hotkeys 'N','M' prev,next timeframe

Elegant oscillator - metatrader 4 version

Force index with Volume/Volatility bands

Quantile Price Analysis by Jas Wu, Calculations are below.

Slow Line of the original Didi Index

it saves the current chart to default template , it just helps to do it faster than a manual save. you can assign a hotkey for it. it has no confirmation and immediately saves the template, if you want it to save to a template other than default just edit the code and replace "default.tpl" to any other name you want.

Larry Williams 'Greatest Swing Value' as an indicator

This code helps beginners in MQL4, specially those migrating from C++ to perform some basic fie operation.

This code base is a simple function to check if current time lies within two specified times.

This indicator draws coloured histograms to identify bullish and bearish bars.

This code can be used to find out whether the symbol is a binary option symbol or not.

This code base is a simple function to check if current time lies within two specified times. Many times it is required by the Ea to enter trades between two specific time of the day only. This code takes two inputs, one is the start time and second is the end time. The code will check if the current time is in between start time and end time and will return accordingly.

The code is used to demonstrate how one can create a button on the chart and assign a function to it. The code is used to delete all orders after clicking on the button. The deletion takes care of various scenarios and shows error messages.

This code will give custom sound on alert on new bar.

This code places only one order every second ( not every tick )

This code help you get the time of an object created on a chart.

This EA will tell you the Depth Per Inch of your screen.

This code is used to create static object on MT4 charts which will not move along with the chart when you scroll the chart.

it gives you the name of the indicator which is attached to a chart.

This code simply prints the account details for a MT4 account.

hotkeys 1-9 numbers on keyboard but not on number-pad to change timeframes 1=m1 2=m5 3=m15 4=m30 5=h1 6=h4 7=d1 8=w1 9=mn

This indicator shows a standard parabolic SAR another way. Also it send alert when SAR dot changes side.

Momentum deviation bands - MT4 version

Momentum deviation

cycles though market watch symbols, using hotkeys Comma and Period for prev/next symbol in market watch list

This is a simple script to chart the intermarket spread between 2 different futures or CFD contracts. The spread trading is a popular futures trading strategy and can be done using CFDs more easily as there is no formal expiry date.

The indicator highlights the value in "over Sold" and "over Bought" zones.

Moving Average Cloud draws 4 MAs on chart simultaneously in histogram style.

Displays the current timeframe and symbol name in large font on the chart background. Useful when hopping between several charts with different symbols at the same time.

The script is best use to clean up all drawings ( Delete All Object, Comment, horizontal line, vertical line, arrows etc) on current chart. Please feel free to modify based on your needs.

Dynamic pivots - any time frame

It's an expert to open and close orders on specific day and time. Expert open and close orders only with the same symbol it attached.

Limit channels - with states - metatrader 4 version

Show Orders History On Chart

ATR based limit channels - metatrader 4 version


Directional Movement using Hann windowing - metatrader 4 version

This Is Just A Normal Trailing Step Function.

This Is a Normal Trailing Function For All Open Order In MT4.