OPEN-SOURCE SCRIPT
PDH/PDL Sweep & Rejection - sudo

PDH/PDL Sweep + Rejection
This indicator identifies classic liquidity sweeps of the previous day's high or low, then confirms whether price rejected that level with force. It is built to highlight moments when the market takes liquidity and immediately snaps back in the opposite direction, a behavior often linked to failed breakouts, engineered stops, or clean reversals. The tool marks these events directly on the chart so you can see them without manually watching the daily levels.
What it detects
The indicator focuses on two events:
PDH sweep and rejection
Price breaks above the previous day's high, overshoots the level by a meaningful amount, and then closes back below the high.
PDL sweep and rejection
Price breaks below the previous day's low, overshoots, and then closes back above the low.
These are structural liquidity events, not random wicks. The script checks for enough overshoot and strong bar range to confirm it was a genuine stop grab rather than noise.
How it works
The indicator evaluates each bar using the following logic:
1. Previous day levels
It pulls yesterday's high and low directly from the daily timeframe. These act as the PDH and PDL reference points for intraday trading.
2. Overshoot measurement
After breaking the level, price must push far enough beyond it to qualify as a sweep. Instead of using arbitrary pips, the required overshoot is scaled relative to ATR. This keeps the logic stable across different assets and volatility conditions.
3. Range confirmation
The bar must be larger than normal compared to ATR. This ensures the sweep happened with momentum and not because of small, choppy price movement.
4. Rejection close
A valid signal only prints if price closes back inside the previous day's range.
For a PDH sweep, the bar must close below PDH.
For a PDL sweep, the bar must close above PDL.
This confirms a failed breakout and a rejection.
What gets placed on the chart
Red downward triangle above the bar: Previous Day High sweep and rejection
Lime upward triangle below the bar: Previous Day Low sweep and rejection
The markers appear exactly on the bar where the sweep and rejection occurred.
How traders can use this
Identify potential reversals
Sweeps often occur when algorithms target liquidity pools. When followed by a strong rejection, the market may be preparing for a reversal or rotation.
Avoid chasing breakouts
A clear sweep warns that a breakout attempt failed. This can prevent traders from entering at the worst possible location.
Time entries at extremes
The markers help you see where the market grabbed stops and immediately turned. These areas can become high quality entry zones in both trend continuation and countertrend setups.
Support liquidity based models
The indicator aligns naturally with trading frameworks that consider liquidity, displacement, failed breaks, and microstructure shifts.
Add confidence to confluence-based setups
Combine sweeps with displacement, FVGs, or higher timeframe levels to refine entry timing.
Why this indicator is helpful
It automates a pattern that traders often identify manually. Sweeps are easy to miss in fast markets, and this tool eliminates the need to constantly monitor daily levels. By marking only the events that show overshoot plus rejection plus significant range, it filters out the weak or false signals and leaves only meaningful liquidity events.
This indicator identifies classic liquidity sweeps of the previous day's high or low, then confirms whether price rejected that level with force. It is built to highlight moments when the market takes liquidity and immediately snaps back in the opposite direction, a behavior often linked to failed breakouts, engineered stops, or clean reversals. The tool marks these events directly on the chart so you can see them without manually watching the daily levels.
What it detects
The indicator focuses on two events:
PDH sweep and rejection
Price breaks above the previous day's high, overshoots the level by a meaningful amount, and then closes back below the high.
PDL sweep and rejection
Price breaks below the previous day's low, overshoots, and then closes back above the low.
These are structural liquidity events, not random wicks. The script checks for enough overshoot and strong bar range to confirm it was a genuine stop grab rather than noise.
How it works
The indicator evaluates each bar using the following logic:
1. Previous day levels
It pulls yesterday's high and low directly from the daily timeframe. These act as the PDH and PDL reference points for intraday trading.
2. Overshoot measurement
After breaking the level, price must push far enough beyond it to qualify as a sweep. Instead of using arbitrary pips, the required overshoot is scaled relative to ATR. This keeps the logic stable across different assets and volatility conditions.
3. Range confirmation
The bar must be larger than normal compared to ATR. This ensures the sweep happened with momentum and not because of small, choppy price movement.
4. Rejection close
A valid signal only prints if price closes back inside the previous day's range.
For a PDH sweep, the bar must close below PDH.
For a PDL sweep, the bar must close above PDL.
This confirms a failed breakout and a rejection.
What gets placed on the chart
Red downward triangle above the bar: Previous Day High sweep and rejection
Lime upward triangle below the bar: Previous Day Low sweep and rejection
The markers appear exactly on the bar where the sweep and rejection occurred.
How traders can use this
Identify potential reversals
Sweeps often occur when algorithms target liquidity pools. When followed by a strong rejection, the market may be preparing for a reversal or rotation.
Avoid chasing breakouts
A clear sweep warns that a breakout attempt failed. This can prevent traders from entering at the worst possible location.
Time entries at extremes
The markers help you see where the market grabbed stops and immediately turned. These areas can become high quality entry zones in both trend continuation and countertrend setups.
Support liquidity based models
The indicator aligns naturally with trading frameworks that consider liquidity, displacement, failed breaks, and microstructure shifts.
Add confidence to confluence-based setups
Combine sweeps with displacement, FVGs, or higher timeframe levels to refine entry timing.
Why this indicator is helpful
It automates a pattern that traders often identify manually. Sweeps are easy to miss in fast markets, and this tool eliminates the need to constantly monitor daily levels. By marking only the events that show overshoot plus rejection plus significant range, it filters out the weak or false signals and leaves only meaningful liquidity events.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。