OPEN-SOURCE SCRIPT

Vasyl Ivanov | Previous Day Liquidity + Swings

739
Previous Day Liquidity + Swings is an intraday market-structure indicator that displays the previous completed day’s range together with the nearest preceding external swing levels.

The indicator is designed to make four reference levels immediately visible:

• Previous Day High — gray horizontal line
• Previous Day Low — gray horizontal line
• Previous Higher Swing — white horizontal line
• Previous Lower Swing — white horizontal line

It also marks the beginning and end of the previous completed day with two gray vertical lines.

HOW IT WORKS

Previous Day High and Low

The indicator tracks the high and low of each completed trading day using the intraday bars available on the chart.

When a new day begins, the completed day’s high and low are fixed and displayed as gray horizontal lines. Each line starts from the bar where the corresponding extreme occurred and continues to the latest chart bar.

Previous Higher Swing

The indicator searches backward for the nearest confirmed swing high that:

• occurred before the previous day’s high;
• is strictly higher than the previous day’s high.

This level is displayed as a white horizontal line starting from the original swing bar and continuing to the latest chart bar.

Previous Lower Swing

The indicator searches backward for the nearest confirmed swing low that:

• occurred before the previous day’s low;
• is strictly lower than the previous day’s low.

This level is displayed as a white horizontal line starting from the original swing bar and continuing to the latest chart bar.

SWING CONFIRMATION

Swing points are identified using confirmed pivot highs and pivot lows.

The “Swing bars left/right” setting controls how many bars must appear on both sides of a price extreme for it to qualify as a confirmed swing.

For example, a value of 2 means that a swing requires two bars on its left and two closed bars on its right. Increasing this value produces fewer but more structurally significant swing levels. Decreasing it produces more frequent and more local levels.

Because a pivot needs bars on its right for confirmation, a new white level can appear several bars after the actual swing occurred. The line is anchored to the original swing bar.

ALERTS

The indicator provides separate alert conditions for:

• Previous Day High crossed
• Previous Day Low crossed
• Previous Swing High crossed
• Previous Swing Low crossed
• Any gray level crossed
• Any white level crossed
• Any indicator level crossed

The “Alert trigger” setting provides two detection modes:

Close crossing

A signal is generated when the closing price crosses a level. This mode filters out cases where price touches or briefly moves through a level but closes back on the original side.

For this mode, “Once Per Bar Close” is the recommended TradingView alert frequency.

Wick crossing

A signal is generated when the bar’s high or low reaches a level after the preceding bar remained entirely on the opposite side.

This mode detects intrabar liquidity touches and wick penetrations.

For this mode, “Once Per Bar” can be used when an immediate notification is required.

The “Show alert markers” setting controls the visual signal markers:

• A gray marker above a bar represents a gray-level crossing.
• A white marker below a bar represents a white-level crossing.

HOW TO CREATE AN ALERT

1. Add the indicator to an intraday chart.
2. Open TradingView’s “Create Alert” dialog.
3. Select “Vasyl Ivanov | Previous Day Liquidity + Swings” as the condition source.
4. Select the required individual or combined alert condition.
5. Choose the alert frequency appropriate for the selected trigger mode.
6. Configure the notification method and create the alert.

IMPORTANT: TradingView saves the script version, symbol, timeframe, and indicator settings when an alert is created. If any of these settings are changed later, delete the existing alert and create a new one.

USAGE

The levels can be used as objective references for:

• previous-day liquidity;
• prior range interaction;
• breaks and reclaims of the previous day’s extremes;
• external swing liquidity;
• intraday target mapping;
• market-structure analysis.

The indicator does not generate long or short trade recommendations. Its signals only report that price has crossed one of the displayed reference levels.

LIMITATIONS

• The indicator is intended for intraday timeframes.
• Daily boundaries follow the trading day and session data supplied by TradingView for the selected symbol.
• Results can differ between symbols with different exchange sessions or extended-hours settings.
• White levels depend on the selected “Swing bars left/right” value.
• A white level is displayed only when a qualifying confirmed swing exists in the loaded chart history.
• Alerts trigger only on real-time bars.
• Use standard candlestick or bar charts for price-based alerts. Synthetic chart types can produce signals based on synthetic OHLC values.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.