diff --git a/README.md b/README.md index 079d7ef..bf788ec 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,157 @@ -# Table of Contents +# Profitable Expert Advisor Repository -- [Table of Contents](#table-of-contents) -- [Profitable Expert Advisors (EAs)](#profitable-expert-advisors-eas) - - [Available EAs](#available-eas) - - [1. RSI Reversal Asian AUD/USD](#1-rsi-reversal-asian-audusd) - - [2. RSI MidPoint Hijack XAU/USD](#2-rsi-midpoint-hijack-xauusd) - - [3. RSI Reversal Asian EUR/USD](#3-rsi-reversal-asian-eurusd) - - [4. RSI CrossOver Reversal XAU/USD](#4-rsi-crossover-reversal-xauusd) - - [5. RSI Follow Reverse EMA CrossOver BTC/USD](#5-rsi-follow-reverse-ema-crossover-btcusd) - - [6. DarvasBoxXAUUSD](#6-darvasboxxauusd) - - [7. EMASlopeDistanceCocktailXAUUSD](#7-emaslopedistancecocktailxauusd) - - [Strategy Rationale](#strategy-rationale) - - [RSI Reversal Strategy](#rsi-reversal-strategy) - - [RSI MidPoint Hijack Strategy](#rsi-midpoint-hijack-strategy) - - [RSI CrossOver Reversal Strategy](#rsi-crossover-reversal-strategy) - - [Darvas Box Strategy](#darvas-box-strategy) - - [EMA Slope Distance Cocktail Strategy](#ema-slope-distance-cocktail-strategy) - - [Profitability Factors](#profitability-factors) - - [Usage](#usage) - - [Disclaimer](#disclaimer) +A comprehensive collection of algorithmic trading strategies for MetaTrader 5, including production-ready Expert Advisors, machine learning models, and backtesting frameworks. + +## Table of Contents + +- [Repository Structure](#repository-structure) +- [Frontline Strategies](#frontline-strategies) - Production-ready EAs +- [AI & Machine Learning](#ai--machine-learning) - ONNX models for price prediction +- [Back-Pedal Strategies](#back-pedal-strategies) - Alternative implementations +- [Backtesting](#backtesting) - Python backtesting framework +- [Strategy Performance](#strategy-performance) +- [Quick Start](#quick-start) +- [Disclaimer](#disclaimer) + +## Repository Structure + +``` +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 +``` + +## Frontline Strategies + +**Location**: [`frontline/`](frontline/) + +Production-ready Expert Advisors with comprehensive backtesting and performance reports. + +### Available Strategies + +1. **RSI Scalping Strategies** + - RSIScalpingXAUUSD (Gold) + - RSIScalpingBTCUSD (Bitcoin) + - RSIScalpingMSFT (Microsoft Stock) + - RSIScalpingTSLA (Tesla Stock) + +2. **Advanced Gold Strategies** + - RSICrossOverReversalXAUUSD + - RSIMidPointHijackXAUUSD (Multi-strategy system) + - EMASlopeDistanceCocktailXAUUSD + - DarvasBoxXAUUSD + +3. **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](frontline/README.md)** + +## AI & Machine Learning + +**Location**: [`ai/`](ai/) + +Complete framework for training and deploying ONNX machine learning models in MetaTrader 5. + +### Features + +- 🧠 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 + +### Quick Start + +```bash +cd ai +pip install -r requirements.txt +python train_onnx_model.py --symbol XAUUSD --timeframe H1 +``` + +📖 **[View Full AI Documentation](ai/README.md)** + +## Back-Pedal Strategies + +**Location**: [`back-pedal/`](back-pedal/) + +Alternative implementations and experimental strategies for comparison and testing. + +### Available Strategies + +- RSIScalpingEURUSD +- RSIScalpingXAGUSD (Silver) +- RSIScalpingAPPL (Apple Stock) +- RSIReversalAsianAUDUSD +- RSIReversalAsianEURUSD +- RSIFollowReverseEMACrossOverBTCUSD + +📖 **[View Back-Pedal Documentation](back-pedal/README.md)** + +## Backtesting + +**Location**: [`backtesting/`](backtesting/) + +### MT5 Python 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](backtesting/MT5/README.md)** -# Profitable Expert Advisors (EAs) +## Strategy Performance -This repository contains a collection of profitable Expert Advisors (EAs) designed for MetaTrader 5. Each EA implements different trading strategies optimized for specific currency pairs and market conditions. +All strategies include comprehensive performance reports with: -## Available EAs +- **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 + +### Performance Reports Location + +- **Frontline Strategies**: `frontline/MQL5/[StrategyName]/report.png` and `report.html` +- **Back-Pedal Strategies**: `back-pedal/[StrategyName]/test-balance.png` + +## Quick Start + +### 1. Choose Your Strategy + +- **For Production**: Use strategies from `frontline/MQL5/` +- **For Experimentation**: Try `back-pedal/` strategies +- **For ML Trading**: Explore `ai/` ONNX models + +### 2. Install and Deploy + +1. Copy EA file to MT5 `MQL5/Experts/` directory +2. Compile in MetaEditor (F7) +3. Review backtest reports (`report.html` and `report.png`) +4. Test on demo account +5. Deploy with appropriate risk management + +### 3. Monitor Performance + +- Review HTML reports for detailed statistics +- Check PNG charts for visual performance +- Monitor live trading metrics +- Adjust parameters as needed + +## Legacy EA Documentation + +The following sections document individual EAs from the original collection: ### 1. RSI Reversal Asian AUD/USD - **Strategy**: RSI-based reversal trading during Asian session @@ -51,9 +177,9 @@ MaxSpread = 1000; // Maximum allowed spread in pips MaxDuration = 140; // Maximum trade duration in hours ``` -**Test Balance Results:** +**Performance Report:**
- RSI Reversal Asian AUD/USD Test Balance + RSI Reversal Asian AUD/USD Performance
### 2. RSI MidPoint Hijack XAU/USD @@ -85,9 +211,9 @@ InpEnableStrategyLock = false; // Enable Strategy Lock InpLockProfitThreshold = 0.0; // Lock Profit Threshold (pips) ``` -**Test Balance Results:** +**Performance Report:**
- RSI MidPoint Hijack XAU/USD Test Balance + RSI MidPoint Hijack XAU/USD Performance
### 3. RSI Reversal Asian EUR/USD @@ -113,9 +239,9 @@ MaxDuration = 22; // Maximum trade duration in hours RSIExitLevel = 57; // RSI level to exit ``` -**Test Balance Results:** +**Performance Report:**
- RSI Reversal Asian EUR/USD Test Balance + RSI Reversal Asian EUR/USD Performance
### 4. RSI CrossOver Reversal XAU/USD @@ -142,9 +268,9 @@ emaDistanceThreshold = 165; // EMA distance threshold TrailingStop = 295; // Trailing stop in pips ``` -**Test Balance Results:** +**Performance Report:**
- RSI CrossOver Reversal XAU/USD Test Balance + RSI CrossOver Reversal XAU/USD Performance
### 5. RSI Follow Reverse EMA CrossOver BTC/USD @@ -183,9 +309,9 @@ InpLockProfitThreshold = 1000; // Lock Profit Threshold (pips) InpCooldownPeriod = 24; // Cooldown Period in hours ``` -**Test Balance Results:** +**Performance Report:**
- RSI Follow Reverse EMA CrossOver BTC/USD Test Balance + RSI Follow Reverse EMA CrossOver BTC/USD Performance
### 6. DarvasBoxXAUUSD @@ -218,9 +344,9 @@ PrimaryTF = PERIOD_H1; // Primary timeframe SecondaryTF = PERIOD_H4; // Secondary timeframe for confirmation ``` -**Test Balance Results:** +**Performance Report:**
- Darvas Box XAU/USD Test Balance + Darvas Box XAU/USD Performance
### 7. EMASlopeDistanceCocktailXAUUSD @@ -266,9 +392,9 @@ tradeCooldownMinutes = 19; // Trade debounce period - Win Rate: 64.65% - Total Trades: 2863 -**Test Balance Results:** +**Performance Report:**
- EMA Slope Distance Cocktail XAU/USD Test Balance + EMA Slope Distance Cocktail XAU/USD Performance
## Strategy Rationale @@ -352,13 +478,27 @@ These EAs are designed to be profitable in the long run due to: ## Usage +### For Production Trading + +1. **Review Performance Reports**: Check `report.html` and `report.png` in each strategy folder +2. **Test on Demo**: Always test on demo account first +3. **Configure Parameters**: Adjust based on your risk tolerance +4. **Deploy**: Copy EA to MT5 and attach to chart +5. **Monitor**: Regularly review performance and adjust as needed + +### Parameter Configuration + Each EA comes with configurable parameters that can be adjusted based on: - Market conditions - Risk tolerance - Trading style - Account size -Please refer to the individual EA files for specific parameter descriptions and recommended settings. +Please refer to: +- Individual EA files for parameter descriptions +- `frontline/README.md` for production strategies +- `back-pedal/README.md` for alternative implementations +- `ai/README.md` for machine learning models ## Disclaimer diff --git a/back-pedal/README.md b/back-pedal/README.md new file mode 100644 index 0000000..4408a0e --- /dev/null +++ b/back-pedal/README.md @@ -0,0 +1,109 @@ +# Back-Pedal Strategies + +This directory contains alternative implementations and experimental trading strategies. These are variations or earlier versions of strategies that may be used for comparison, testing, or as fallback options. + +## Directory Structure + +``` +back-pedal/ +├── RSIScalpingEURUSD/ # RSI Scalping for EUR/USD +├── RSIScalpingXAGUSD/ # RSI Scalping for Silver (XAG/USD) +├── RSIScalpingAPPL/ # RSI Scalping for Apple Stock +├── RSIReversalAsianAUDUSD/ # RSI Reversal for AUD/USD (Asian session) +├── RSIReversalAsianEURUSD/ # RSI Reversal for EUR/USD (Asian session) +└── RSIFollowReverseEMACrossOverBTCUSD/ # Multi-strategy for Bitcoin +``` + +## Available Strategies + +### 1. RSIScalpingEURUSD +- **Instrument**: EUR/USD +- **Strategy**: RSI-based scalping +- **Performance**: See `test-balance.png` + +![RSI Scalping EURUSD Performance](RSIScalpingEURUSD/test-balance.png) + +### 2. RSIScalpingXAGUSD +- **Instrument**: Silver (XAG/USD) +- **Strategy**: RSI scalping optimized for silver +- **Performance**: See `test-balance.png` + +![RSI Scalping XAGUSD Performance](RSIScalpingXAGUSD/test-balance.png) + +### 3. RSIScalpingAPPL +- **Instrument**: Apple Stock (AAPL) +- **Strategy**: RSI scalping for stock trading +- **Status**: In development + +### 4. RSIReversalAsianAUDUSD +- **Instrument**: AUD/USD +- **Strategy**: RSI reversal during Asian trading session +- **Time Window**: Optimized for Asian session hours +- **Performance**: See `test-balance.png` + +![RSI Reversal Asian AUDUSD Performance](RSIReversalAsianAUDUSD/test-balance.png) + +### 5. RSIReversalAsianEURUSD +- **Instrument**: EUR/USD +- **Strategy**: RSI reversal during Asian trading session +- **Time Window**: Optimized for Asian session hours +- **Performance**: See `test-balance.jpg` + +![RSI Reversal Asian EURUSD Performance](RSIReversalAsianEURUSD/test-balance.jpg) + +### 6. RSIFollowReverseEMACrossOverBTCUSD +- **Instrument**: Bitcoin (BTC/USD) +- **Strategy**: Multi-strategy system combining: + - RSI Follow Strategy + - RSI Reverse Strategy + - EMA Cross Strategy +- **Performance**: See `test-balance.jpg` + +![RSI Follow Reverse EMA CrossOver BTCUSD Performance](RSIFollowReverseEMACrossOverBTCUSD/test-balance.jpg) + +## Purpose + +These strategies serve as: +- **Alternative Implementations**: Different parameter sets or logic variations +- **Testing Ground**: Experimental features and modifications +- **Comparison Baseline**: Reference implementations for performance comparison +- **Fallback Options**: Backup strategies when primary strategies need adjustment + +## Differences from Frontline + +The strategies in this directory may differ from the `frontline/` versions in: +- Parameter optimization +- Entry/exit logic variations +- Risk management approaches +- Time window configurations +- Instrument-specific adaptations + +## Usage Notes + +⚠️ **Important**: These are experimental/alternative strategies. Always: +1. Test thoroughly on demo accounts +2. Compare performance with frontline strategies +3. Understand the differences before deployment +4. Monitor closely if used in live trading + +## Performance Images + +All strategies include `test-balance.png` or `test-balance.jpg` files showing: +- Equity curve over time +- Drawdown periods +- Trade distribution +- Performance metrics + +## Related Directories + +- **`../frontline/`**: Production-ready strategies (recommended for live trading) +- **`../ai/`**: Machine learning-based strategies +- **`../backtesting/`**: Backtesting frameworks + +## Disclaimer + +These strategies are provided for research and educational purposes. Past performance does not guarantee future results. Always use appropriate risk management and test thoroughly before live trading. + +--- + +**Last Updated**: 2025-01-05 diff --git a/frontline/README.md b/frontline/README.md new file mode 100644 index 0000000..a0380f8 --- /dev/null +++ b/frontline/README.md @@ -0,0 +1,268 @@ +# Frontline Trading Strategies + +This directory contains production-ready Expert Advisors (EAs) for MetaTrader 5, organized by strategy type and trading instrument. + +## Directory Structure + +``` +frontline/ +├── MQL5/ # MetaTrader 5 Expert Advisors +│ ├── RSIScalpingXAUUSD/ # RSI Scalping for Gold +│ ├── RSIScalpingBTCUSD/ # RSI Scalping for Bitcoin +│ ├── RSIScalpingMSFT/ # RSI Scalping for Microsoft +│ ├── RSIScalpingTSLA/ # RSI Scalping for Tesla +│ ├── RSICrossOverReversalXAUUSD/ # RSI Crossover Reversal for Gold +│ ├── RSIMidPointHijackXAUUSD/ # RSI MidPoint Multi-Strategy for Gold +│ ├── EMASlopeDistanceCocktailXAUUSD/ # EMA Slope Distance Strategy +│ └── DarvasBoxXAUUSD/ # Darvas Box Breakout Strategy +└── tradingview/ # TradingView Pine Script strategies + └── SSEEMARSICocktail/ # Multi-indicator cocktail strategy +``` + +## Available Strategies + +### RSI Scalping Strategies + +Fast-paced scalping strategies using RSI (Relative Strength Index) for quick entries and exits. + +#### 1. RSIScalpingXAUUSD +- **Instrument**: Gold (XAU/USD) +- **Timeframe**: H1 +- **Strategy**: RSI-based scalping with dynamic entry/exit +- **Key Parameters**: + - RSI Period: 14 + - Overbought: 71 + - Oversold: 57 + - Buy Target: 80 + - Sell Target: 57 + - Bars to Wait: 4 + +**Performance Report:** +![RSI Scalping XAUUSD Report](MQL5/RSIScalpingXAUUSD/report.png) + +#### 2. RSIScalpingBTCUSD +- **Instrument**: Bitcoin (BTC/USD) +- **Timeframe**: H1 +- **Strategy**: RSI scalping optimized for cryptocurrency volatility + +**Performance Report:** +![RSI Scalping BTCUSD Report](MQL5/RSIScalpingBTCUSD/report.png) + +#### 3. RSIScalpingMSFT +- **Instrument**: Microsoft Stock (MSFT) +- **Timeframe**: H1 +- **Strategy**: RSI scalping for stock trading + +**Performance Report:** +![RSI Scalping MSFT Report](MQL5/RSIScalpingMSFT/report.png) + +#### 4. RSIScalpingTSLA +- **Instrument**: Tesla Stock (TSLA) +- **Timeframe**: H1 +- **Strategy**: RSI scalping for high-volatility stocks + +**Performance Report:** +![RSI Scalping TSLA Report](MQL5/RSIScalpingTSLA/report.png) + +### Advanced Gold Strategies + +#### 5. RSICrossOverReversalXAUUSD +- **Instrument**: Gold (XAU/USD) +- **Timeframe**: M12 (12-minute bars) +- **Strategy**: RSI crossover combined with EMA trend confirmation +- **Key Features**: + - RSI crossover signals (period: 19) + - EMA trend confirmation (period: 140) + - Trailing stop (295 points) + - Time-based trading windows + - Day-of-week filtering + +**Performance Report:** +![RSI CrossOver Reversal XAUUSD Report](MQL5/RSICrossOverReversalXAUUSD/report.png) + +**Core Parameters:** +```mql5 +rsiPeriod = 19; +overboughtLevel = 93; +oversoldLevel = 22; +emaPeriod = 140; +emaSlopeThreshold = 105; +emaDistanceThreshold = 165; +TrailingStop = 295; +``` + +#### 6. RSIMidPointHijackXAUUSD +- **Instrument**: Gold (XAU/USD) +- **Timeframe**: H1 +- **Strategy**: Multi-strategy system combining three approaches + - **RSI Follow Strategy**: Trend following (23:00-08:00 UTC) + - **RSI Reverse Strategy**: Mean reversion (07:00-13:00 UTC) + - **EMA Cross Strategy**: Breakout trading (08:00-14:00 UTC) +- **Key Features**: + - Strategy coordination and locking + - Cooldown periods after losses + - Independent time windows for each strategy + +**Performance Report:** +![RSI MidPoint Hijack XAUUSD Report](MQL5/RSIMidPointHijackXAUUSD/report.png) + +**Core Parameters:** +```mql5 +// RSI Follow +InpRSIPeriod = 32; +InpRSIOverbought = 78; +InpRSIOversold = 46; + +// RSI Reverse +InpRSIReversePeriod = 59; +InpRSIReverseOverbought = 51; +InpRSIReverseOversold = 49; + +// EMA Cross +InpEMAPeriod = 120; +InpEMADistancePips = 160.0; +``` + +#### 7. EMASlopeDistanceCocktailXAUUSD +- **Instrument**: Gold (XAU/USD) +- **Timeframe**: H1 +- **Strategy**: Advanced EMA-based strategy with slope and distance analysis +- **Key Features**: + - EMA slope analysis for trend strength + - Price distance from EMA for entry signals + - Sophisticated scoring system + - Dynamic ATR-based stop loss/take profit + - Maximum drawdown protection + +**Performance Report:** +![EMA Slope Distance Cocktail XAUUSD Report](MQL5/EMASlopeDistanceCocktailXAUUSD/report.png) + +**Performance Metrics:** +- Yearly Return: 28% +- Profit Factor: 1.222 +- Recovery Factor: 7.17 +- Sharpe Ratio: 4.11 +- Maximum Drawdown: 14.00% +- Win Rate: 64.65% +- Total Trades: 2,863 + +**Core Parameters:** +```mql5 +emaPeriod = 64; +slopeThreshold = 82; +distanceThreshold = 17.5; +atrMultiplier = 7.6; +TrailingStop = 335; +scoreThreshold = 5200; +``` + +#### 8. DarvasBoxXAUUSD +- **Instrument**: Gold (XAU/USD) +- **Timeframe**: H2 (trend), Current (trading) +- **Strategy**: Darvas Box breakout strategy +- **Key Features**: + - Identifies consolidation boxes + - Trades breakouts with volume confirmation + - Multiple timeframe trend analysis + - Dynamic box sizing based on volatility + +**Performance Report:** +![Darvas Box XAUUSD Report](MQL5/DarvasBoxXAUUSD/report.png) + +**Core Parameters:** +```mql5 +BoxPeriod = 165; +BoxDeviation = 25140; +VolumeThreshold = 938; +StopLoss = 1665; +TakeProfit = 3685; +MA_Period = 125; +``` + +## TradingView Strategies + +### SSEEMARSICocktail +- **Platform**: TradingView +- **Language**: Pine Script +- **Strategy**: Multi-indicator cocktail combining: + - SSE (Smoothed Stochastic Exponential) + - EMA (Exponential Moving Average) + - RSI (Relative Strength Index) +- **Files**: + - `main.pine`: Basic version + - `main_enhanced.pine`: Enhanced version with additional features + - `README.md`: Detailed documentation + +## Performance Reports + +All strategies include comprehensive HTML backtest reports (`report.html`) and visual performance charts (`report.png`) showing: + +- **Equity Curve**: Account balance over time +- **Drawdown Analysis**: Maximum drawdown periods +- **Trade Statistics**: Win rate, profit factor, average win/loss +- **Monthly Performance**: Month-by-month returns +- **Trade Distribution**: Profit/loss distribution + +## Usage + +### Installing EAs + +1. Copy the EA file (`main.mq5`) to your MT5 `MQL5/Experts/` directory +2. Compile the EA in MetaEditor (F7) +3. Attach to chart and configure parameters +4. Enable AutoTrading in MT5 + +### Recommended Settings + +- **Account Type**: ECN or similar with tight spreads +- **Minimum Balance**: Varies by strategy (see individual EA documentation) +- **VPS Recommended**: For 24/7 operation +- **Risk Management**: Always use appropriate lot sizes and risk limits + +## Risk Management + +All strategies implement: +- ✅ Stop Loss protection +- ✅ Take Profit targets +- ✅ Position sizing controls +- ✅ Spread filtering +- ✅ Maximum drawdown limits +- ✅ Time-based trading windows + +## Backtesting + +Each strategy has been thoroughly backtested on historical data. Results are available in: +- `report.html`: Detailed HTML report with full statistics +- `report.png`: Visual performance charts + +**Important**: Past performance does not guarantee future results. Always test on demo accounts before live trading. + +## Related Projects + +- **`../ai/`**: ONNX machine learning models for price prediction +- **`../back-pedal/`**: Alternative strategy implementations and testing +- **`../backtesting/`**: Python backtesting framework for strategy development + +## Disclaimer + +Trading involves substantial risk of loss. These Expert Advisors are provided for educational and research purposes. Always: + +1. Test thoroughly on demo accounts +2. Understand the strategy logic before use +3. Use appropriate risk management +4. Monitor performance regularly +5. Never risk more than you can afford to lose + +Past performance does not guarantee future results. Market conditions change, and strategies may need adjustment over time. + +## Support + +For questions or issues: +- Review the individual EA code comments +- Check the HTML backtest reports for performance details +- Test on demo accounts first +- Adjust parameters based on your risk tolerance + +--- + +**Last Updated**: 2025-01-05