Skip to content

ausjones84/forex-trading-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ForexBot Pro - Advanced AI Trading Bot

⚠️ DISCLAIMER: This software is for educational purposes only. Forex trading involves substantial risk of loss. Always start with paper trading. Never risk money you cannot afford to lose. Past performance does not guarantee future results.

An advanced, autonomous Forex trading bot combining 6 professional strategies inspired by the world's best traders, with a full web dashboard, risk management engine, and support for MetaTrader 5 and OANDA.

🏆 Strategies Implemented

The bot combines signals from 6 strategies using weighted consensus voting. At least 2 strategies must agree before a trade is entered.

Strategy Inspired By Weight Description
ICT Smart Money Concepts Inner Circle Trader 3.0x Order Blocks, FVGs, BOS/CHoCH, Liquidity Sweeps
EMA Trend Following Paul Tudor Jones, Stanley Druckenmiller 2.5x EMA 8/21/50/200 crossovers + RSI filter
S/R Breakout George Soros 2.5x Key level breaks with volume confirmation
SuperTrend ML xPOURY4/ML-SuperTrend-MT5 2.0x ATR-based SuperTrend with ML filtering
MACD Divergence Professional standard 1.5x MACD signal line cross + divergence
Bollinger Bands Mean Reversion Professional standard 1.5x BB + RSI oversold/overbought

🌟 Key Features

  • Fully Autonomous - Runs 24/7, analyzing 8 currency pairs automatically
    • Multi-Strategy Consensus - Only trades when 2+ strategies agree (reduces false signals)
      • Professional Risk Management - Kelly Criterion sizing, trailing stops, drawdown limits
        • Multi-Timeframe Analysis - H4 trend filter + H1 signal generation

1. Clone & Install

git clone https://github.com/ausjones84/forex-trading-bot.git
cd forex-trading-bot
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

2. Configure

cp .env.example .env
# Edit .env with your settings

3. Start in Paper Trading Mode (Recommended First!)

# .env: BROKER_MODE=paper
python app.py

4. Open Dashboard

Navigate to http://localhost:5000 in your browser.

5. Connect Real Broker (Optional)

MetaTrader 5:

BROKER_MODE=mt5
MT5_LOGIN=your_account_number
MT5_PASSWORD=your_password
MT5_SERVER=YourBroker-Demo

OANDA (Demo):

BROKER_MODE=oanda
OANDA_API_KEY=your_api_key
OANDA_ACCOUNT_ID=your_account_id
OANDA_ENVIRONMENT=practice

📁 Project Structure

forex-trading-bot/
├── app.py                    # Flask web server + REST API
├── requirements.txt          # Python dependencies
├── .env.example              # Configuration template
├── bot/
│   ├── strategies.py         # All 6 trading strategies
│   ├── risk_manager.py       # Risk management engine
│   └── bot_engine.py         # Main trading loop + broker connectors
└── templates/
    └── index.html            # Web dashboard UI

⚙️ Risk Management

The bot enforces strict risk rules that top professional traders use:

  • Max 1-2% risk per trade (Bill Lipschutz rule)
    • Daily loss limit (5% default) - bot stops if hit
      • Max drawdown limit (15% default) - bot stops if hit
        • Minimum 2:1 R:R ratio before entering any trade
          • ATR-based trailing stops - automatically move to lock in profits
            • Max 5 simultaneous open trades
              • Position sizing via Kelly Criterion + fixed fractional method
                • H4 trend filter - never trade against the higher timeframe trend

                • 🎯 Strategy Detail

                • ICT Smart Money Concepts

                • The highest-weighted strategy. Identifies where institutional (smart money) traders are positioned by detecting:

                  • Fair Value Gaps (FVG) - Price imbalances that often get filled
  • Order Blocks (OB) - Areas where large institutional orders cluster
    • Break of Structure (BOS) - Trend continuation signals
      • Change of Character (CHoCH) - Early trend reversal signals

      • EMA Trend Following

      • Classic trend following used by momentum traders:

        • EMA 8/21 crossover for entry trigger
          • EMA 50/200 for trend direction filter
            • RSI 50 zone for momentum confirmation

            • World's Best Forex Traders & Their Strategies

            • | Trader | Strategy | Key Principle |

            • |--------|----------|---------------|

            • | George Soros | Reflexivity + Macro | Trade when market narratives are wrong; bet big | | Bill Lipschutz | Risk/Reward Asymmetry | Maximize R:R; cut losers instantly | | Stanley Druckenmiller | Momentum + Macro | Concentrate on best ideas; ride trends hard | | Paul Tudor Jones | Breakout + Elliott Wave | Trade breakouts; strict risk management | | ICT (Michael Huddleston) | Smart Money Concepts | Follow institutional order flow |

📊 Dashboard Features

  • Real-time P&L chart with cumulative equity curve
    • Live open positions with entry price, SL, and TP
      • Trade history with per-trade P&L
        • Strategy breakdown bar chart
          • Risk settings - adjustable in real-time without restarting
            • Win rate, profit factor, best/worst trade stats
              • WebSocket for live updates every 5 seconds

              • ⚠️ Important Notes

                1. Always start with paper trading until you understand the bot's behavior
                  1. Use a demo account when connecting to a real broker for the first time
                    1. Monitor the bot - do not leave it running completely unattended at first
                      1. Forex is risky - even the best strategies can have losing periods
                        1. This bot does NOT guarantee profits - it implements strategies that have historically worked, but past performance doesn't predict future results

                        2. 📜 License

                        3. MIT License - see LICENSE for details.


Built with ❤️ using Python, Flask, and the best open-source trading libraries.

About

Advanced AI-powered Forex trading bot with ICT Smart Money Concepts, multi-strategy engine, backtesting, and web dashboard. Features automated trading via MetaTrader5 & OANDA API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors