Skip to content

katxarra/claudestuff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

ICT/SMC Expert Advisor for MetaTrader 5

Overview

This Expert Advisor (EA) implements Smart Money Concepts (SMC) and Inner Circle Trader (ICT) strategies specifically optimized for prop firm challenges like FTMO, MyForexFunds, and others.

Key Features

  • Fair Value Gap (FVG) Detection: Automatically identifies price imbalances where institutions are likely to re-enter
  • Order Block (OB) Identification: Detects institutional order zones for high-probability entries
  • Liquidity Sweep Detection: Identifies stop hunts before major price reversals
  • Market Structure Analysis: Tracks bullish/bearish structure (Higher Highs/Lower Lows)
  • FTMO-Compliant Risk Management: Built-in daily loss limits, max drawdown protection, and trade limits
  • Automated Position Sizing: Calculates lot size based on risk percentage
  • Trailing Stop: Protects profits as trades move in your favor

Installation

  1. Download the EA: Save ICT_SMC_EA.mq5 to your computer

  2. Open MetaTrader 5

  3. Navigate to Data Folder:

    • Click FileOpen Data Folder
    • Go to MQL5Experts
  4. Copy the EA: Place ICT_SMC_EA.mq5 in the Experts folder

  5. Compile:

    • Open MetaEditor (F4 in MT5)
    • Open ICT_SMC_EA.mq5
    • Click Compile (F7)
    • Fix any errors if they appear
  6. Attach to Chart:

    • In MT5, drag the EA from Navigator onto your chart
    • Click "Allow Algo Trading" when prompted
    • Configure settings (see below)

Strategy Logic

1. Fair Value Gap (FVG)

A Fair Value Gap occurs when price moves so quickly that it creates an imbalance:

Bullish FVG: Candle 3's low > Candle 1's high (gap up)
Bearish FVG: Candle 3's high < Candle 1's low (gap down)

Trading Logic: Price tends to return to fill these gaps. The EA enters trades when price retraces into an FVG zone.

2. Order Blocks (OB)

Order blocks are the last opposite-colored candle before a strong price move:

Bullish OB: Last red candle before price rallies
Bearish OB: Last green candle before price drops

Trading Logic: These zones represent where institutions placed large orders. Price often reacts when returning to these levels.

3. Liquidity Sweeps

Institutions "hunt" stop losses before reversing:

Bullish Sweep: Price briefly drops below recent lows, then reverses up
Bearish Sweep: Price briefly rises above recent highs, then reverses down

Trading Logic: After a sweep, the EA looks for entries in the opposite direction.

4. Market Structure

The EA analyzes market structure to determine trend:

Bullish: Higher Highs + Higher Lows
Bearish: Lower Highs + Lower Lows

Trading Logic: Only takes trades aligned with current structure.

5. Entry Conditions

Long Trade Requirements:

  1. Bullish market structure detected
  2. Liquidity sweep to the downside
  3. Price retraces into bullish FVG or Order Block
  4. Risk limits not breached

Short Trade Requirements:

  1. Bearish market structure detected
  2. Liquidity sweep to the upside
  3. Price retraces into bearish FVG or Order Block
  4. Risk limits not breached

Configuration Settings

Risk Management (FTMO Compliance)

RiskPercent = 1.0          // Risk 1% per trade (recommended for FTMO)
MaxDailyLoss = 5.0         // Stop trading if daily loss reaches 5%
MaxTotalLoss = 10.0        // Stop trading if total loss reaches 10%
MaxTradesPerDay = 5        // Maximum 5 trades per day
UseTrailingStop = true     // Enable trailing stop for profit protection

FTMO Challenge Rules:

  • Phase 1: 10% profit target, 10% max loss, 5% daily loss limit
  • Phase 2: 5% profit target, same loss limits
  • Recommendation: Keep RiskPercent = 1.0 and MaxDailyLoss = 4.0 for safety buffer

ICT/SMC Settings

FVG_MinPoints = 10              // Minimum gap size to be considered valid
OrderBlock_Lookback = 50        // How many candles to scan for order blocks
LiquiditySweep_Lookback = 20    // Bars to check for swing highs/lows
LiquiditySweep_Buffer = 5       // Points beyond swing to confirm sweep

Optimization Tips:

  • Lower timeframes (M5-M15): Use smaller FVG_MinPoints (5-10)
  • Higher timeframes (H1-H4): Use larger FVG_MinPoints (15-30)

Trade Management

RiskRewardRatio = 2.0           // Minimum 1:2 risk-reward
TrailingStop_Points = 100       // Trail by 100 points (10 pips for 5-digit)
TrailingStop_Step = 10          // Move SL when profit increases by 10 points

Strategy Filters

TradeOnlyHigherTimeframe = true    // Use HTF for market structure
HTF_Timeframe = PERIOD_H4          // Higher timeframe (H4 recommended)
SpreadLimit = 20                   // Max spread in points (2 pips for 5-digit)
TradingStartTime = "00:00"         // Start trading at midnight
TradingEndTime = "23:59"           // Trade all day

Best Practice:

  • For scalping (M1-M5): Set HTF_Timeframe = PERIOD_M15 or PERIOD_H1
  • For swing trading (H1-H4): Set HTF_Timeframe = PERIOD_H4 or PERIOD_D1

Recommended Settings by Timeframe

M5 Chart (Scalping)

RiskPercent = 0.5
FVG_MinPoints = 5
OrderBlock_Lookback = 30
HTF_Timeframe = PERIOD_M15
RiskRewardRatio = 1.5

M15 Chart (Intraday)

RiskPercent = 1.0
FVG_MinPoints = 10
OrderBlock_Lookback = 50
HTF_Timeframe = PERIOD_H1
RiskRewardRatio = 2.0

H1 Chart (Swing)

RiskPercent = 1.5
FVG_MinPoints = 20
OrderBlock_Lookback = 100
HTF_Timeframe = PERIOD_H4
RiskRewardRatio = 3.0

Dashboard Information

The EA displays real-time information on your chart:

========== ICT/SMC EA ==========
Status: SCANNING
--------------------------------
Balance: 10000.00
Equity: 10150.00
Daily P/L: 150.00 (1.50%)
Trades Today: 2/5
--------------------------------
Market Structure: BULLISH
FVGs Detected: 3
Order Blocks: 5
Open Positions: 1
================================

Testing & Optimization

Backtesting

  1. Open Strategy Tester (Ctrl+R)
  2. Select ICT_SMC_EA.ex5
  3. Choose your symbol (e.g., EURUSD)
  4. Select timeframe (M15 or H1 recommended)
  5. Date range: At least 3-6 months of data
  6. Click Start

Important: Use "Every tick based on real ticks" for accurate results

Optimization

To find best settings for your pair/timeframe:

  1. In Strategy Tester, check Optimization
  2. Select parameters to optimize:
    • RiskPercent (0.5 to 2.0)
    • FVG_MinPoints (5 to 30)
    • RiskRewardRatio (1.5 to 3.0)
  3. Click Start
  4. Review results by Profit Factor and Max Drawdown

Risk Disclosure

Important Notes:

  1. Past Performance ≠ Future Results: Backtesting results do not guarantee future profitability
  2. Demo First: Always test thoroughly on demo account before live trading
  3. Prop Firm Rules: Ensure EA settings comply with your specific prop firm's rules
  4. Market Conditions: Strategy performance varies with market volatility and conditions
  5. Monitoring Required: Check EA regularly, especially during news events

Best Practices for FTMO

1. Conservative Risk

  • Use 0.5-1% risk per trade
  • Never exceed 3-4 trades per day
  • Stop trading after 2 consecutive losses

2. Optimal Timeframes

  • Best: M15 and H1 charts
  • Avoid: M1 (too much noise) and Daily (too slow)

3. Best Trading Sessions

  • London Session (08:00-12:00 GMT): High volatility, clear trends
  • New York Session (13:00-17:00 GMT): Good liquidity
  • Avoid: Asian session (low volatility, fake breakouts)

4. Best Currency Pairs

  • Major Pairs: EURUSD, GBPUSD, USDJPY (tight spreads, good liquidity)
  • Avoid: Exotic pairs (wide spreads, unpredictable moves)

5. News Awareness

  • Check economic calendar daily
  • Disable EA 30 minutes before high-impact news (NFP, FOMC, CPI)
  • Re-enable after price settles (30-60 minutes after)

Troubleshooting

EA Not Opening Trades

  1. Check Logs: View Experts tab for error messages
  2. Verify Settings: Ensure risk limits haven't been hit
  3. Spread Too High: Increase SpreadLimit parameter
  4. No Setup: ICT setups don't occur every day - be patient
  5. AutoTrading: Ensure "Algo Trading" button is enabled (green)

EA Losing Money

  1. Review Backtest: Test on 3-6 months of historical data
  2. Optimize Settings: Different pairs need different settings
  3. Market Conditions: Some periods don't suit this strategy
  4. Reduce Risk: Lower RiskPercent to 0.5%

Compilation Errors

  • Error: Undeclared identifier: Check MQL5 version (update MT5)
  • Error: Invalid parameters: Verify input values are within valid ranges

Support & Updates

For questions, issues, or suggestions:


Version History

v1.00 (2025-11-04)

  • Initial release
  • Fair Value Gap detection
  • Order Block identification
  • Liquidity sweep recognition
  • FTMO-compliant risk management
  • Trailing stop functionality
  • Real-time dashboard

License

This EA is provided for educational purposes. Use at your own risk. No guarantees of profitability.

Developed with ICT/SMC principles for prop firm traders

Good luck with your FTMO challenge!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages