A comprehensive collection of algorithmic trading strategies for MetaTrader 5, including production-ready Expert Advisors, machine learning models, and backtesting frameworks.
- Repository Structure
- Frontline Strategies - Production-ready EAs
- AI & Machine Learning - ONNX models for price prediction
- Back-Pedal Strategies - Alternative implementations
- Backtesting - Python backtesting framework
- Strategy Performance
- Quick Start
- Disclaimer
profitable-expert-advisor/
├── frontline/ # Production-ready trading strategies
│ ├── MQL5/ # MetaTrader 5 Expert Advisors
│ └── tradingview/ # TradingView Pine Script strategies
├── ai/ # ONNX machine learning models
├── back-pedal/ # Alternative/experimental strategies
├── backtesting/ # Python backtesting framework
│ ├── MT5/ # MT5 Python backtesting
│ └── own/ # Custom backtesting tools
└── paper/ # Research papers and simulations
Location: frontline/
Production-ready Expert Advisors with comprehensive backtesting and performance reports.
-
RSI Scalping Strategies
- RSIScalpingXAUUSD (Gold)
- RSIScalpingBTCUSD (Bitcoin)
- RSIScalpingMSFT (Microsoft Stock)
- RSIScalpingTSLA (Tesla Stock)
-
Advanced Gold Strategies
- RSICrossOverReversalXAUUSD
- RSIMidPointHijackXAUUSD (Multi-strategy system)
- EMASlopeDistanceCocktailXAUUSD
- DarvasBoxXAUUSD
-
TradingView Strategies
- SSEEMARSICocktail (Pine Script)
Performance Reports: All strategies include detailed HTML reports and PNG charts showing P&L, drawdown, and trade statistics.
📖 View Full Frontline Documentation
Location: ai/
Complete framework for training and deploying ONNX machine learning models in MetaTrader 5.
- 🧠 LSTM neural networks for price prediction
- 📊 Technical indicators as features (RSI, EMA, ATR, etc.)
- 🔄 ONNX export for MQL5 integration
- 📈 Real-time prediction in Expert Advisors
cd ai
pip install -r requirements.txt
python train_onnx_model.py --symbol XAUUSD --timeframe H1Location: back-pedal/
Alternative implementations and experimental strategies for comparison and testing.
- RSIScalpingEURUSD
- RSIScalpingXAGUSD (Silver)
- RSIScalpingAPPL (Apple Stock)
- RSIReversalAsianAUDUSD
- RSIReversalAsianEURUSD
- RSIFollowReverseEMACrossOverBTCUSD
📖 View Back-Pedal Documentation
Location: backtesting/
Complete Python framework for backtesting strategies using MetaTrader 5 historical data.
- Base strategy class for easy implementation
- Multiple indicator support (RSI, EMA, SMA, ATR, MACD)
- Performance analysis and visualization
- Example strategies included
📖 View Backtesting Documentation
All strategies include comprehensive performance reports with:
- Equity Curves: Account balance over time
- Drawdown Analysis: Maximum drawdown periods
- Trade Statistics: Win rate, profit factor, average win/loss
- Monthly Performance: Month-by-month returns
- P&L Charts: Visual profit and loss distribution
- Frontline Strategies:
frontline/MQL5/[StrategyName]/report.pngandreport.html - Back-Pedal Strategies:
back-pedal/[StrategyName]/test-balance.png
- For Production: Use strategies from
frontline/MQL5/ - For Experimentation: Try
back-pedal/strategies - For ML Trading: Explore
ai/ONNX models
- Copy EA file to MT5
MQL5/Experts/directory - Compile in MetaEditor (F7)
- Review backtest reports (
report.htmlandreport.png) - Test on demo account
- Deploy with appropriate risk management
- Review HTML reports for detailed statistics
- Check PNG charts for visual performance
- Monitor live trading metrics
- Adjust parameters as needed
The following sections document individual EAs from the original collection:
- Strategy: RSI-based reversal trading during Asian session
- Key Features:
- Uses RSI (Relative Strength Index) for entry and exit signals
- Specifically optimized for AUD/USD pair during Asian session (00:00-08:00 UTC)
- Implements strict risk management with configurable stop loss and take profit
- Includes spread monitoring to avoid trading during high spread conditions
- Features a visual panel showing real-time trading metrics
Core Parameters:
// RSI Settings
RSIPeriod = 28; // RSI period
OverboughtLevel = 64; // Overbought level
OversoldLevel = 13; // Oversold level
// Risk Management
TakeProfitPips = 175; // Take profit in pips
StopLossPips = 5; // Stop loss in pips
MaxLotSize = 0.1; // Maximum lot size
MaxSpread = 1000; // Maximum allowed spread in pips
MaxDuration = 140; // Maximum trade duration in hoursPerformance Report:
- Strategy: Multi-strategy approach combining RSI and EMA crossovers
- Key Features:
- Implements three distinct strategies:
- RSI Follow Strategy
- RSI Reverse Strategy
- EMA Cross Strategy
- Optimized for Gold (XAU/USD) trading
- Includes strategy locking mechanism to protect profits
- Features cooldown periods after losses
- Time-based trading windows for each strategy
- Implements three distinct strategies:
Core Parameters:
// RSI Follow Strategy
InpRSIPeriod = 87; // RSI Period
InpRSIOverbought = 72; // RSI Overbought Level
InpRSIOversold = 50; // RSI Oversold Level
// RSI Reverse Strategy
InpRSIReversePeriod = 59; // RSI Period
InpRSIReverseOverbought = 51; // RSI Overbought Level
InpRSIReverseOversold = 49; // RSI Oversold Level
// Strategy Management
InpEnableStrategyLock = false; // Enable Strategy Lock
InpLockProfitThreshold = 0.0; // Lock Profit Threshold (pips)Performance Report:
- Strategy: Similar to AUD/USD version but optimized for EUR/USD
- Key Features:
- RSI-based reversal strategy during Asian session
- Customized parameters for EUR/USD pair
- Risk management features
- Session-based trading
Core Parameters:
// RSI Settings
RSIPeriod = 14; // RSI period
OverboughtLevel = 78; // Overbought level
OversoldLevel = 20; // Oversold level
// Risk Management
TakeProfitPips = 635; // Take profit in pips
StopLossPips = 290; // Stop loss in pips
MaxLotSize = 0.1; // Maximum lot size
MaxDuration = 22; // Maximum trade duration in hours
RSIExitLevel = 57; // RSI level to exitPerformance Report:
- Strategy: RSI crossover strategy for Gold trading
- Key Features:
- Uses RSI crossovers for entry and exit signals
- Optimized for Gold market conditions
- Includes multiple timeframe analysis
- Risk management features
Core Parameters:
// RSI Settings
rsiPeriod = 19; // RSI period
overboughtLevel = 93; // Overbought level
oversoldLevel = 22; // Oversold level
// EMA Settings
emaPeriod = 140; // EMA period
emaSlopeThreshold = 105; // EMA slope threshold
emaDistanceThreshold = 165; // EMA distance threshold
// Risk Management
TrailingStop = 295; // Trailing stop in pipsPerformance Report:
- Strategy: Multi-strategy approach combining RSI Follow, RSI Reverse, and EMA crossovers
- Key Features:
- Implements three distinct strategies:
- RSI Follow Strategy
- RSI Reverse Strategy
- EMA Cross Strategy
- Optimized for Bitcoin (BTC/USD) trading
- Includes strategy locking mechanism to protect profits
- Features cooldown periods after losses
- Time-based trading windows for each strategy
- Adaptive position sizing based on volatility
- Implements three distinct strategies:
Core Parameters:
// RSI Follow Strategy
InpRSIPeriod = 14; // RSI Period
InpRSIOverbought = 70; // RSI Overbought Level
InpRSIOversold = 30; // RSI Oversold Level
// RSI Reverse Strategy
InpRSIReversePeriod = 14; // RSI Period
InpRSIReverseOverbought = 80; // RSI Overbought Level
InpRSIReverseOversold = 20; // RSI Oversold Level
// EMA Settings
InpEMAPeriod = 200; // EMA Period
InpEMASlopeThreshold = 0.1; // EMA Slope Threshold
InpEMADistanceThreshold = 100; // EMA Distance Threshold
// Strategy Management
InpEnableStrategyLock = true; // Enable Strategy Lock
InpLockProfitThreshold = 1000; // Lock Profit Threshold (pips)
InpCooldownPeriod = 24; // Cooldown Period in hoursPerformance Report:
- Strategy: Darvas Box breakout strategy for Gold trading
- Key Features:
- Implements the classic Darvas Box theory for trend identification
- Specifically optimized for Gold (XAU/USD) trading
- Features dynamic box size adjustment based on volatility
- Includes multiple timeframe analysis
- Implements strict risk management with configurable stop loss and take profit
- Features a visual panel showing real-time box levels and trading metrics
Core Parameters:
// Box Settings
BoxPeriod = 20; // Box formation period
MinBoxSize = 50; // Minimum box size in pips
MaxBoxSize = 200; // Maximum box size in pips
VolatilityFactor = 1.5; // Volatility adjustment factor
// Risk Management
TakeProfitPips = 300; // Take profit in pips
StopLossPips = 150; // Stop loss in pips
MaxLotSize = 0.1; // Maximum lot size
MaxSpread = 1000; // Maximum allowed spread in pips
MaxDuration = 48; // Maximum trade duration in hours
// Timeframe Settings
PrimaryTF = PERIOD_H1; // Primary timeframe
SecondaryTF = PERIOD_H4; // Secondary timeframe for confirmationPerformance Report:
- Strategy: Advanced EMA-based strategy combining slope and distance analysis
- Key Features:
- Uses EMA slope and price distance for entry signals
- Implements a sophisticated scoring system
- Dynamic stop loss and take profit based on ATR
- Trailing stop functionality
- Cooldown periods to prevent over-trading
- Maximum drawdown protection
- Time-based position management
Core Parameters:
// EMA Settings
emaPeriod = 64; // EMA period
emaTimeFrame = PERIOD_H1; // EMA Timeframe
slopeThreshold = 82; // EMA slope threshold
distanceThreshold = 17.5; // Distance threshold
// Risk Management
atrMultiplier = 7.6; // ATR multiplier for SL/TP
TrailingStop = 335; // Trailing stop in points
max_drawdown = 0.1; // Maximum drawdown percentage
minimumLotSize = 0.03; // Minimum lot size
maxTimeInPosition = 2; // Maximum time in position (hours)
// Strategy Control
scoreThreshold = 5200; // Score threshold for trade entry
maxScore = 7900; // Maximum score value
cooldownMinutes = 18; // Cooldown period
tradeCooldownMinutes = 19; // Trade debounce periodPerformance Metrics:
- Yearly return: 28%
- Profit Factor: 1.222
- Recovery Factor: 7.17
- Expected Payoff: 1.3
- Sharpe Ratio: 4.11
- Maximum Drawdown: 14.00%
- Win Rate: 64.65%
- Total Trades: 2863
Performance Report:
The RSI Reversal strategy is based on the principle that markets tend to revert to their mean after reaching extreme conditions. The strategy:
- Enters trades when RSI reaches overbought/oversold levels
- Uses Asian session timing to capitalize on specific market conditions
- Implements strict risk management to protect capital
- Takes advantage of mean reversion tendencies in currency pairs
This advanced strategy combines multiple approaches:
- RSI Follow: Capitalizes on strong trends
- RSI Reverse: Takes advantage of market reversals
- EMA Cross: Provides additional confirmation signals
- Strategy locking: Protects profits during favorable conditions
- Cooldown periods: Prevents over-trading after losses
This strategy focuses on RSI crossover signals:
- Uses RSI crossovers as primary entry signals
- Combines with EMA for trend confirmation
- Implements multiple timeframe analysis
- Optimized for Gold market volatility
- Features dynamic stop loss and take profit levels
The Darvas Box strategy is based on Nicolas Darvas' box theory:
- Identifies consolidation periods as "boxes"
- Trades breakouts from these boxes
- Uses dynamic box sizing based on volatility
- Implements multiple timeframe confirmation
- Features strict risk management rules
This sophisticated strategy combines multiple technical elements:
- EMA Slope Analysis:
- Monitors the rate of change in EMA
- Uses slope thresholds for trend confirmation
- Implements slope-based scoring system
- Distance Analysis:
- Measures price distance from EMA
- Uses distance thresholds for entry signals
- Implements mean reversion principles
- Advanced Risk Management:
- Dynamic ATR-based stop losses
- Trailing stop functionality
- Maximum drawdown protection
- Time-based position management
- Scoring System:
- Combines multiple factors into a single score
- Uses thresholds for trade entry/exit
- Implements cooldown periods
- Features maximum score clamping
These EAs are designed to be profitable in the long run due to:
-
Risk Management
- Strict stop loss implementation
- Take profit targets
- Spread monitoring
- Position sizing control
-
Market Timing
- Session-based trading
- Time-specific entry and exit rules
- Avoidance of high volatility periods
-
Strategy Diversification
- Multiple entry and exit conditions
- Different timeframes
- Various technical indicators
-
Adaptive Features
- Strategy locking during profitable periods
- Cooldown periods after losses
- Spread-based trade filtering
- Review Performance Reports: Check
report.htmlandreport.pngin each strategy folder - Test on Demo: Always test on demo account first
- Configure Parameters: Adjust based on your risk tolerance
- Deploy: Copy EA to MT5 and attach to chart
- Monitor: Regularly review performance and adjust as needed
Each EA comes with configurable parameters that can be adjusted based on:
- Market conditions
- Risk tolerance
- Trading style
- Account size
Please refer to:
- Individual EA files for parameter descriptions
frontline/README.mdfor production strategiesback-pedal/README.mdfor alternative implementationsai/README.mdfor machine learning models
Trading involves substantial risk of loss. These EAs are provided for educational purposes only. Always test thoroughly on a demo account before using with real money. Past performance does not guarantee future results.






