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

Top scripts for MetaTrader 5 based on user ratings

Submit your code

This script helps traders understand the distribution and breadth of candlesticks over a specific period, which can be useful in making trading decisions such as which Take Profit or Stop Loss to use based on historical values.

Unfortunately, I discovered that some brokers are a bit sloppy with the server time change due to the daylight saving time (DST), which I did not expect and which surprised me a lot. Here is a script with which anyone can check their broker.

Functions for use instead of ChartXYToTimePrice and ChartTimePriceToXY, working correctly and quickly over the entire range of input parameters

This script is a reference solution for mapping symbol names configured by users in MetaTrader 5 EAs or scripts to the actual names provided by the broker. It uses the Levenshtein distance algorithm to automatically identify the most similar symbol in Market Watch. Ideal for developers facing compatibility issues with prefixes or suffixes in symbol names. It is a customisable starting point to suit any specific need.

It is a script to display the time remaining until next bar arrives.

The script provides a set of functions for creating all standard graphical objects for use in your own developments. The functions presented in the script can be used "as is" or modified to your requirements.

This is a script to export rates and ticks of current chart's symbol into CSV-files compatible with MT5's export/import format.

Script for displaying updating data on open positions.

Population-based optimisation algorithms are collected here. The archive contains all necessary files to run the algorithms on test functions.

Unfortunately I had to realise that some brokers are a bit careless with the server time changeover, which I had not expected and which surprised me a lot. Here is a script with which everyone can check their broker.

A professional script that automatically sets Stop Loss and Take Profit for all open positions based on a customizable Risk:Reward ratio. Perfect for traders who want to maintain consistent risk management across their trades.

Translate risk percentages to the monetary figure based on the account balance

This MQL5 script exports candlestick data for various timeframes into a CSV file, capturing essential market information like open, high, low, and close prices. It analyzes each candlestick's characteristics, including body and wick sizes, while calculating additional metrics such as candle gaps. After processing the latest 21 bars, it notifies the user upon successful data export.

Unfortunately, I found that some brokers Changing the time on the server is a bit incorrect, which I didn't expect. and which surprised me a lot. Here is a script that anyone can use to check their broker.

This is a tester script that extends the standard MetaTrader 5 optimisation capabilities, allowing you to evaluate strategies according to complex user-defined criteria (with separation into in-sample and out-of-sample periods, advanced metrics and statistical tests).

A tool to align the trading sessions names with broker server time, and local time

This script saves a predefined set of economic events from the MetaTrader's built-in economic calendar into CSV file.

Multi_BreakEven is a script file that enables setting multiple entry positions to breakeven, either through pips or a target price, once the trade becomes favorable.

This is a simple program to compare asynchronous and synchronous all close. It is a sample program, so feel free to modify it for your own testing purposes, such as adding conditions.

This script saves all the OHLCV data available on the chart to a CSV file.

The script removes all autotrading icons from the current chart

The Clean Market Watch script is a simple utility tool designed to quickly remove all symbols from your MetaTrader 5 Market Watch window with a single click. This is particularly useful when you want to start fresh with a clean workspace or when your Market Watch has become cluttered with too many symbols. Purpose Over time, traders often accumulate numerous symbols in their Market Watch window, making it difficult to focus on the instruments they actively trade. Manually removing symbols one by one can be tedious and time-consuming. This script automates the entire process, clearing all symbols in seconds.

Set TakeProfit by just dragging and dropping script on the desired price level.

This Script collects all MQL5 built-in indicators buffers and stores them in a CSV file for analysis purposes

While manually adjusting the stop-loss of a single trade to match its open price is a relatively simple task, managing numerous positions individually can be cumbersome and time-intensive. The Titik Impas Breakeven script for MT4/MT5 streamlines this process, providing efficiency and convenience for traders dealing with multiple positions.

Time-related functions for empirical detection of server time zone and daylight savings mode (DST) from history of quotes

This script was developed for displaying saved Strategy report from the Strategy Tester into a chart.

This script is a reference solution for mapping symbol names configured by users in MetaTrader 5 EAs or scripts to the actual names provided by the broker. It uses the Levenshtein distance algorithm to automatically identify the most similar symbol in Market Watch. It is ideal for developers facing compatibility issues with prefixes or suffixes in symbol names. This is a customizable starting point to adapt to any specific needs.

Candle Signature with Example | For Research and Development

Trading XAUUSD (Gold) is often influenced by major economic news events like USD, GBP, or EUR releases. To mitigate risks during these volatile periods, using a News Filter in your Expert Advisor (EA) is essential. In this article, I’ll share how to create a simple News Filter on MT5 and apply it to XAUUSD trading.

This is an example of ascending sort a struct list by a field. You can find out and customize the above algorithm depending on the purpose of use, this is the most basic example is also a direction to resolve the arrangement in an array of structure. The algorithm used in this example is Quick Sort and Merge Sort.

This function performs the main logic of opening a trade. It calculates the opening price, take profit levels and stop loss based on the symbol information and parameters provided by the user. Prepare a trade request (MqlTradeRequest) with the necessary information such as symbol, volume, order type, slippage, comment, magic number, etc. Call the OrderSend function to send the trade request and get the result. SetTypeFillingBySymbol function: determines the order fulfilment type (Fill or Cancel, Immediate or Cancel or Return) according to the symbol's fulfilment policy. GetMinTradeLevel function: calculates the minimum trade level based on the freeze level and stop level of the symbol. Adjusts the minimum level to ensure that it is within certain limits and returns the result.

This CalculateHistoryProfit script version 1.0 is designed to calculate profit for a specified period using a chart panel.

This is a simple script file to compute lot size either using risk percentage approach or the actual amount to risk.

Provide simplest class to read and parse CSV file

Export history of closed positions from MT5 retail hedging account selected between two dates. The resulting file is CSV that can be opened/imported with any spreadsheet software.

This is a script to print all open trades and their PnLs at a specific time in history.

12345678