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.


This script is used to calculate lot rebate.

The script plots a "Tic Tac Toe" chart in the form of Japanese candlesticks.

Expansion and improvement of the script ver.2 and an example of accelerated processing of an indicator for use in conjunction with the script

Modernization of the first version of the script with the ability to manage multiple indicators

The script allows to preview the indicator behavior on a real chart from the specified point with the minimum computation resources.

When assigned to a hotkey, the script allows to almost instantly open limit orders with the specified risk level (in the deposit currency) and take profit (so-called braces).

Calculation of the number of lots by Anton Trefolev.

The script visualizes the deals on the chart in a convenient way.

Attempt to more or less fully automate the opening of Buy and Sell orders

The script allows to change the color of selected objects to specified one.

The script demonstrates a simple and quick way to calculate the Euler number.

The script opens a BUY order for a specified part of the FreeMargin (second edition).

The script outputs the information on symbols to a CSV file: swaps, spreads, stops, contracts.

The script reads the list of deals from the account history, groups them by the sign specified in the parameters and outputs to a file.

The script is designed to transfer trades from the standard report of the MetaTrader 4 tester to the chart.

It is designed to create a non-standard symbol period based on the use of the standard period.

Trade - script sending BUY order and printing selected order data to the log.

The script closes all open positions and opens new one with the difference of Buy and Sell lots.

This script draws the price levels within a cycle (by Gann) between the significant Highs and Lows.

Draw Elliott Waves (5 waves) manually.

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.