Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Twitter !
Rejoignez notre page de fans
Accédez à la CodeBase depuis votre terminal MetaTrader 5
Vous n'avez pas trouvé le bon code ? Commandez-le dans la section Freelance
Comment rédiger un Expert Advisor ou un indicateur

Codes sources MQL4 des scripts pour MetaTrader 4

icon

Les scripts sont de petites applications qui effectuent des actions ponctuelles. Vous pouvez, par exemple, supprimer tous les objets d'un graphique ou placer un ensemble de commandes pour une position ouverte. Vous trouverez ici des centaines d'applications permettant d'automatiser de petites fonctions analytiques ou de trading.

Les scripts peuvent être téléchargés gratuitement et exécutés dans MetaTrader 4.

Soumettre votre code
dernier | meilleur

The PrevDayLines.mq4 script is a tool for MetaTrader 4 that automatically draws three critical price levels from the previous trading day on your chart. These levels include the highest price (Max), the lowest price (Min), and the average price (Avg), providing traders with a clear visual reference for key support and resistance points.

The script creates a text object on the chart that continuously rotates and changes its position based on price levels.

This is a template switcher script mq4 file. This script will work with your MT4 (Metatrader 4) platform. It is to switch between templates.

HarmonicEA is an Expert Advisor (EA) developed for MetaTrader 4 (MT4) that utilizes harmonic pattern recognition and RSI-based signals to identify potential trading opportunities in the forex market. The EA is designed to detect various bullish and bearish harmonic patterns, including crab, butterfly, bat, deep bat, AB=CD, 3-drive, 5-drive, and shark patterns, across multiple timeframes. It incorporates risk management features such as dynamic lot sizing based on a percentage of account balance, maximum drawdown control, and a trailing stop mechanism to protect profits. HarmonicEA is suitable for traders seeking an automated solution to capitalize on harmonic patterns while managing risk effectively.

This script will detect an end-of-trading day and notify

This script will scan all the open trades and then will close the biggest winning/losing trade

This script will place hedge trade of unbalanced type in MT4.

This script will close all active trades and delete pending orders based on the order type passed on the input.

This script will close all active trades sequentially. following the order in which they were opened

This script will calculate the total active and closed orders based on order types

Find the current winning / losing streak in MT4 based on filters

Reverses all open trades after Closure for all symbols .

Bars Pips for Chart Symbol and Period selected

Hedge with a stop order, instead of placing a Stop Loss.

Hedge Dollar index USIDX against its constitutive FOREX pairs EURUSD GBPUSD USDJPY USDCAD USDSEK USDCHF

Break on Code Error ! This script is a general example of using error brake in any strategy.

The Breakeven Point, or Titik Impas, denotes the price level at which a trade's profit becomes zero. By setting a position to Titik Impas Breakeven, the stop-loss is aligned with the position's opening price. This strategy proves valuable when you aim to allow profits to accumulate while ensuring that the trade remains secure and does not revert to negative territory.

All open trades must be of same symbol and type, e.g. all GBPUSD and all BUY. This script will close out your position using one large trade to hedge your position then using CloseBy() function to close all trades against the one large trade until all trades are closed. There can be a maximum of 500 open trades.

Multi_BreakEven is a script file that allows multiples entry positions to set to breakeven using pips or target price when the trade is in your favor.

Multi Selllimit and Sellstop orders are script files that enable traders to place multiple orders with ease. These orders allow traders to enter the market at a specific price level, or at a specified number of pips away from the current market price, with stop-loss and take-profit levels. By default, the pips value is set to 400, which means the trade will be placed 400 pips away from the current market price for a 5-digit broker. Moreover, the multi Selllimit and Sellstop orders offer traders the flexibility to customize their trading strategies. Traders can set the stop-loss level to zero if they do not use stop-loss, and can choose between a target price or a pip-based entry. This level of flexibility allows traders to tailor their trading strategies to their specific needs, which can result in better trading outcomes.

Multi buylimit and buystop orders are script files that enable traders to place multiple orders with ease. With just one command, traders can place multiple buylimit or buystop orders using either a target price or pips. By default, the pips value is set to 400, which means the trade will be placed 400 pips away from the current market price for a 5-digit broker. This setup includes stop-loss and take-profit levels, which can be adjusted based on the trader's preferences. Notably, these orders come with a level of flexibility that enables traders to fine-tune their trading strategies. For instance, a trader can opt to set the stop-loss level to zero if they do not use stop-loss.

To assist traders who wish to open multiple sell orders quickly, a script file has been developed that allows them to execute a large number of trades with just one command. The default take profit and stop loss values are set in 5-digit broker format, but for traders using a 4-digit broker, the default must be TP=40 and SL=20. Num_of_Sell is the number of trades to execute. This script file can be extremely useful for traders who want to take advantage of market conditions quickly and efficiently. By simplifying the process of opening multiple sell orders, it can save traders valuable time and allow them to focus on other aspects of their trading strategy.

To assist traders who wish to open multiple buy orders quickly, a script file has been developed that allows them to execute a large number of trades with just one command. The default take profit and stop loss values are set in 5-digit broker format, but for traders using a 4-digit broker, the default must be TP=40 and SL=20. Num_of_Buy is the number trades the trader wish to open instantly. This script file can be extremely useful for traders who want to take advantage of market conditions quickly and efficiently. By simplifying the process of opening multiple buy orders, it can save traders valuable time and allow them to focus on other aspects of their trading strategy.

Below you can find a super simple method to create a license based on MT4 account name. Place in your init function: CheckLicense(); The stringLower method makes sure the account name is in lowercase. Then you can check this value with the account name you want to check.

Find what are the highs and the lows that happened the last 60000 ms

Convert historical data from M1 to M1, M5, M15, M30, H1, H4, D1, W1 and MN, specifying the start date.

this Script will get content message from Popup Alert dialog

A Simple Trade Management Script

This Script Closed All Open Orders At Once (Except Pending Orders)

Draw trade history onto chart

Plot entry and exit as line objects from MQL5 signal CSV onto chart

This Script is the example of using function LineNotify that use to send message to LINE APP via Line Notify service As the function LineNotify use webrequest to send HTTP request so it can be used in EA or Script program only , can't use in Indicator program

This simple quick & dirty script code will output a CSV file of all the Signals' properties as reported by the MQL4 Trade Signals functionality.

Just simple codes to Disable/Enable Auto/Algo-Trading in both MT5 and MT4. Of course, DLLs must be allowed, This cannot be done without DLLs

Export the history of transactions on the MT4 trading account.

123456789