アップデート済
[blackcat] L2 Ehlers Decycler

Level: 2
Background
John F. Ehlers introuced Decycler in his "Cycle Analytics for Traders" chapter 4 on 2004.
Function
The concept of a decycler is really pretty simple. The cyclic components are removed by the process of cancellation. If the high-pass filter output is subtracted from the input data, the residual only contains the low-frequency components. The decycler is a one-pole filter because the denominator contains only a first-order polynomial. By examination, the decycler must closely follow the input data because there is no difference term in the numerator of the transfer response.
Key Signal
Decycler ---> Decycler Indicator fast line
Trigger ---> Decycler Indicator slow line
Pros and Cons
100% John F. Ehlers definition translation of original work, even variable names are the same. This help readers who would like to use pine to read his book. If you had read his works, then you will be quite familiar with my code style.
Remarks
The 36th script for Blackcat1402 John F. Ehlers Week publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
Background
John F. Ehlers introuced Decycler in his "Cycle Analytics for Traders" chapter 4 on 2004.
Function
The concept of a decycler is really pretty simple. The cyclic components are removed by the process of cancellation. If the high-pass filter output is subtracted from the input data, the residual only contains the low-frequency components. The decycler is a one-pole filter because the denominator contains only a first-order polynomial. By examination, the decycler must closely follow the input data because there is no difference term in the numerator of the transfer response.
Key Signal
Decycler ---> Decycler Indicator fast line
Trigger ---> Decycler Indicator slow line
Pros and Cons
100% John F. Ehlers definition translation of original work, even variable names are the same. This help readers who would like to use pine to read his book. If you had read his works, then you will be quite familiar with my code style.
Remarks
The 36th script for Blackcat1402 John F. Ehlers Week publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
リリースノート
Based on sgrabowski15 recommendations, I change another way to display buy and sell labels.リリースノート
OVERVIEW This indicator implements the Ehlers Decycler algorithm to identify market trends and divergences. It provides visual signals for bullish and bearish divergences, including both regular and hidden patterns.FEATURES
• Calculates Ehlers Decycler using customizable cutoff period
• Displays decycler and trigger lines with filled background
• Identifies and plots four types of divergences:
Regular Bullish
Hidden Bullish
Regular Bearish
Hidden Bearish • Includes alert conditions for all divergence types • Customizable lookback periods and ranges
HOW TO USE
Adjust the Cutoff Period input to control sensitivity
Enable/disable divergence plotting using:
Plot Bullish Divergences
Plot Hidden Bullish Divergences
Plot Bearish Divergences
Plot Hidden Bearish Divergences
Customize lookback parameters:
Pivot Lookback Left
Pivot Lookback Right
Min Lookback Range
Max Lookback Range
LIMITATIONS
• Requires sufficient historical data for accurate calculations
• Performance may vary in highly volatile markets
• Alert conditions are based on price action and may generate false signals
NOTES
• The indicator uses the Ehlers Decycler algorithm for trend identification
• Divergence detection is based on price and oscillator movements
• Colors can be customized through TradingView's style settings
リリースノート
█ OVERVIEWThis indicator applies John Ehlers' decycler oscillator to price and turns it into a complete trend-following signal system: BUY/SELL crossover signals, four divergence types, ATR-based take-profit and stop-loss reference levels, and a position dashboard. It is the polished second edition of the original blackcat Ehlers Decycler.
█ CONCEPTS
A decycler removes cyclic components from price, so the remaining line reflects the underlying trend with less lag than long moving averages.
• Decycler line (yellow): trend direction from a recursive filter with cosine/sine alpha weighting
• Trigger line (fuchsia): previous-bar decycler value; crossovers mark trend changes
• Signal governance: a position state machine plus an adjustable cooldown suppresses rapid flip-flop signals in choppy markets
• Warm-up seeding: the filter starts from price instead of zero, so no startup transient distorts early bars
█ HOW TO USE
1 — Add the script to any chart; the default Cutoff Period of 60 suits daily and 4-hour charts.
2 — Read signals: BUY prints when the decycler crosses above its trigger; SELL prints on the cross below. Each signal flips the internal position state.
3 — Watch the stop-loss (red) and take-profit (teal) levels that extend from the entry price at ATR multiples.
4 — Enable the divergence overlays to catch early exhaustion warnings against the prevailing trend.
Input Parameters
• Cutoff Period: decycler smoothing length (default 60)
• Cooldown Bars: minimum bars between signals, 0 disables (default 3)
• ATR Length, Stop Loss (xATR), Take Profit (xATR): risk level settings (defaults 14, 2.0, 3.0)
• Pivot Lookback Left/Right and Min/Max Lookback Range: divergence pivot geometry (defaults 5, 5, 5, 60)
• Plot Bullish / Hidden Bullish / Bearish / Hidden Bearish: divergence toggles
• Position Background, Show Dashboard, Legacy BUY/SELL plotshape: visual switches
█ SIGNALS
• BUY label (green): decycler crossed above trigger — potential long entry
• SELL label (red): decycler crossed below trigger — potential short entry or long exit
• Bull / Bear divergence lines: price makes a lower low or higher high while the decycler does not — possible trend exhaustion
• H Bull / H Bear: hidden divergences, often continuation patterns
• Green/red background: current position state; the dashboard table shows position, trend, decycler value, ATR, and TP/SL levels
█ FEATURES
• Eight alert conditions: BUY, SELL, long exit, short exit, and four divergence alerts
• Cooldown-based signal governance that can be switched back to raw crossover behavior
• ATR-adaptive TP/SL reference levels that follow volatility
• Information dashboard, state background, and bounded label memory
█ IMPLEMENTATION NOTES
Open-source Pine v6. The decycler is a custom recursive filter evaluated with ta.crossover/ta.crossunder; divergences use ta.pivotlow/ta.pivothigh with ta.valuewhen confirmation. No request.security calls are used, so there is no higher-timeframe repaint surface; all signals are evaluated on confirmed bars.
█ LIMITATIONS
• Trend-following by design: expect whipsaw losses in prolonged ranges; the cooldown filter reduces but does not eliminate them
• TP/SL lines are reference levels, not executed orders
• Divergence signals confirm several bars after the pivot by construction
█ NOTES
• Concept credit: John F. Ehlers, "Cycle Analytics for Traders" (decycler)
• Original script by blackcat1402, Mozilla Public License 2.0
════════════════════════════════════════════════════════════════════════
For questions or feedback, please use the comments section below.
Feel free to use and modify — attribution appreciated.
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。