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

MQL5 Source Codes of Scripts for MetaTrader 5 - 7

icon

Scripts perform one-time actions in MetaTrader 5 using an MQL5 program and are deleted from the chart immediately afterwards. Sample functions include uploading trading history, generating a report and sending it by email, downloading and processing data from a file. Scripts can also be used to create graphical interface or quickly execute single-type trading operations, for example, close all positions immediately.

You can download and launch offered scripts in MetaTrader 5. The library of scripts is also available directly from MetaEditor development environment allowing you to learn MQL5 programming.

Submit your code
latest | best

The script is developed for buying with fixed Stop Loss and Take Profit values in points from the current price.

Script to create wide screenshots.

A simple script for switching basic timeframes. It allows to change a chart period using hot keys.

Comparative study of sorting algorithms.

The script adds vertical lines on the chart at the news events.

Simple script to randomize all colors of your chart. Just click on it and see results yourself!

Enables the "Chart Objects Description" for non-programmers. For any open chart window.

A small example of the Mandelbrot fractal calculation in OpenCL. The OpenCL accelerates calculations of fractal approximately up to 100 times in comparison with the CPU calculations.

The script calculates Stop Out price (at this price position will be closed by broker) of the opened position and the price, at which Free Margin became negative (LockOut price).

Script for the charts simultaneous scrolling.

The simple script for deleting all graphical objects from a financial asset chart. It can be useful, in case the chart is overcrowded by objects that are not needed anymore.

The script exports historical data to HST format for its use in MetaTrader 4 client terminal. This file can be imported in MetaTrader 4 as historical data or you can open it as offline chart.

This script reads all opened position and calculates their exposure for each currency.

The script converts the time, represented as datetime variable into the year, month, day, hour, minutes and seconds.

If you need to show just a part of the image at the moment and hide other, you can use the moving window by specifying the visible area of the image.

The script downloads historical data (for the current symbol), available at trade server.

Simple script with demonstration of use of the ChartNavigate() function.

The example of chart background image, created using the object of OBJ_BITMAP type.

This script exports indicator's values to CSV file.

New version of the sChartsSynchroScroll script.

This script generates a file with its source code (solution of the classical program in MQL5). It may be useful to study programming and algorithms.

The script allows you to place the deals history on the chart using the graphic objects.

The script exports historical quotes data from MetaTrader 5 for the import to MetaTrader 4. This solution will allow you to get the full history for MetaTrader 4.

Since Terminal build 344 added display of economic calendar news using special graphical objects (OBJ_EVENT). A script that outputs as a demonstration of the Economic Calendar with current economic data, the date of the last major (Pink) event.

The script calculates the number of lots to trade using the specified percentage of risk funds.

The script purpose is to export historical rates data to format, convenient for analysis in external programs.

The script gets contents from the Windows Clipboard.

Here is a simple example that shows how to download page(file) from Internet using the library wininet.dll.

The script provides a synchronous scrolling for all charts opened in the client terminal.

The script illustrates control of chart properties using the classes from the Standard Library (CChart).

The script illustrates control of graphic objects using the classes from the Standard Library.

1234567