Download MetaTrader 5

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 Source Codes of Scripts for MetaTrader 4

Scripts are small applications that perform one-time actions. For example, you can delete all objects from a chart or place a set of orders for an open position. Find here hundreds of applications that can automate small analytical or trading functions.

Scripts are free to download and run in MetaTrader 4.


Opens a BUY position with the size of a percentage of the maximum allowed size.

Automatic Trailing Stop for all open positions. Attach to one chart only.

The script opens a SELL position with the size of a percentage of the maximum allowed size.

Example of working with objects: creating object, changing properties, redrawing the chart.

The indicator of trading signals based on the divergence of the RSI and CCI values

The program is designed to facilitate the routine work of the trader on testing and optimization of experts, performing sequential multi-currency, multi-timeframe and other types of tests and optimizations.

The script fixes the chart by extending it with the consideration of the weekends and holidays.

Simple strategy - MM % volatility

The script is designed for downloading history on all known currency pairs, metals, indices, CFD and for controlling "holes" in history.

The Lines_Create script creates 2 horizontal lines on the chart with the names UP_LEVEL and DOWN_LEVEL. The Lines_Delete deletes the lines created by the Lines_Create script from the chart. The Lines_RASST script is an addition to the Lines_Create script.

This script is designed for obtaining various statistical data on the chart candlesticks on the selected timeframe.

2 scripts for the analysis of trading results. Useful both for investors and traders.

The calculator estimates the value of one point of a currency pair and the maximum stop loss for the user-defined lot.

This tiny script visually demonstrates the identity of two common Moving Averages

The script helps to perform the visual analysis of multiple currency pairs on a custom time frame.

Script for preparing the "minute bars" from to be imported to MetaTrader 4

Script for the calculation of the third Elliott wave

The ZZ_All Quotings 0-0050 script is designed for downloading history on all currency pairs, metals, known indices, CFD and for controlling "holes" in history.

The history_data_analysis_v3 script checks the history for missing bars, determines the size of the holes, gaps and makes a list of them.

The hst2csv script is used for converting *.hst files to *.csv files, that can be imported into the MetaTrader 4 client terminal with no errors.

Example of using wininet.dll for downloading a web page.

A set of scripts for quick drawing the Elliott waves.

Script for converting a chart of the M1 timeframe into all other charts of the standard timeframes and recreating the M1 timeframe chart.

The script saves the values of Time, Open, High, Low, Close, Volume and standard indicators.

Script to set StopLoss and TakeProft in Pips, uses your EA Number, separate SL and TP.

The Mandelbrot set is one of the most famous fractals, including outside of mathematics, thanks to its color rendering.

The script inserts the FXT-file of any custom chart, synthesized from real tick flow, into the strategy tester folder.

Script for opening opposite stop orders at a specified time. Once one of them triggers, the other one is deleted.

The script is designed to place orders at the time when it is not possible, for example, when the market is closed.

The script determines the price at the point of the chart, on which it was dropped down, and depending on that it places a grid of orders.

This script plots MQL signal history on a MetaTrader 4 chart.

Close, Delete or Clean values from all orders by your choice.

The script analyzes the market based on two criteria: the moving averages and the support and resistance levels.

Script that closes orders and (or) deletes pending orders.

The converter of the tick files created with the Ticks collector into different data representation formats.

The script tests the computer in 45 performance tests. It is possible to compare the performance of VPS/VDS servers.

This script creates a .CSV file of your order history so you can import it into Excel and analyse it using the calculated heat map slots and other calculated values. All trading attributes are extracted from the history and output to the .CSV file. Updated version 1.03 (about 27KB) has NetProfit, OpenDay, OpenHour, OpenSlot, CloseDay, CloseHour, CloseSlot, DurationMinutes, PotentialWinPips, PotentialLossPips and others. The file is tab delimited for easier conversion from text to columns in Excel. Times are server time. Handles 4 and 5 digit brokers and 2/3 and 4/5 point value pairs, e.g. JPY correctly.

This script will help you calculate your lot to open position.

This script lists current open orders with profit.

Easy to use an open trade script.