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

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.

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

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.

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.

The Auto SL TP by Risk Reward Ratio script is a simple yet powerful tool designed for MetaTrader 5 traders who want to streamline their risk management process. This script automates the process of setting Stop Loss (SL) and Take Profit (TP) levels for open positions based on a user-defined Risk:Reward ratio and Stop Loss in pips. Whether you're a beginner or an experienced trader, this script saves time and ensures consistent risk management.

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 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.

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).

The script removes all autotrading icons from the current chart

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

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 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.

It will delete all objects on the chart when the compiled executable is dragged onto the chart

Script for partially close active buy orders

Partially close active sell orders

A quick little script to make traders' lives easier. The one thing that always annoys me is resetting the properties like colors for a new chart, to make it look the way i like it. So Here is a script to make things smoother.

Showing different ways of the Aroon values calculation

This script finds DeMark pivot points, displays them on the chart and indicates their dimensions.

This function performs the main logic of opening a trade. Calculates the opening price, take profit levels and stop loss based on symbol information and parameters provided by the user. Prepare a trade request (MqlTradeRequest) with the necessary information, such as symbol, volume, order type, deviation, comment, magic number, etc. Call the OrderSend function to send the operation request and get the result. SetTypeFillingBySymbol function: Determines the order fill type (Fill or Kill, Immediate or Cancel, or Return) based on the symbol's filling policy. GetMinTradeLevel function: Calculates the minimum operating level based on the freeze level and the symbol stops level. Adjusts the minimum level to make sure it is within certain limits and returns the result.

Script to determine whether your Broker follows the US, UK or AU daylight (DST) schedule.

12345678