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

MQL4 Source Codes of Scripts for MetaTrader 4 - 8

icon

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.

Submit your code
latest | best

The script selectively clears the chart by the part of the name and/or by the type of the object.

The script closes any position using the Drag'n'Drop method, i.e. the method of "drag the script with the mouse and drop it on the order lines".

The script is intended for gathering some statistics by the symbols and its comparison.

A script for uploading the history by all known currency pairs, metals, indexes, CFD's and for controlling the "hole" in the history.

A determination of a bar and trend direction.

Uploading of history of all symbols from the Market Watch window by all TF. The recording to a file of names and trading condtions by all symbols from the Market Watch window.

Spread, swap, minimum stop limit, price of a point, calculated maximum lot!!!

A script for reinitialization of all indicators attached to the current window.

A set of scripts that are intended for the automation of some routine operations in the terminal.

The script closes all opened Buy and Sell positions in the active window.

The script moves the StopLoss at the Distance from the market.

The script opens a SELL position with the specified part of the FreeMargin.

The script moves the TakeProfit by the Distance from the market.

It deletes a pending order or closes an opened order in accordance with your selection. It is necessary just to drag the script to an order. The script will choose the closest one and will close or delete it.

The script shows the conditions of the correct and closest placing of the StopLoss and TakeProfit of the orders.

Pi

The calculation of pi character.

The script extracts the list of symbols from the *.set file and saves it as the csv file.

The script swaps out all the symbols available in the Market Watch window into a csv file.

Well, the functions of file operations are used in the system library of kernel32.dll. It is this library that we import into the EA. The code is attached.

The script automates the drawing of time lines of opening/closing of a calendar day and the price lines of opening/closing of the days.

An example of the script that writes the values of the RSI indicator to a CSV file.

Placing two pending stop orders for breaking through some trade range, for example, before the important news are published.

It reverses all the positions on the current symbol.

The script performs the calculation of the average volatility of the symbol on the specified interval.

The modification of an order (position) using the mouse - the second script from the "GMO" ("Graphical Management of Orders") series.

A script for visualization of trades on the chart. It is useful when you change the account/PC.

A script for valuation of trades history that is uploaded to the client terminal. The valuation is performed in points.

Placing a pending order using the mouse - the first script from the "GMO" ("Graphical Management of Orders") series.

The amplitude of price movement statistics in a text file. Quickly and comfortably.

The script draws on the chart the curve of the Polynomial regression with the channel of the mean square deviation.

The analysis of history data for the absence of bars, identifies their size, length and gap.

Unloading quotes from the selected period into an external file.

Drawing all results from a strategy tester report file into a chart.

A step-by-step passing of historical data for manual testing of trading.

Script interception of pressing keys or mouse buttons in the windows of MetaTrader 4. It can be helpful in writing controls.

Report generator

A DLL to manage and exchange data between MT4 and MS Excel. OLE is used. The description of the DLL functions is given in the attached example. The example is a script that sends quotes to Excel and builds the diagram of daily price changes. At exiting,

The script should solve the "fading charts" problem - the situation when the charts stop being updated while the connection to the server remains ok

Automated volume calculation for the preset risk factor, and order(s) opening.

A script tool for those who develop programs in MQL4. It allows to display the contents of any font in your chart.

123456789