Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Indicators

PDH PDL Sweep Levels - indicator for MetaTrader 5

Cristhian Alexander Gaibor Cuasquer
Cristhian Alexander Gaibor Cuasquer
  • Founder & Systems Engineer at  Xander Pro
  • Ecuador
  • 8543
4.7 (44)
Trader and MQL5 member since 2017.
Views:
21
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

The previous day high and low on Gold (XAUUSD) are where the stops sit, and price often runs them and snaps back. This indicator draws the previous day high and low (PDH, PDL), the previous week high and low (PWH, PWL), today's open and this week's open, and puts an arrow on the candle that sweeps one of those levels.

A sweep counts only on a closed candle: the wick goes beyond the level and the close comes back inside. A poke through the low that closes above it gets a green arrow, a poke through the high that closes below it gets a red one. The forming candle never gets an arrow, so nothing appears and then disappears.

A sweep is a sign that stops were taken, not an entry by itself. Price can sweep, come back and keep going, so pair it with your own structure or confirmation.

PDH PDL Sweep Levels with the previous day high and low, the previous week high, the day open and two sweep arrows on a XAUUSD M15 chart in MetaTrader 5

Settings

  • Previous day high and low, previous week high and low and today open and this week open: each can be turned on or off. All on by default.
  • Bars the lines extend to the right: default 10. Colours for day, week and opens, and text labels with the price.
  • Mark sweeps of the day levels and of the week levels: both on.
  • Minimum poke beyond the level, in points: default 0. Raise it to ignore wicks of one or two points.
  • Alerts: popup, push and sound, all off by default. They fire once, on the candle that just closed.

What it needs

Any symbol, any timeframe below D1. Day and week are the broker server day and week, read from the D1 and W1 history, so the levels match the daily candle of your broker. If that history is not loaded yet the indicator waits and fills in when it arrives. Lines and labels are standard chart objects, the arrows are two indicator buffers, and it never trades. Push notifications need your MetaQuotes ID in the terminal options.

Make it yours

Run it on XAUUSD, XAGUSD, EURUSD, GBPUSD, US30 or NAS100 and compare how often the London or New York session sweeps the PDH or PDL on M5 and M15. From an EA you can read it with iCustom: buffers 0 to 3 are PDH, PDL, PWH and PWL for every bar, buffer 4 the sweep of a low and buffer 5 the sweep of a high. It is a natural trigger next to Smart Money Concepts structure: wait for the sweep, then for the change of character. XP_Prev and the sweep check inside OnCalculate are short and easy to reuse.

About this code

Open source. Use it as it is, adapt it, build your own version on top of it. New versions and new tools are announced first on my MQL5 channel: https://www.mql5.com/en/channels/xander. Questions, suggestions and your own backtests are welcome in the Xander Lab group: https://www.mql5.com/en/messages/02eec85e4364dd01. More tools on my profile: https://www.mql5.com/en/users/09151993a. Provided as is, use at your own risk.

Related: Liquidity Sweep Equal Highs Lows, Smart Money Concepts BOS CHoCH, Forex Session Boxes, Opening Range Breakout Box.

Changelog

v1.0 (2026-11-20): initial release.

Daily Loss and Profit Lock Daily Loss and Profit Lock

Daily loss limit EA for MT5 on prop firm and funded accounts, Gold (XAUUSD), forex and indices: closes every position at the daily loss or profit limit, deletes pending orders and locks trading until the next day. Open source code.

Premium Discount OTE Zones Premium Discount OTE Zones

Premium and discount zones for MT5 on Gold (XAUUSD), forex and indices: dealing range from confirmed swings, equilibrium 50 percent, 25 and 75 percent lines and the OTE band of the last leg. Open source code.

News Straddle EA Economic Calendar News Straddle EA Economic Calendar

News trading EA for Gold (XAUUSD) and forex: places a Buy Stop and a Sell Stop seconds before each release of the MT5 economic calendar, one cancels the other, stop loss, take profit and trailing in points. Open source code.

MACD Signals MACD Signals

Indicator edition for new platform.