Skip to content

savilla17/Liquidity_grab

Repository files navigation

πŸ€– XAUUSD-Zones-Trading-MT5

MetaTrader 5 Expert Advisor for Supply & Demand Zone Trading on XAUUSD (Gold) with configurable risk management, time/day filters, auto SL/TP placement, and trade logging.

⚠️ DISCLAIMER: This EA is for EDUCATIONAL PURPOSES ONLY. Trading forex/CFDs involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results.


🌟 Features

Core Algorithm

  • πŸ“₯ Demand Zones: Formed after bullish streaks (β‰₯5 green candles).
  • πŸ“€ Supply Zones: Formed after bearish streaks (β‰₯5 red candles).
  • πŸ• Zone Expiry: Old zones automatically removed after configurable bars.
  • πŸ“Š Automatic SL/TP: Stop-loss at zone edge, take-profit at 3Γ— SL distance.

Risk Management

  • πŸ’° Fixed Lot Sizing (configurable).
  • πŸ›‘οΈ Minimum SL Buffer: Avoids trades with too-tight stop losses.
  • ⚑ One Trade per Zone: Prevents overtrading the same zone.

Trading Filters

  • πŸ• Session Management: Trade only within specified hours.
  • πŸ“… Day Filters: Enable/disable trading for each weekday.
  • ⏳ Zone Retest Expiry: Avoids trading expired retests.

Monitoring & Logging

  • πŸ“ˆ Zone Visualization: Supply (red) & Demand (blue) zones on chart.
  • πŸ”– SL/TP Markers: Lines drawn for each executed trade.
  • πŸ“ CSV Logging: Trades recorded in TradeLog.csv with time, type, price, SL, TP, and lots.

πŸ“‹ Table of Contents


πŸš€ Installation

Prerequisites

  • MetaTrader 5 Terminal (build 2000+ recommended)
  • Active demo or live account
  • Windows, macOS, or Linux with MT5

Steps

  1. Copy XAUUSD_Zones_Trading.mq5 into:

    MQL5/Experts/
    
  2. Open MetaEditor and compile the file.

  3. Attach the EA to a XAUUSD M5 chart in MT5.

  4. Enable Algo Trading βœ….


⚑ Quick Start

  1. Open XAUUSD M5 chart.
  2. Attach XAUUSD_Zones_Trading EA.
  3. Adjust input parameters if needed.
  4. Watch zones and trades execute automatically.

βš™οΈ Configuration

Basic Parameters

Parameter Default Description
Lots 0.25 Fixed lot size per trade
ZoneWidthLimit 25 Maximum width (points) of valid zone
ZoneSpacingBars 70 Minimum spacing between zones
ZoneHistory 300 Number of candles scanned for streaks
EntryBuffer 1.5 Buffer (points) before entering a trade
ZoneRetestExpiryBars 50 Bars before a zone expires
MinSLBufferPips 1.0 Minimum SL distance in pips

Time & Day Filters

Parameter Default Description
StartHour 9 Start trading hour (broker time)
EndHour 18 End trading hour (exclusive)
TradeMonday true Trade on Monday?
TradeFriday true Trade on Friday?
TradeSunday false Trade on Sunday?

πŸ—οΈ Architecture

XAUUSD_Zones_Trading.mq5
β”‚
β”œβ”€β”€ Zone Detection
β”‚   β”œβ”€β”€ Bullish/Bearish streak identification
β”‚   └── Supply/Demand zone creation
β”‚
β”œβ”€β”€ Trade Execution
β”‚   β”œβ”€β”€ Buy/Sell entries with SL/TP
β”‚   β”œβ”€β”€ Risk filter (min SL buffer)
β”‚   └── One-trade-per-zone enforcement
β”‚
β”œβ”€β”€ Visualization
β”‚   β”œβ”€β”€ Rectangle zones on chart
β”‚   β”œβ”€β”€ SL/TP lines
β”‚
β”œβ”€β”€ Logging
β”‚   └── TradeLog.csv (time, type, price, SL, TP, lots)

πŸ“Š Usage Examples

Example 1: Default Settings

  • Attach EA to XAUUSD M5.
  • Zones auto-detected, trades executed with default parameters.

Example 2: Restrict to London Session

  • Set StartHour=8, EndHour=16.
  • EA trades only during London trading hours.

Example 3: Conservative Setup

  • Use Lots=0.1, MinSLBufferPips=3.0.
  • Filters out small zones, safer trading.

πŸ“ˆ Performance Notes

  • Optimized for XAUUSD on M5 timeframe.
  • Risk/Reward ratio = 1:3 (configurable via code).
  • Performance varies by broker, spread, and market conditions.
  • Backtest before running live.

πŸ› οΈ Troubleshooting

Issue Possible Fix
EA not trading Check if Algo Trading is enabled
Zones not drawing Ensure chart has enough history (ZoneHistory β‰₯ 300)
Trade skipped SL distance below MinSLBufferPips
CSV not generated Check MQL5/Files/TradeLog.csv permissions

🀝 Contributing

We welcome improvements!

  • Fork the repo
  • Create a feature branch (git checkout -b feature/NewFeature)
  • Commit changes (git commit -m "Add NewFeature")
  • Push branch (git push origin feature/NewFeature)
  • Open a Pull Request

πŸ“œ License

This project is licensed under the MIT License – see the LICENSE file for details.


πŸ™ Acknowledgments

  • Supply & Demand trading methodology
  • MetaTrader 5 API (MetaQuotes)
  • Community contributions & testing

πŸ“Š Strategy Results

πŸ”™ Backtest

Backtest Result

πŸ”œ Forward Test

Forward Test

πŸ“ž Contact

Email: Savilla171@gmail.com Linkedin: www.linkedin.com/in/sarano-tikhak

About

A Grab and Buy of Liquidity when it is at the Low and Sell of the Liquidity when it is at High

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages