Mis à jour

[blackcat] L2 Ehlers High Pass Filter (2 pole)

2 558
Level:2

Background

The second-order high-pass filter (2 pole) is a classic JF Ehlers specification.

Function

I have found many places where the algorithms are not uniform and some are even wrong. So, I did some research and wrote a high pass filter that I think is correctly defined. This indicator is often used as one of the basic elements of other trading systems.

When you are using it, you need to enter the HPPeriod setting period.

Remarks

Free but Open Source
Notes de version
OVERVIEW
The [blackcat] L2 Ehlers High Pass Filter (2 Pole) indicator applies John F. Ehlers' High Pass Filter technique to help traders identify trends and potential entry/exit points. This filter smoothes out noise while preserving trend information, allowing users to make more informed trading decisions. The indicator plots the filtered values on a separate pane and provides visual labels and alerts for buy/sell signals 📈💡.

FEATURES

Implements Ehlers High Pass Filter (2 pole) algorithm for trend identification 📊
User-customizable period for the high pass filter ⚙️
Plots the filtered values on a separate pane with dynamic coloring:
Yellow for upward movements
Fuchsia for downward movements
Provides clear buy ('BUY') and sell ('SELL') labels directly on the plot 🏷️
Generates alerts for buy and sell signals to keep users informed 🔔
HOW TO USE

Add the indicator to your TradingView chart by selecting it from the indicators list.
Adjust the "High Pass Period" setting according to your preference and timeframe.
Monitor the plotted line for changes in direction and observe the buy/sell labels.
Set up alerts based on the generated signals to receive notifications when conditions are met 📲.
Use the indicator alongside other tools for confirmation before executing trades.
LIMITATIONS

The indicator may generate false signals during choppy or ranging markets 🌪️.
Users should always combine this tool with other forms of analysis for better accuracy.
Optimal settings may vary depending on the asset and timeframe being traded.
NOTES

Ensure that you have sufficient historical data available for accurate filtering.
Test the indicator thoroughly on demo accounts before applying it to live trading 🔍.
Experiment with different periods to find what works best for your specific needs.
Notes de version
█ OVERVIEW

A two-pole Ehlers high-pass filter that detrends price into a fast cycle oscillator, packaged as a complete signal system with governed entries, symmetric exits, ATR-based risk levels, and closed-bar alerts. It turns a raw filter line into a readable, alert-ready trading tool.

█ CONCEPTS

The two-pole high-pass filter removes the dominant trend component from price and leaves the shorter cycle oscillating around zero. Turning points of this residual cycle mark moments when short-term momentum flips.

Key principles:
 • Detrending: a two-pole high-pass filter isolates the cyclical residual of close prices
 • Turn detection: a BUY fires on the bar where the oscillator stops falling; a SELL fires where it stops rising
 • Signal governance: a position state machine, a cooldown window, and same-bar entry/exit exclusivity prevent whipsaw repetition
 • Volatility-scaled risk: entry, take-profit, and stop-loss references derive from ATR multiples

█ HOW TO USE

1 — Add the indicator; it opens in its own pane below the chart
2 — Tune High Pass Period: lower values react faster with more noise, higher values smooth the cycle
3 — Read signals: green BUY label = long entry, red SELL label = short entry, orange XL/XS cross = exit
4 — Watch the dashboard (top right) for position state, entry price, TP/SL levels, and ATR
5 — Create alerts from the four provided channels; every alert confirms on bar close

Input Parameters
 • High Pass Period: cycle cutoff of the filter (default 20, range 2-500)
 • Cooldown Bars: minimum bars between signals, 0 disables (default 3)
 • Same-bar Entry/Exit Exclusivity: on a reversal bar the entry wins and only one state change applies (default on)
 • ATR Length: lookback of the volatility unit (default 14)
 • Stop Loss (xATR) / Take Profit (xATR): risk multiples of ATR (defaults 2.0 / 3.0)
 • Show Signal Labels / Show Position Background / Show Dashboard / Show TP/SL Levels: display toggles

█ FEATURES

 • Full long/short trade loop: entries, reverse-signal exits, and persistent state tracking
 • Cooldown and exclusivity governance to suppress oscillation-driven signal clusters
 • ATR-scaled entry, take-profit, and stop-loss levels published to the Data Window
 • Position background tint plus an on-chart status dashboard
 • Four alertcondition channels and one dynamic alert, all confirmed at bar close
 • Label count is capped via max_labels_count for stable long-history rendering

█ SIGNALS

Visual Elements
 • Filter line: yellow while rising, fuchsia while falling
 • BUY (green up label): long entry after the filter turns up
 • SELL (red down label): short entry after the filter turns down
 • XL / XS (orange cross): long/short exit when the opposite turn occurs
 • Green/red pane tint: current position state (long/short)
 • Zero line: cycle equilibrium reference

█ IMPLEMENTATION NOTES

 • Open-source under Mozilla Public License 2.0; the core line follows John F. Ehlers' two-pole high-pass design
 • Turn edges use ta.crossover / ta.crossunder; risk levels use ta.atr
 • All signals evaluate on confirmed bars; no request.security calls, so no higher-timeframe repainting
 • Recursive filter history is nz()-guarded on the first bars

█ LIMITATIONS

 • High-pass output is inherently noisy; governance reduces but does not eliminate whipsaws in ranging markets
 • TP/SL values are reference levels in the Data Window, not automated orders
 • Defaults are starting points only — re-tune per symbol and timeframe
 • Suited to markets with regular cycles; performance degrades in strong one-way trends, where the filter flatlines near zero

█ NOTES

 • Filter concept: John F. Ehlers, Cycle Analytics for Traders
 • Original script: blackcat1402
 • Use and modify freely under Mozilla Public License 2.0

════════════════════════════════════════════════════════════════════════
For questions or feedback, please use the comments section below.
Feel free to use and modify — attribution appreciated.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.