MT5 Expert Advisor Template streamlines the creation process by providing pre-built modules for position sizing, risk management, and trade execution. The system includes parameters for ATR-based stop-loss and take-profit calculations, fixed or percentage-based lot sizing, and trading hour filters. It also supports partial closing of positions and spread monitoring. Since it is a template, the core logic for market entry and exit must be defined by the developer.
Read from MT5-EA-Template.mq5. Defaults are the author's; change them in the EA's Inputs tab.
Name
Type
Default
Description
Comment_0
string
==========
EA-Specific Parameters
Comment_1
string
==========
Trading Hours Settings
UseTradingHours
bool
false
Limit trading hours
TradingHourStart
ENUM_HOUR
h07
Trading start hour (Broker server hour)
TradingHourEnd
ENUM_HOUR
h19
Trading end hour (Broker server hour)
Comment_2
string
==========
ATR Settings
ATRPeriod
int
100
ATR period
ATRTimeFrame
ENUM_TIMEFRAMES
PERIOD_CURRENT
ATR timeframe
ATRMultiplierSL
double
2
ATR multiplier for stop-loss
ATRMultiplierTP
double
3
ATR multiplier for take-profit
Comment_a
string
==========
Risk Management Settings
RiskDefaultSize
ENUM_RISK_DEFAULT_SIZE
RISK_DEFAULT_FIXED
Position size mode
Show all 36 inputs
Name
Type
Default
Description
DefaultLotSize
double
0.01
Position size (if fixed or if no stop loss defined)
RiskBase
ENUM_RISK_BASE
RISK_BASE_BALANCE
Risk base
MaxRiskPerTrade
int
2
Percentage to risk each trade
MinLotSize
double
0.01
Minimum position size allowed
MaxLotSize
double
100
Maximum position size allowed
MaxPositions
int
1
Maximum number of positions for this EA
Comment_b
string
==========
Stop-Loss and Take-Profit Settings
StopLossMode
ENUM_MODE_SL
SL_FIXED
Stop-loss mode
DefaultStopLoss
int
0
Default stop-loss in points (0 = no stop-loss)
MinStopLoss
int
0
Minimum allowed stop-loss in points
MaxStopLoss
int
5000
Maximum allowed stop-loss in points
TakeProfitMode
ENUM_MODE_TP
TP_FIXED
Take-profit mode
DefaultTakeProfit
int
0
Default take-profit in points (0 = no take-profit)
MinTakeProfit
int
0
Minimum allowed take-profit in points
MaxTakeProfit
int
5000
Maximum allowed take-profit in points
Comment_c
string
==========
Partial Close Settings
UsePartialClose
bool
false
Use partial close
PartialClosePerc
double
50
Partial close percentage
ATRMultiplierPC
double
1
ATR multiplier for partial close
Comment_d
string
==========
Additional Settings
MagicNumber
int
0
Magic number
OrderNote
string
Comment for orders
Slippage
int
5
Slippage in points
MaxSpread
int
50
Maximum allowed spread to trade, in points
How to install it
1Download the sourceUse "Download source (.zip)" above, or clone EarnForex/MT5-Expert-Advisor-Template from GitHub, and unzip it.
2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL5/Experts.
3Copy the filesCopy the .mq5 file into Experts, and any .mqh files into the Include folder the code expects.
4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
5Test before you tradeRun it in the Strategy Tester, then attach it to a demo chart and allow algorithmic trading.
Third-party code. ForexR did not write, test or endorse this EA, and the summary above was generated automatically from its README and code. ForexR lists only repositories with readable source code and never hosts files. Read the code, backtest it and use a demo account first; automated trading can lose money quickly.
This development framework provides a comprehensive MQL library for building Expert Advisors, indicators, and scripts across MetaTrader 4 and 5 platforms. It facilitates cross-platform compatibility by offering a unified API that allows developers to port MQL4 code to MQL5 with minimal modifications. The library includ
This is a modular MetaTrader 5 expert advisor framework designed to accelerate the development of custom trading strategies. It provides a standardized base that includes position management, risk controls, and multi-symbol support. The template features configurable entry and exit logic, integrated stop loss and take
This MetaTrader 5 library and expert advisor automates Smart Money Concepts (SMC) and Inner Circle Trader (ICT) methodologies. It identifies market structure shifts, breaks of structure, order blocks, and liquidity zones. The system features a confluence-based entry mechanism that evaluates signals against kill zones,
Roffild Library is an extensive framework and collection of expert advisors for MetaTrader 5 that bridges MQL5 with modern data science tools. It provides functional implementations for machine learning models, specifically Multilayer Perceptron neural networks and Random Forests via the AlgLib library. The project fac
Orchard Forex Framework 3 is an educational development library for MetaTrader 5. It provides a structured foundation for building Expert Advisors using object-oriented programming. The repository includes base classes for handling trades, managing positions, and integrating common technical indicators like RSI, MACD,
This repository contains the MQL source code used by Forex Strategy Builder Professional to export automated trading strategies to MetaTrader 4 and MetaTrader 5. It serves as a standardized template for executing technical strategies generated by the software, handling order execution and trade management. The EA inclu