This artificial intelligence expert advisor for MetaTrader 5 utilizes a Double-Dueling Deep Recurrent Q-Network with LSTM memory to automate forex trading.
The system processes a 45-dimensional state space to execute trades based on reinforcement learning. It includes extensive risk management features such as ATR-based dynamic stop losses, take profit targets, and a maximum holding time of 72 hours. To prevent overtrading, it employs a sophisticated cooldown system and choppy market detection. The EA requires a separate pre-trained model file to operate.
Double-Dueling DRQN with LSTM recurrent neural network
ATR-based dynamic stop loss and profit targets
Multi-layer account protection and drawdown limits
Read from cortex5.mq5. Defaults are the author's; change them in the EA's Inputs tab.
Name
Type
Default
Description
InpModelFileName
string
DoubleDueling_DRQN_Model.dat
AI brain file (must be trained first)
InpRiskPercent
double
5.0
Risk per trade as % of total account balance
InpMaxSpread
double
15.0
Don't trade if broker spread exceeds this (points)
InpATRMultiplier
double
2.0
Stop loss distance as multiple of Average True Range
InpRRRatio
double
1.5
Risk:Reward ratio (1.5 = target 1.5x profit vs loss)
InpMaxDrawdown
double
10.0
Pause trading if account loses more than this %
InpMinWinRate
int
30
Pause if win rate drops below this % (over last 10 trades)
InpCommissionPerLot
double
0.0
Your broker's commission per lot (for accurate cost calculation)
InpUseRiskSizing
bool
true
Use smart position sizing based on volatility
InpEnforceSymbolTF
bool
true
Only trade the symbol/timeframe the model was trained on
InpAllowPositionScaling
bool
true
Allow adjusting position size based on signal strength
InpMaxHoldingHours
int
72
Maximum hours to hold a position (Phase 1)
Show all 40 inputs
Name
Type
Default
Description
InpProfitTargetATR
double
2.5
Take profit at N x ATR (Phase 1)
InpUseProfitTargets
bool
true
Enable automatic profit taking (Phase 1)
InpUseMaxHoldingTime
bool
true
Enable maximum holding time control (Phase 1)
InpHoldingTimePenalty
double
0.001
Penalty per hour held in reward calculation (Phase 1)
InpQuickExitBonus
double
0.005
Bonus for trades < 24 hours (Phase 1)
InpFlatActionWeight
double
1.5
Increased weight for FLAT action in future training (Phase 2)
InpEnhancedRewards
bool
true
Use enhanced reward calculation (Phase 2)
InpDrawdownPenalty
double
0.01
Penalty for unrealized drawdown (Phase 2)
InpUseDynamicStops
bool
true
Enable dynamic stop loss tightening (Phase 3)
InpStopTightenRate
double
0.8
Stop tightening multiplier per day held (Phase 3)
InpUsePositionFeatures
bool
true
Add position-aware features to state (Phase 3)
InpUseMarketRegime
bool
true
Enable market regime detection (Phase 3)
InpMinBarsBetweenTrades
int
4
Minimum bars between trades
InpMaxTradesPerDay
int
8
Maximum trades per day
InpEnforceFlat
bool
true
Force FLAT when position reaches limits
InpUseAdvancedCooldown
bool
true
Enable enhanced cooldown system
InpMinCooldownMinutes
int
65
Minimum cooldown period after closing position (minutes)
InpUseChoppyDetection
bool
true
Enable choppy market detection
InpChoppyATRThreshold
double
0.8
ATR ratio threshold for choppy markets (current vs 20-period avg)
InpChoppyLookbackPeriod
int
20
Lookback period for choppy market analysis
InpChoppyMinRange
int
30
Minimum points range to avoid micro-movements
InpUseConsecutiveLosses
bool
true
Enable consecutive loss protection
InpMaxConsecutiveLosses
int
3
Max consecutive losses before extended cooldown
InpExtendedCooldownMin
int
120
Extended cooldown after consecutive losses (minutes)
InpUseLossBasedCooldown
bool
true
Scale cooldown based on loss size
InpUseSignalRefinement
bool
true
Enable enhanced signal processing
InpUseSignalSmoothing
bool
true
Enable signal smoothing over multiple bars
InpSignalSmoothingPeriod
int
3
Number of bars for signal averaging
How to install it
1Download the sourceUse "Download source (.zip)" above, or clone toniibrahim/cortex5-ai-trading 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 MetaTrader 5 expert advisor combines technical indicators with machine learning forecasts to trade the Forex market. It uses a trend-following approach based on Exponential Moving Average crossovers, filtered by the Average Directional Index and volume confirmations. A unique feature is its integration with extern
This machine learning robot for MetaTrader 5 uses an ensemble of AI models including LSTM, GRU, and LightGBM to predict price movements. It executes trades based on signal confidence and predicted price targets. The EA features multiple risk controls such as volatility filters, trend-based MA filters, RSI checks, and a
This MetaTrader 5 expert advisor utilizes an Echo State Network, which is a type of recurrent neural network, to analyze price action and execute trades. The system computes various statistical inputs, including price volatility, mean values, and Hurst exponent metrics, to feed its reservoir computing model. Risk is ma
This MetaTrader 5 expert advisor is a legacy project focused on machine learning and neural network forecasting. The system implements logic for training models and generating forecasts using technical indicators like ADX and ZigZag. It includes several optional modules for long, short, hedging, and martingale trading
LQS AI Institutional Engine is a MetaTrader 5 robot designed for trading gold using market microstructure analysis. It combines four analytical modules focusing on liquidity sweeps, order flow divergence, Wyckoff accumulation and distribution phases, and multiple anchored VWAP levels. The system features an integrated
This machine learning expert advisor for MetaTrader 5 utilizes ensemble and deep learning models to analyze market patterns. It offers a versatile multi-strategy approach, allowing users to toggle between trend-following, scalping, and grid-hedging behaviors. Risk controls are comprehensive, featuring fixed percentage