Ehlers DecyclerJohn F. Ehlers introuced Decycler in his book "Cycle Analytics for Traders", chapter 4.
The decycler is designed to remove the influence of shorter cycle fluctuations, resulting in an output that closely resembles a one-pole low-pass filter.
A standout feature of the decycler is its notably minimal lag. The most extended cycle elements experience a delay of less than five bars. When considering a frequency of 0.05 cycles per bar (equivalent to a 20-bar cycle period), the lag approximates 1.5 bars. Components with a higher frequency face even lesser delays. Consequently, any higher-frequency variations that pass the filter's attenuation align closely with the price fluctuations. This makes the decycler an optimal "immediate trend detector," giving a true depiction of the data's trend.
While the SuperSmoother filter can yield a comparably smoothed output, the decycler typically exhibits less lag when the two are juxtaposed. It's worth noting that the decycler operates as a one-pole filter, implying it doesn't have the best filtering capabilities. It's not advisable to use the decycler as a smoothing filter to eliminate aliasing disturbances. Instead, its application should focus on generating an immediate trend representation, especially when choosing a larger cutoff period. The broad cutoff period equips the decycler with the ability to reduce aliasing disturbances, given that it's significantly distant from the Nyquist frequency.
There are already several decycler indicators on Tradingview, but I like to structure the code and highlight the main components as functions rather than hiding them in the code. I hope this is useful for those who are starting to learn Pine Script.
Decycler
[blackcat] L2 Ehlers Decycler OscillatorLevel: 2
Background
John F. Ehlers introuced Decycler Oscillator in Sep, 2015.
Function
In “Decyclers” in Sep, 2015, John Ehlers described a method for constructing an oscillator that could help traders detect trend reversals with almost no lag, an oscillator that signals trend reversals with almost zero lag via digital signal processing techniques. A high-pass filter is subtracted from the input data and the high-frequency components are removed via cancellation of terms. Lower-frequency components are filtered from the output, so they are not canceled from the original data. Thus, the decycler displays them with close to zero lag. The fast line has a period of 100 a K value of 1.2 and the slow line has a period of 125 and a K value of 1.
This script demonstrates the timely response of the decycler oscillator to market action. It applies the idea of using a decycler oscillator pair with different parameters, as discussed in Ehlers’ article:
1. Enter long when the fast line crosses over the slow line;
2. Exit long when the fast line crosses under the slow line.
Key Signal
Fast_Val --> Ehlers Decycler Oscillator fast line
Slow_Val --> Ehlers Decycler Oscillator slow line
Pros and Cons
100% John F. Ehlers definition translation, even variable names are the same. This help readers who would like to use pine to read his book.
Remarks
The 85th 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.
[blackcat] L2 Ehlers Decycler OscillatorLevel: 2
Background
John F. Ehlers introuced Decycler Oscillator in his "Cycle Analytics for Traders" chapter 4 on 2004.
Function
A decycler oscillator is created by subtracting the output of a high-pass filter having a shorter cutoff period from the output of another high-pass filter having a longer cutoff period. This way, both elements have a zero in their transfer responses at zero frequency. Thus, the very, very long cycle components (and the static term) are removed. There is a finite difference between the output of the two filters in the frequency range between their cutoff periods, but shorter cycle components are still removed by cancellation. As a result, the trend line is displayed as an oscillator.
Key Signal
Decycler ---> Decycler Oscillator fast line
Trigger ---> Decycler Oscillator 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 37th 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.
[blackcat] L2 Ehlers DecyclerLevel: 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.
Ehlers Decycler Oscillator [CC]The Decycler Oscillator was created by John Ehlers (Cycle Analytics For Traders pgs 43-44) and it is used to show transitions between uptrends and downtrends. If it rises above the 0 line then this means it has transitioned to an uptrend and it falls below the 0 line then it is in a downtrend. Buy if the indicator line is green and sell when it is red.
This was a custom request so let me know if you would like to see more scripts from me or if you want something custom done!
Ehlers Decycler [CC]The Decycler was created by John Ehlers (Cycle Analytics For Traders pgs 40-41) and this is a moving average that has an extremely low lag even though it uses a fairly high length to calculate everything. This can also work well as a trendline. Buy when the indicator line is green and sell when it is red.
Let me know if there are other scripts you would like to see me publish or if you want something custom done!
Ehlers Decycler OscillatorThis indicator was originally developed by John F. Ehlers (Stocks & Commodities , V.33:10 (September, 2015): "Decyclers").
The idea is still the same as for the Simple Decycler.
Mr. Ehlers suggested to virtually eliminate lag by getting rid of the very low-frequency components. So, he applied the high-pass filter to the simple decycler.
Mr. Ehlers recommended to use two instances of the Decycler Oscillator with different parameters (high-pass filter period and multiplier). As a result, he got the Decycler Oscillator pair.
The first oscillator (red line) has a period of 125 bars, the second one (yellow line) has a period of 100 bars.
The interpretation is straightforward:
When the yellow line crosses over the red line, a trend reversal to the upside is indicated.
When the yellow line crosses under the red line, a trend reversal to the downside is indicated.
Ehlers Simple DecyclerThis indicator was originally developed by John F. Ehlers (Stocks & Commodities, V.33:10 (September, 2015): "Decyclers").
Mr. Ehlers suggested a way to improve trend identification using high-pass filters. The basic smoothers like SMA, low-pass filters, have considerable lag in their display. Mr. Ehlers applied the high-pass filter and subtracted the high-pass filter output from the time series input. Doing these steps he removed high-frequency short-wavelength components (the ones causing the wiggles) from the time series.
As a result he got a special series of the low-frequency components with virtually no lag - the Decycler.
The Decycler is plotted with two additional lines (the percent-shifts of Decycler) and together they form a hysteresis band.
If the prices are above the upper hysteresis line, then the market is in an uptrend . If the prices are below the low hysteresis line, then the market is in a downtrend . Prices within the hysteresis band are trend-neutral .