[blackcat] L2 Ehlers Dominant Cycle Tuned Bandpass Filter

Level: 2


John F. Ehlers introuced his Dominant Cycle Tuned Bandpass Filter Strategy in Mar, 2008.


In "Measuring Cycle Periods", author John Ehlers presents a very interesting technique of measuring dominant market cycle periods by means of multiple bandpass filtering. By utilizing an approach similar to audio equalizers, the signal (here, the price series) is fed into a set of simple second-order infinite impulse response bandpass filters. Filters are tuned to 8,9,10,...,50 periods. The filter with the highest output represents the dominant cycle. A full-featured formula that implements a high-pass filter and a six-tap low-pass Fir filter on input, then 42 parallel Iir band-pass filters.

I've coded John Ehlers' filter bank to measure the dominant cycle (DC) and the sine and cosine filter components in pine v4 for TradingView, based on John Ehlers' article in this issue, "Measuring Cycle Periods." The CycleFilterDC function plots and returns the DC series and its components, so it's a trivial matter to make use of them in a trading strategy.

Based on John Ehlers' article, "Measuring Cycle Periods," he chose to implement the dominant cycle-tuned bandpass filter response to test Ehlers' suggestion to use the sine and cosine crossovers as buy and sell signals. If the sine closely follows the price pattern as suggested, and the cosine is an effective leading function of the sine, then it seems to make sense that a crossover implementation would work well (Personally, what I observed this is not so accurated as his claims).

What he discovered in his tests was that crossovers happened at frequent intervals, even when price has not moved significantly. This leads to a higher percentage of losing trades, particularly when spread, slippage, and commissions are accounted for. Nevertheless, the cosine crossover was quite effective at identifying reversals very early in many cases, so this indicator could prove quite effective when used alongside other indicators. In particular, the use of an indicator to confirm a certain level of recent volatility , as well as an indicator to confirm significant rate of change , could prove quite helpful.

Key Signal

CosineLine--> Ehlers Dominant Cycle Tuned Bandpass Filter Strategy fast line
SineLine--> Ehlers Dominant Cycle Tuned Bandpass Filter Strategy 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.


The 72th script for Blackcat1402 John F. Ehlers Week publication.

NOTE: Although Dr . Ehlers think high of Cosine and Sine wave indicator and trading strategy, my study and trading experience indicated it did not work that well as many other oscillator indicators. However, I would like to keep the original code of Dr . Ehlers for anyone who want to make a deep dive into this kind of indicator or strategy with Cosine and Sine wave .


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.

Donate TRC20 USDT to below address, 5USDT per monthly sub, 50USDT per yearly sub: TNz84MjJTWUUUyQFpPNjaAU7J2SwhJJ7j9
Note: USDT_TRC20 deposits sent from decentralized exchanges are not yet supported.
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.


Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?