OPEN-SOURCE SCRIPT
Lucy โ 3-Bar Reversal with EMA50 Trend Filter

๐ Lucy โ 3-Bar Reversal with EMA50 Trend Filter
Purpose:
To detect and highlight bullish and bearish 3-bar reversal patterns on the chart, but only when they align with the dominant trend, defined by the EMA 50.
โ How It Works
๐ข Bullish 3-Bar Reversal (Buy Setup):
Bar 1 is bearish (close < open)
Bar 2 makes a lower low than Bar 1
Bar 3 is bullish (close > open) and closes above Bar 2โs high
Price must be above EMA 50 (trend filter)
โ Result: Shows a green triangle below the bar
๐ด Bearish 3-Bar Reversal (Sell Setup):
Bar 1 is bullish (close > open)
Bar 2 makes a higher high than Bar 1
Bar 3 is bearish (close < open) and closes below Bar 2โs low
Price must be below EMA 50
โ Result: Shows a red triangle above the bar
๐ What It Plots:
๐ผ Green triangle below bullish signal bar
๐ฝ Red triangle above bearish signal bar
๐ Orange line = EMA50 (trend filter)
๐ Built-in Alerts:
Youโll get an alert if:
A bullish reversal pattern forms above EMA50
A bearish reversal pattern forms below EMA50
๐ง Use Cases:
Great for trend-following traders who want clean, price-action entries
Works well on intraday (15m/1h) or swing (4h/daily) timeframes
Can be used for manual entries, or converted to strategy for automation
Purpose:
To detect and highlight bullish and bearish 3-bar reversal patterns on the chart, but only when they align with the dominant trend, defined by the EMA 50.
โ How It Works
๐ข Bullish 3-Bar Reversal (Buy Setup):
Bar 1 is bearish (close < open)
Bar 2 makes a lower low than Bar 1
Bar 3 is bullish (close > open) and closes above Bar 2โs high
Price must be above EMA 50 (trend filter)
โ Result: Shows a green triangle below the bar
๐ด Bearish 3-Bar Reversal (Sell Setup):
Bar 1 is bullish (close > open)
Bar 2 makes a higher high than Bar 1
Bar 3 is bearish (close < open) and closes below Bar 2โs low
Price must be below EMA 50
โ Result: Shows a red triangle above the bar
๐ What It Plots:
๐ผ Green triangle below bullish signal bar
๐ฝ Red triangle above bearish signal bar
๐ Orange line = EMA50 (trend filter)
๐ Built-in Alerts:
Youโll get an alert if:
A bullish reversal pattern forms above EMA50
A bearish reversal pattern forms below EMA50
๐ง Use Cases:
Great for trend-following traders who want clean, price-action entries
Works well on intraday (15m/1h) or swing (4h/daily) timeframes
Can be used for manual entries, or converted to strategy for automation
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.