Indicator · Pine Script v5 · On the chart

Liquidity Engulfing & Displacement [MsF]

by alvinng214· code credited to Trader_Morry

This indicator detects multi-timeframe Liquidity Engulfing Candles directly on the price chart.

View on GitHub

Repaints

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code89
Settings10inputs
LicenceNone statedfile: MPL-2.0
Last update2 months ago5 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

89 lines of Pine Script v5 from S1_Silver_Bullet/Liquidity Engulfing & Displacement [MsF].txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Liquidity Engulfing & Displacement [MsF].txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Trader_Morry

// This is an interesting take on a common engulfing candle pattern with 2 additional filter critera to ensure there is a liquidity play
// Idea came from AtaBankz based on trade setup 4H candles. Thanks mate!

//@version=5
indicator("Liquidity Engulfing & Displacement [MsF]", overlay=true)

/////////////////////////////////////////////////////////////////////////////////////////////////
// Liquidity Engulfing Candles - LEC
// --------------- INPUTS ---------------
var GRP1 = "LEC setting"
show_H1 = input(true, title='Show H1 LEC', group=GRP1)
show_H4 = input(false, title='Show H4 LEC', group=GRP1)
show_CUR = input(false, title='Show Current LEC', group=GRP1)
filter_liqudity = input.bool(true, "Apply Stop Hunt Wick Filter", tooltip="Require candle wick into prior candle retracement zone")
filter_close = input.bool(true, "Apply Close Filter", tooltip="Require LL/HH on candle in order to print a valid engulfing signal")

// --------------- function ---------------
drawing_lec() =>
    bull_engulf = false
    bear_engulf = false
    if barstate.isnew
        prior_open = open[1]
        prior_close = close[1]
        current_open = open
        current_close = close

        // identify "normal" engulfing candles
        bull_engulf := (current_open <= prior_close) and (current_open < prior_open) and (current_close > prior_open)
        bear_engulf := (current_open >= prior_close) and (current_open > prior_open) and (current_close < prior_open)

        // "stop hunt" logic
        if filter_liqudity
            bull_engulf := bull_engulf and low <= low[1]
            bear_engulf := bear_engulf and high >= high[1]

        // require LL/HH on the candle
        if filter_close
            bull_engulf := bull_engulf and close >= high[1]
            bear_engulf := bear_engulf and close <= low[1]
    [bull_engulf, bear_engulf]

// --------------- Main MTF ---------------
[bull_engulf_H1, bear_engulf_H1] = request.security(syminfo.tickerid, "60", drawing_lec())
[bull_engulf_H4, bear_engulf_H4] = request.security(syminfo.tickerid, "240", drawing_lec())
[bull_engulf_CUR, bear_engulf_CUR] = request.security(syminfo.tickerid, timeframe.period, drawing_lec())

// plots
bullcol = color.aqua
bearcol = color.red
plotshape(bull_engulf_H1 and not bull_engulf_H1[1] and show_H1, style=shape.triangleup, location=location.belowbar, color=bullcol, size=size.small)
plotshape(bear_engulf_H1 and not bear_engulf_H1[1] and show_H1, style=shape.triangledown , location=location.abovebar, color=bearcol, size=size.small)
plotshape(bull_engulf_H4 and not bull_engulf_H4[1] and show_H4, style=shape.triangleup, location=location.belowbar, color=bullcol, size=size.small)
plotshape(bear_engulf_H4 and not bear_engulf_H4[1] and show_H4, style=shape.triangledown , location=location.abovebar, color=bearcol, size=size.small)
plotshape(bull_engulf_CUR and not bull_engulf_CUR[1] and show_CUR, style=shape.triangleup, location=location.belowbar, color=bullcol, size=size.small)
plotshape(bear_engulf_CUR and not bear_engulf_CUR[1] and show_CUR, style=shape.triangledown , location=location.abovebar, color=bearcol, size=size.small)

// alarts
alertcondition(bull_engulf_H1,"H1 Bullish LEC detected","H1 Bullish LEC detected!!")
alertcondition(bear_engulf_H1,"H1 Bearish LEC detected","H1 Bearish LEC detected!!")
alertcondition(bull_engulf_H4,"H4 Bullish LEC detected","H4 Bullish LEC detected!!")
alertcondition(bear_engulf_H4,"H4 Bearish LEC detected","H4 Bearish LEC detected!!")
alertcondition(bull_engulf_CUR,"Bullish LEC detected","Bullish LEC detected!!")
alertcondition(bear_engulf_CUR,"Bearish LEC detected","Bearish LEC detected!!")

//
/////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////
// Displacement
// --------------- INPUTS ---------------
var GRP2 = "Displacement setting"
require_fvg = input.bool(true, "Require FVG", group = GRP2)
disp_type = input.string("Open to Close", "Displacement Type", options = ['Open to Close', 'High to Low'], group = GRP2)
std_len = input.int(100, minval = 1, title = "Displacement Length", tooltip = "How far back the script will look to determine the candle range standard deviation", group = GRP2)
std_x = input.int(2, minval = 0, title = "Displacement Strength", group = GRP2)
disp_color = input.color(color.yellow, "Bar Color", group = GRP2)

candle_range = disp_type == "Open to Close" ? math.abs(open - close) : high - low
std = ta.stdev(candle_range, std_len) * std_x
fvg = close[1] > open[1] ? high[2] < low[0] : low[2] > high[0]

displacement = require_fvg ? candle_range[1] > std[1] and fvg : candle_range > std

barcolor(displacement ? disp_color : na, offset = require_fvg ? -1 : na)
//
/////////////////////////////////////////////////////////////////////////////////////////////////

Overview

Liquidity Engulfing & Displacement [MsF] evaluates bullish and bearish engulfing patterns augmented by optional stop hunt wick filters and close breakout conditions across H1, H4, and current timeframes. Input settings allow traders to toggle specific timeframes, adjust displacement calculation parameters, and enforce liquidity wick filters. Bullish and bearish setups display as triangle markers above or below price bars. Because higher timeframe data is fetched via security queries without bar offsets, higher timeframe signals on incomplete bars may repaint.

Details

Published by

alvinng214 on GitHub

Code credit

Trader_Morry, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Candlestick patterns, SMC / ICT / price action

Markets

Any symbol

Timeframes

M15-H1, H4 and above

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Show H1 LECbooltrueshow_H1
Show H4 LECboolfalseshow_H4
Show Current LECboolfalseshow_CUR
Apply Stop Hunt Wick Filterbooltruefilter_liqudity
Apply Close Filterbooltruefilter_close
Require FVGbooltruerequire_fvg
Displacement TypestringOpen to Closedisp_type
Displacement Lengthint100std_len
Displacement Strengthint2std_x
Bar Colorcolorcolor.yellowdisp_color
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

575 stars

The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr

Indicator v6 SMC / ICT / price actionCandlestick patterns
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Displacement Candles Indicator

This Pine Script indicator identifies liquidity sweeps and confirms signals using a close-back candle pattern directly on the price chart. It tracks recent swing highs and lows over a customizable lookback period. A bullish signal forms when a prior bar sweeps

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · MPL-2.0 GitHub repository of Liquidity Sweep + Close-Back Confirmation

Confluence Suite

by TamaraKGreen
46 stars

The Confluence Suite indicator draws multiple trading signals and tools directly on the price chart. It generates entry and exit signals based on selected modes and filters, with an AI signal classifier rating quality from 1-4. Additional features include smar

Indicator v5 TrendSMC / ICT / price action
Updated 7 weeks ago · None stated GitHub repository of Confluence Suite

Fractal Reclaim Strength

by selimgrsoy0-commits
12 stars

The indicator tracks four-bar fractal sweep and reclaim setups on chart timeframes of 15 minutes and above. It calculates Reclaim Strength based on where C2 closes relative to C1's range and plots level lines for the swept C1 extreme and C2 extreme. An on-scre

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of Fractal Reclaim Strength

ICT HTF Candles (fadi)

by dbruce1990
12 stars

ICT HTF Candles displays higher timeframe candle structures directly on the price chart using customized boxes and lines. It tracks up to six user-defined higher timeframes, plotting historical body, wick, and imbalance zones alongside optional price level tra

Indicator v6 SMC / ICT / price actionCandlestick patterns
Updated 1 year ago · None stated GitHub repository of ICT HTF Candles (fadi)

This overlay indicator detects tweezer tops and bottoms and kangaroo-tail pin bars, then draws supply and demand zones from those patterns. It scores each zone, decays freshness, merges overlapping zones, and can invalidate a zone after a close-through or afte

Indicator v6 Candlestick patternsSupport & resistance
Updated yesterday · MIT GitHub repository of Tweezer & Kangaroo Zones [WavesUnchained]

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers