Hurst Spectral Analysis SwamiChartHaving a hard time deciding which wavelength to use for a Hurst analysis? Try a handful at once! SwamiCharts by John Ehlers offers a comprehensive way to visualize an indicator used over a range of lookback periods. The Spectral Analysis SwamiChart shows the bullish or bearish state of a spectrum of bandpasses over a user-defined range of wavelengths. The trader simply selects a bandwidth, a base wavelength, and a step/multiple to see the Spectral Analysis SwamiChart. A vertical column of green or red tends to indicate a very bullish or bearish moment in time, meaning that all bandpasses in the analyzed spectrum are in a bullish or bearish orientation simultaneously.
🏆 Shoutout to DavidF at Sigma-L for all the helpful information, conversations together, & indicator feedback.
🏅Shoutout to @HPotter for the bandpass code, and shoutout to @TerryPascoe for sharing it with me
Bandpass
Hurst Spectral Analysis Oscillator"It is a true fact that any given time history of any event (including the price history of a stock) can always be considered as reproducible to any desired degree of accuracy by the process of algebraically summing a particular series of sine waves. This is intuitively evident if you start with a number of sine waves of differing frequencies, amplitudes, and phases, and then sum them up to get a new and more complex waveform." (Spectral Analysis chapter of J M Hurst's book, Profit Magic )
Background: A band-pass filter or bandpass filter is a device that passes frequencies within a certain range and rejects (attenuates) frequencies outside that range. Bandpass filters are widely used in wireless transmitters and receivers. Well-designed bandpass filters (having the optimum bandwidth) maximize the number of signal transmitters that can exist in a system while minimizing the interference or competition among signals. Outside of electronics and signal processing, other examples of the use of bandpass filters include atmospheric sciences, neuroscience, astronomy, economics, and finance.
About the indicator: This indicator will accept float/decimal length inputs to display a spectrum of 11 bandpass filters. The trader can select a single bandpass for analysis that includes future high/low predictions. The trader can also select which bandpasses contribute to a composite model of expected price action.
10 Statements to describe the 5 elements of Hurst's price-motion model:
Random events account for only 2% of the price change of the overall market and of individual issues.
National and world historical events influence the market to a negligible degree.
Foreseeable fundamental events account for about 75% of all price motion. The effect is smooth and slow changing.
Unforeseeable fundamental events influence price motion. They occur relatively seldom, but the effect can be large and must be guarded against.
Approximately 23% of all price motion is cyclic in nature and semi-predictable (basis of the "cyclic model").
Cyclicality in price motion consists of the sum of a number of (non-ideal) periodic cyclic "waves" or "fluctuations" (summation principle).
Summed cyclicality is a common factor among all stocks (commonality principle).
Cyclic component magnitude and duration fluctuate slowly with the passage of time. In the course of such fluctuations, the greater the magnitude, the longer the duration and vice-versa (variation principle).
Principle of nominality: an element of commonality from which variation is expected.
The greater the nominal duration of a cyclic component, the larger the nominal magnitude (principle of proportionality).
Shoutouts & Credits for all the raw code, helpful information, ideas & collaboration, conversations together, introductions, indicator feedback, and genuine/selfless help:
🏆 @TerryPascoe
🏅 DavidF at Sigma-L, and @HPotter
👏 @Saviolis, parisboy, and @upslidedown
Adaptive Qualitative Quantitative Estimation (QQE) [Loxx]Adaptive QQE is a fixed and cycle adaptive version of the popular Qualitative Quantitative Estimation (QQE) used by forex traders. This indicator includes varoius types of RSI caculations and adaptive cycle measurements to find tune your signal.
Qualitative Quantitative Estimation (QQE):
The Qualitative Quantitative Estimation (QQE) indicator works like a smoother version of the popular Relative Strength Index (RSI) indicator. QQE expands on RSI by adding two volatility based trailing stop lines. These trailing stop lines are composed of a fast and a slow moving Average True Range (ATR).
There are many indicators for many purposes. Some of them are complex and some are comparatively easy to handle. The QQE indicator is a really useful analytical tool and one of the most accurate indicators. It offers numerous strategies for using the buy and sell signals. Essentially, it can help detect trend reversal and enter the trade at the most optimal positions.
Wilders' RSI:
The Relative Strength Index ( RSI ) is a well versed momentum based oscillator which is used to measure the speed (velocity) as well as the change (magnitude) of directional price movements. Essentially RSI , when graphed, provides a visual mean to monitor both the current, as well as historical, strength and weakness of a particular market. The strength or weakness is based on closing prices over the duration of a specified trading period creating a reliable metric of price and momentum changes. Given the popularity of cash settled instruments (stock indexes) and leveraged financial products (the entire field of derivatives); RSI has proven to be a viable indicator of price movements.
RSX RSI:
RSI is a very popular technical indicator, because it takes into consideration market speed, direction and trend uniformity. However, the its widely criticized drawback is its noisy (jittery) appearance. The Jurk RSX retains all the useful features of RSI , but with one important exception: the noise is gone with no added lag.
Rapid RSI:
Rapid RSI Indicator, from Ian Copsey's article in the October 2006 issue of Stocks & Commodities magazine.
RapidRSI resembles Wilder's RSI , but uses a SMA instead of a WilderMA for internal smoothing of price change accumulators.
VHF Adaptive Cycle:
Vertical Horizontal Filter (VHF) was created by Adam White to identify trending and ranging markets. VHF measures the level of trend activity, similar to ADX DI. Vertical Horizontal Filter does not, itself, generate trading signals, but determines whether signals are taken from trend or momentum indicators. Using this trend information, one is then able to derive an average cycle length.
Band-pass Adaptive Cycle:
Even the most casual chart reader will be able to spot times when the market is cycling and other times when longer-term trends are in play. Cycling markets are ideal for swing trading however attempting to “trade the swing” in a trending market can be a recipe for disaster. Similarly, applying trend trading techniques during a cycling market can equally wreak havoc in your account. Cycle or trend modes can readily be identified in hindsight. But it would be useful to have an objective scientific approach to guide you as to the current market mode.
There are a number of tools already available to differentiate between cycle and trend modes. For example, measuring the trend slope over the cycle period to the amplitude of the cyclic swing is one possibility.
We begin by thinking of cycle mode in terms of frequency or its inverse, periodicity. Since the markets are fractal ; daily, weekly, and intraday charts are pretty much indistinguishable when time scales are removed. Thus it is useful to think of the cycle period in terms of its bar count. For example, a 20 bar cycle using daily data corresponds to a cycle period of approximately one month.
When viewed as a waveform, slow-varying price trends constitute the waveform's low frequency components and day-to-day fluctuations (noise) constitute the high frequency components. The objective in cycle mode is to filter out the unwanted components--both low frequency trends and the high frequency noise--and retain only the range of frequencies over the desired swing period. A filter for doing this is called a bandpass filter and the range of frequencies passed is the filter's bandwidth.
Included:
-Toggle on/off bar coloring
-Customize RSI signal using fixed, VHF Adaptive, and Band-pass Adaptive calculations
-Choose from three different RSI types
Visuals:
-Red/Green line is the moving average of RSI
-Thin white line is the fast trend
-Dotted yellow line is the slow trend
Happy trading!
Aroon Oscillator of Adaptive RSI [Loxx]Aroon Oscillator of Adaptive RSI uses RSI to calculate AROON in attempt to capture more trend and momentum quicker than Aroon or RSI alone. Aroon Oscillator of Adaptive RSI has three different types of RSI calculations and the choice of either fixed, VHF Adaptive, or Band-pass Adaptive cycle measures to calculate RSI.
Arron Oscillator:
The Aroon Oscillator was developed by Tushar Chande in 1995 as part of the Aroon Indicator system. Chande’s intention for the system was to highlight short-term trend changes. The name Aroon is derived from the Sanskrit language and roughly translates to “dawn’s early light.”
The Aroon Oscillator is a trend-following indicator that uses aspects of the Aroon Indicator (Aroon Up and Aroon Down) to gauge the strength of a current trend and the likelihood that it will continue.
Aroon oscillator readings above zero indicate that an uptrend is present, while readings below zero indicate that a downtrend is present. Traders watch for zero line crossovers to signal potential trend changes. They also watch for big moves, above 50 or below -50 to signal strong price moves.
Wilders' RSI:
The Relative Strength Index (RSI) is a well versed momentum based oscillator which is used to measure the speed (velocity) as well as the change (magnitude) of directional price movements. Essentially RSI, when graphed, provides a visual mean to monitor both the current, as well as historical, strength and weakness of a particular market. The strength or weakness is based on closing prices over the duration of a specified trading period creating a reliable metric of price and momentum changes. Given the popularity of cash settled instruments (stock indexes) and leveraged financial products (the entire field of derivatives); RSI has proven to be a viable indicator of price movements.
RSX RSI:
RSI is a very popular technical indicator, because it takes into consideration market speed, direction and trend uniformity. However, the its widely criticized drawback is its noisy (jittery) appearance. The Jurk RSX retains all the useful features of RSI, but with one important exception: the noise is gone with no added lag.
Rapid RSI:
Rapid RSI Indicator, from Ian Copsey's article in the October 2006 issue of Stocks & Commodities magazine.
RapidRSI resembles Wilder's RSI, but uses a SMA instead of a WilderMA for internal smoothing of price change accumulators.
VHF Adaptive Cycle:
Vertical Horizontal Filter (VHF) was created by Adam White to identify trending and ranging markets. VHF measures the level of trend activity, similar to ADX DI. Vertical Horizontal Filter does not, itself, generate trading signals, but determines whether signals are taken from trend or momentum indicators. Using this trend information, one is then able to derive an average cycle length.
Band-pass Adaptive Cycle
Even the most casual chart reader will be able to spot times when the market is cycling and other times when longer-term trends are in play. Cycling markets are ideal for swing trading however attempting to “trade the swing” in a trending market can be a recipe for disaster. Similarly, applying trend trading techniques during a cycling market can equally wreak havoc in your account. Cycle or trend modes can readily be identified in hindsight. But it would be useful to have an objective scientific approach to guide you as to the current market mode.
There are a number of tools already available to differentiate between cycle and trend modes. For example, measuring the trend slope over the cycle period to the amplitude of the cyclic swing is one possibility.
We begin by thinking of cycle mode in terms of frequency or its inverse, periodicity. Since the markets are fractal ; daily, weekly, and intraday charts are pretty much indistinguishable when time scales are removed. Thus it is useful to think of the cycle period in terms of its bar count. For example, a 20 bar cycle using daily data corresponds to a cycle period of approximately one month.
When viewed as a waveform, slow-varying price trends constitute the waveform's low frequency components and day-to-day fluctuations (noise) constitute the high frequency components. The objective in cycle mode is to filter out the unwanted components--both low frequency trends and the high frequency noise--and retain only the range of frequencies over the desired swing period. A filter for doing this is called a bandpass filter and the range of frequencies passed is the filter's bandwidth.
Included:
-Toggle on/off bar coloring
-Customize RSI signal using fixed, VHF Adaptive, and Band-pass Adaptive calculations
-Choose from three different RSI types
Happy trading!
Adaptive, Zero lag Schaff Trend Cycle [Loxx]TASC's March 2008 edition Traders' Tips includes an article by John Ehlers titled "Measuring Cycle Periods," and describes the use of bandpass filters to estimate the length, in bars, of the currently dominant price cycle.
What are Dominant Cycles and Why should we use them?
Even the most casual chart reader will be able to spot times when the market is cycling and other times when longer-term trends are in play. Cycling markets are ideal for swing trading however attempting to “trade the swing” in a trending market can be a recipe for disaster. Similarly, applying trend trading techniques during a cycling market can equally wreak havoc in your account. Cycle or trend modes can readily be identified in hindsight. But it would be useful to have an objective scientific approach to guide you as to the current market mode.
There are a number of tools already available to differentiate between cycle and trend modes. For example, measuring the trend slope over the cycle period to the amplitude of the cyclic swing is one possibility.
We begin by thinking of cycle mode in terms of frequency or its inverse, periodicity. Since the markets are fractal ; daily, weekly, and intraday charts are pretty much indistinguishable when time scales are removed. Thus it is useful to think of the cycle period in terms of its bar count. For example, a 20 bar cycle using daily data corresponds to a cycle period of approximately one month.
When viewed as a waveform, slow-varying price trends constitute the waveform's low frequency components and day-to-day fluctuations (noise) constitute the high frequency components. The objective in cycle mode is to filter out the unwanted components--both low frequency trends and the high frequency noise--and retain only the range of frequencies over the desired swing period. A filter for doing this is called a bandpass filter and the range of frequencies passed is the filter's bandwidth.
Indicator Features
-Zero lag or Regular Schaff Trend Cycle calculation
- Fixed or Band-pass Dominant Cycle for Schaff Trend Cycle MA period inputs
-10 different moving average options for Zero lag calculations
-Separate Band-pass Dominant Cycle calculations for both Schaff Trend Cycle and MA calculations
- Slow-to-Fast Band-pass Dominant Cycle input to tweak the ratio of Schaff Trend Cycle MA input periods as they relate to each other
Hybrid, Zero lag, Adaptive cycle MACD [Loxx]TASC's March 2008 edition Traders' Tips includes an article by John Ehlers titled "Measuring Cycle Periods," and describes the use of bandpass filters to estimate the length, in bars, of the currently dominant price cycle.
What are Dominant Cycles and Why should we use them?
Even the most casual chart reader will be able to spot times when the market is cycling and other times when longer-term trends are in play. Cycling markets are ideal for swing trading however attempting to “trade the swing” in a trending market can be a recipe for disaster. Similarly, applying trend trading techniques during a cycling market can equally wreak havoc in your account. Cycle or trend modes can readily be identified in hindsight. But it would be useful to have an objective scientific approach to guide you as to the current market mode.
There are a number of tools already available to differentiate between cycle and trend modes. For example, measuring the trend slope over the cycle period to the amplitude of the cyclic swing is one possibility.
We begin by thinking of cycle mode in terms of frequency or its inverse, periodicity. Since the markets are fractal; daily, weekly, and intraday charts are pretty much indistinguishable when time scales are removed. Thus it is useful to think of the cycle period in terms of its bar count. For example, a 20 bar cycle using daily data corresponds to a cycle period of approximately one month.
When viewed as a waveform, slow-varying price trends constitute the waveform's low frequency components and day-to-day fluctuations (noise) constitute the high frequency components. The objective in cycle mode is to filter out the unwanted components--both low frequency trends and the high frequency noise--and retain only the range of frequencies over the desired swing period. A filter for doing this is called a bandpass filter and the range of frequencies passed is the filter's bandwidth .
Indicator Features
-Zero lag or Regular MACD/signal calculation
- Fixed or Band-pass Dominant Cycle for MACD and Signal MA period inputs
-10 different moving average options for both MACD and Signal MA calculations
-Separate Band-pass Dominant Cycle calculations for both MACD and Signal MA calculations
- Slow-to-Fast Band-pass Dominant Cycle input to tweak the ratio of MACD MA input periods as they relate to each other
Adaptive Trend Cipher loxx]Adaptive Trend Cipher
Highly experimental!
Features:
-Implements 5 different Dominant Adaptive Cycle Measures to determine optimal inputs for correlation functions. These cycle calculations include the following: **
* Ehler's Autocorrelation Dominant Cycle
* Ehler's Instantaneous Dominant Cycle
* Ehler's Band-pass Dominant Cycle
* Ehler's Hilbert Period Dominant Cycle
* Ehler's Dual Differentiator Dominant Cycle
**additional cycle measures to be added in future releases
-Uses price to time correlation with look-back periods determined by the dominant cycle measures
-Allows users to manipulate the range of Dominant Cycle inputs, also allows the user to change the size % of the the output Dominant cycle to be used to determine correlation lengths
-Bars are colored according to correlation extremes. Green bars are uptrend, Red bars are downtrend; Yellow bars are high correlation, Fuchsia bars are low correlation
Uses
-Trend cipher is a novel approach to teasing out macro trends in the market. This version is geared to be used on the daily time frame only
-Reversals at yellow and fuchsia bars when they appear, it shows price exhaustion using
Warning: This may not work on certain assets due to the high processing power required to calculate cycle dominance. This also uses a custom correlation function since the data being input intot he correlation function is not constant but variable based on cycle dominance at every bar. To correct this in most circumstances you must change the max_bars_back constant in the indicator method call
If you use parts of the code, please let me know, I would love to hear what you do with it.
Happy trading!
[DSPrated] Modified EMD for swing tradeModified Ehlers Empirical Mode Decomposition indicator for swing trade based on Butterworth 2nd order IIR filter
Description
This script is inspired by John Ehlers' TECHNICAL PAPERS - Truncating Indicators and Empirical Mode Decomposition. But instead of detecting trend it applies to finding swing regions.
Also here is suggested canonical DSP approach for designing coefficients for Butterworth 2nd order IIR filters - bandpass and lowpass.
Besides, truncated IIR filter with configurable length parameter is used. It worth mentioning, that although truncated filter is more robust than original IIR, it losses specified properties (bandpass) the more, the less is length parameter.
Butterworth Bandpass Infinite Impulse Response (IIR) Filter
This is the 2nd order Butterworth Bandpass Infinite Impulse Response (IIR) Filter based on the transform from the 1st order lowpass
Based on the example 8.8 on p476 from book Digital Signal Processing: A Practical Approach 2nd Edition by Emmanuel C. Ifeachor (Author), Barrie W. Jervis (Author)
It differs from Ehlers BandPass Filter only in the way you initialize input parameters. Here you can define cutoff periods of region of interest. For example on a timeframe, where one bar equals 1 hour you can define periods 18 and 22, which mean you'll see the swing intensity of price movement components within specified range.
Parameters
Source
Period 1 - cutoff period of bandpass begining
Period 2 - cutoff period of the end of bandpass
length - IIR truncation length
Concept of usage
Within specified bandpass this indicator eliminates the Trend line according to Ehlers EMD. The bandpass periods is recommended to choose accordingly to personal comfortable trading style and timeframe.
The trendline painted with 3 colors depending of the next modes:
up tend - green
cycling - black
downtrend - red
So the buy signal is generated when trend line in cycling mode and filtered component reaches it local minimum.
And the sell signal is generated when trend line in cycling mode and filtered component reaches it local maximum.
Secure long and short zones marked with color.
---
// TO DO
// - compare truncated and full version using signal generators
// - apply zero lag filter modification fordetectig ternd and swing peroids
// - implement strategy scripts
// - implement somewhat "true" EMD with sevral IMFs(intrinsic mode function)
// - better description?
// - parameter optimization
---
Please, feel free to report any issues and improvement suggestions.
Ehlers Cycle Amplitude [CC]The Cycle Amplitude was created by John Ehlers (Trend Modes and Cycle Modes) and this indicator wasn't meant to give buy and sell signals by itself but I'm publishing this open source script in case someone comes up with a cool way to use this indicator for buy and sell signals. This indicator essentially tells you the distance between the peaks from the Cycle BandPass Filter and I will be including the last script tomorrow most likely. I'm reusing the same exact buy and sell signals from the cycle bandpass filter so if you have any questions then feel free to refer to the link I posted.
Let me know if there are any other scripts you would like to see me publish!
Ehlers Cycle BandPass Filter [CC]The Cycle BandPass Filter was created by John Ehlers (Cycle Modes and Trend Modes) and this is an alternate to the default BandPass Filter by changing some settings. This will be another series I will be introducing showing some indicators created by Ehlers and that didn't get much attention. This identifies the underlying cycle in the price data and these indicators aren't very common so I want to introduce more of these to tv. Buying and selling with these indicators can be a bit tricky but overall what Ehlers recommends is to buy at the lowest point and sell at the highest point to capture the underlying cycle. I have included strong buy and sell signals as darker colors and normal signals as lighter colors. Buy when the line turns green and sell when it turns red.
Let me know if there are any other scripts you would like to see me publish!
Ehlers Adaptive Bandpass Filter [CC]The Adaptive Bandpass Filter was created by John Ehlers (Cycle Analytics For Traders pgs 153-156) and this uses his autocorrelation code to provide the adaptive lengths to use for the underlying bandpass filter. The bandpass filter is a common way in digital signal processing to filter out the underlying noise in the data. It can actually be turned into a leading indicator by changing the bw variable to a smaller amount. Since this indicator is adaptive using the cycle period, the buy and sell signals are different compared to the normal bandpass filter. Buy signals for this indicator according to Ehlers are when the line is red and the line is under the oversold line (also red) then you buy when the indicator line turns green and then you exit when the indicator line turns red and is above the overbought line. This indicator doesn't provide clear buy and sell signals in all circumstances but generally speaking buy when the indicator line turns green and sell when it turns red. Feel free to experiment with this one.
Let me know if there are any other scripts you would like to see me publish!
[blackcat] L2 Ehlers Adaptive BandPass FilterLevel: 2
Background
John F. Ehlers introduced Adaptive BandPass Filter in his "Cycle Analytics for Traders" chapter 11 on 2013.
Function
Adaptive band-pass filter was designed. It just makes since to tune that filter to the measured dominant cycle to eliminate all the other frequency components that are of no interest. Here, the adaptive band-pass indicator starts with the computation of the dominant cycle using the autocorrelation periodogram approach.
One way to make a band-pass filter have a leading phase capability is to tune the filter to a period shorter than the period of the cycle being measured. In this case, the bandwidth of filter is set to 0.3. That is 30 percent of the tuned center period. Therefore, the half bandwidth is 15 percent. We tune the filter to be 10 percent toward the shorter period from the dominant cycle period to provide the phase lead while still having the data of interest be within the filter bandwidth. This provides a phase lead of the dominant cycle to be something on the order of 60 degrees, or one-sixth of a cycle. If the dominant cycle were 18 bars, for example, then the detuning of the filter would produce a 3-bar lead. This leading function is not huge, but it is significant.
A convenient trigger line is included in the adaptive band-pass filter to signal the more highly likely buy and sell points. The trigger is compute as 90 percent of the amplitude of the adaptive band-pass filter line and is delayed by one bar. While the line crossings occur after the peak of the band-pass filter, phase lead provides for the generation of a timely signal. Significant trading signals should also include the criteria that the line crossing occur at greater than the +0.7 and less than the −0.7 reference lines.
Key Signal
DominantCycle --> Dominant Cycle signal
Signal --> Adaptive BandPass Filter signal
Trigger --> lag version of Adaptive BandPass Filter sinal
LeadSignal --> Adaptive BandPass Filter Lead signal
Trigger2 --> lag version of Adaptive BandPass Filter Lead sinal
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 54th 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 Zero Crossings Period MeasurerLevel: 2
Background
John F. Ehlers introuced Zero Crossings Period Measurer in his "Cycle Analytics for Traders" chapter 5 on 2004.
Function
The band-pass filter can be used as a relatively simple measurement of the dominant cycle. A cycle is complete when the waveform crosses zero two times from the last zero crossing. Therefore, each successive zero crossing of the indicator marks a half cycle period. We can establish the dominant cycle period as twice the spacing between successive zero crossings. When we measure the dominant cycle period this way, it is best to widen the pass band of the band-pass filter to avoid distorting the measurement simply due to the selectivity of the filter. Using an input bandwidth of 0.7 produces an octave-wide pass band. For example, if the center period of the filter is 20 and the relative bandwidth is 0.7, the bandwidth is 14. That means the pass band of the filter extends from 13-bar periods to 27-bar periods. That is, roughly an octave exists because the longest period is twice the shortest period of the pass band. It is imperative that a high-pass filter is tuned one octave below the halfbandwidth edge of the band-pass filter to ensure a nominal zero mean of the filtered output. Without a zero mean, the zero crossings can have a substantial error.
Key Signal
DC ---> dominant cycle
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 39th 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.
Lane Bandpass Filter OscillatorThis is a bandpass filter oscillator that has an additional tuning parameter
in addition to the Period used by John Ehlers. It is 'quality' which has meaning
in a frequency/magnitude sense (See Q in line 7). The bandpass is slower
according to the inverse of Q.
The concept was developed by John Lane etal in the text 'DSP Filters'
The bandpass filter works better in a trending environment.
Truncated Bandpass Filter and Bandpass Filter - Dr. John EhlersWith the arrival of the blessed gifts of arrays from TV, I now present the REAL "Truncated Bandpass Filter" indicator employing PSv4.0 upon initial release, originally formulated by the magnificent mathemagician Dr. John Ehlers for TASC - July 2020 Traders Tips. Don't be bamboozled by the other incorrect truncated bandpass filters found on TV, those published with an erroneous haste that preceded Pine array availability. More information about these bandpass filters can be acquired with a simple search for this indicator's white paper, entitled "TRUNCATED INDICATORS by John F. Ehlers", on his site in the educational reference section.
This actually contains two indicators, one being the truncated bandpass, the other being a two pole bandpass which is also found in my Voss implementation. The two pole bandpass is primarily for comparison of both types, but as you can see, they share common code within both, one being truncated and the other not. I modified Ehlers' original truncation formulation by allowing the capability to alter the truncation period using two distinct methods. I will explain very briefly that the purpose of a truncated "infinite impulse response" filter is to dampen it's response. Truncation techniques aren't limited to only bandpass filters, "some" other IIR filters, but not all, may benefit from this as well.
Lastly this is a miniature starter lesson by example of how the new native Pine array functions may be used, along with other various methods such as `var` to improve computational efficiency on the cloud servers. Yep, native Pine arrays just doubled the "Power of Pine" by exponential magnitudes of power into the dimension of what I would now term as the "Immense Power of Pine" . The next generation capability of programming extremely advanced indicators has now successfully arrived on mothership Earth, right on TradingView's front lawn. Who would of known?? This is brought to you in part by the devoted voluntary efforts of the most skilled poetic programmers on TV, the likes of which most extraterrestrial alien programmers would fear. Ladies and Gents, YOU KNOW WHO YOU ARE. Wink, wink!
NOTICE: You have absolute freedom to use this source code any way you see fit within your new Pine projects. You don't have to ask for my permission to reuse these functions in your published scripts, simply because I have better things to do than answer requests for the reuse of the tbpf() and bpf() functions. Sufficient accreditation regarding this script and compliance with "TV's House Rules" regarding code reuse, is as easy as copying the functions in their entirety as is. Fair enough? Good!
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND a few more... Why list them, when you have the source code to explore!
When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. Have a profitable future everyone!
Voss Predictor (A Peek Into the Future) - Dr. John EhlersI have been sitting on this for over a year, but I now present this "Voss Predictive Filter" multicator employing PSv4.0 upon initial release, originally formulated by the great and empowering Dr. John Ehlers for TASC - August 2019 Traders Tips. This is a slightly modified version of the original indicator John Ehlers designed. My improved implementation is an all-in-one combination of three indicators, consisting of Ehlers' 2-pole bandpass filter, fed into the Voss predictor, and my Correlation Color. I also purposefully attempted to make this indicator work on both "Light" and "Dark" charts equally well.
You can search for this indicator's white paper, entitled "A PEEK INTO THE FUTURE By John Ehlers", on his site in the educational reference section. It's VERY important that you fully grasp how this indicator works and when it doesn't during trending price movements. According to "TV House Rules", I can't link directly to his white paper on his web site. Technically he's a vendor, even though it has been divulged to me, that he is intending to retire after his last and final wØℾk$#Øp, where he is publicly disseminating the bulk of his unpublished proprietary code that drives his other website VERY SOON.
I love John Ehlers in a respectfully appreciative manner and he is my hero in life! I simply don't revel about pretended celebrities and supposed rock stars. I will never be able to adequately explain to you how much he has influenced me AND this website as it currently exists AND what is in store for the future of the ever evolving "Power of Pine". His inspiring legacy of code poetry shall forever be immortally enshrined here on TV and influence it.
Back to the topic of interest, this script originating from John Ehlers' mind... This indicator helps to anticipate cyclic turning points via negative group delay. It is NOT a predictive crystal ball. Do not become cluelessly disillusioned by it's title. I need to explain.
For example, this indicator could not have anticipated that the bold faced lie of "15 Days to Slow the Spread" of the CHImeravirus "plandemic" in the USA, would turn into our factual reality of multi state mandated orders demanding months of unconstitutional prison cell styled lockdowns with closures and the absurd criminalization of not wearing a mouth mask made from underwear while not being evidently ill, additionally combined with 24/7 black magick mass hypnosis spoon feeding non-scientific fear based psychological propaganda from the world's "finest" epidemiological data analysts and misleaders, eventually decimating the world's markets into zombie economies with abhorrent results of long term massive unemployment and financial hardship on a chart scale never before witnessed. Yep, it's NOT capable of predetermining any of that. I just wanted to make that very clear by example in a metaphorical manner many people can relate to concerning Voss' ability to anticipate.
The indicator consists of a bandpass filter coupled to the Voss predictor. Also, one thing about the Voss predictor, it can catch minute turning points or even false ones as explained in the white paper. So... I included my Correlation Color as a fitting companion to aid you in filtering out false signals during trending price movements. The Voss Predictive Filter should never be used alone, be forewarned!
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND a few more... Why list them, when you have the source code to explore!
When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members , I may implement more ideas when they present themselves as worthy additions. Have a profitable future everyone!
Ehlers BandPass Filter [CC]The BandPass Filter was created by John Ehlers (Cycle Analytics For Traders pgs 56-57) and this indicator only works well in choppy markets so I figured it would be useful for the scalpers out there. As you will notice it correctly identifies the peaks and valleys in the underlying stock data but it doesn't work as well when the stock is trending. The black line is a leading signal for the indicator and so I use that as the basis for the buy and sell signals. Make sure to experiment with this one and let me know if you find any better buy and sell signals to work with since I believe this is the first time I have seen this script published. Buy when the line turns green and sell when it turns red.
Let me know if there are other indicators you would like to see me publish or if you want something custom done!
Ehlers Truncated BandPass Filter [CC]Hot off the presses! The Truncated BandPass Filter was created by John Ehlers (Stocks & Commodities July 2020) and this is a much more reactive version of his original bandpass filter. When the indicator rises above 0 then it is an uptrend and when it falls below 0 then it is in a downtrend. Buy when the indicator line is red and sell when it is green.
Let me know if there are other scripts you would like to see me publish or if you want something custom done!
Adaptive Bandpass Filter [ChuckBanger]An band-pass filtered Oscillator that has adaptive buy and sell thresholds. You buy or sell when the blue line is under or over the pink line. The histogram is there to show how big the momentum is on a potential pump or dump.
Roofing Filter [DW]This is an experimental study built on the concept of using roofing filters on price data proposed by John Ehlers.
Roofing filters are a type of bandpass filter conventionally used in HF radio receivers in the first IF stage to limit the frequency spectrum passed on to later stages in the receiver.
The goal in applying roofing filters to a price signal is to simultaneously attenuate high frequency noise and low frequency distortion to pass an oscillating signal with a nearly zero mean for analysis and/or further calculation.
In this study, there are three filter types to choose from:
-> Ehlers Roofing Filter, which passes data through a 2 pole high pass filter, then through a Super Smoother filter.
-> Gaussian Roofing Filter, which passes data through a 2 pole Gaussian high pass filter, then through a 2 pole Gaussian low pass filter.
-> Butterworth Roofing Filter, which passes data through a 2 pole Butterworth high pass filter, then through a 2 pole Butterworth low pass filter.
Each filter type has different amplitude and delay characteristics, so play around with each type and see which response suits your needs best.
There is an option to normalize the scale of the output as well. The normalization process in this script is computed by comparing positive and negative outputs to the filter's moving RMS value.
The resulting oscillator can be fed through numerous conventional indicators including Stochastic Oscillator, RSI, CCI, etc. to generate smoother, less distorted indicators for a clearer view of turning points.
Alternatively, it can also act as an indicator itself, as implied by the corresponding color scheme included in the script.
Although roofing filters are not conventionally used in the analysis of market data, applying such spectral analysis techniques may prove to be quite useful for the design of more efficient indicators and more reliable predictions.
Ehlers Super Passband FilterAs someone hidden my old script that is just what one guy copied from a book from John Ehlers. I rewrite what i read in the book.
I also found this. So i rewrite this to the guys that was using it. If it hiddes again i will just keep it to myself and downgrade my plan in this TV
// Ehlers Super Passband Filter script may be freely distributed under the MIT license.
// Ehlers Super Passband Filter script may be freely distributed under the MIT license.
// Ehlers Super Passband Filter script may be freely distributed under the MIT license.
// Ehlers Super Passband Filter script may be freely distributed under the MIT license.
// Ehlers Super Passband Filter script may be freely distributed under the MIT license.
I wrote 5 times to be clear. If you guys dont understand portuguese go to the translator to understand what i am explaining in // inside the code.
Template For Custom FIR Filters - Make Your Moving AverageIntroduction
FIR filters (finite impulse response) are widely used in technical analysis, there is the simple or arithmetic moving average, the triangular, the weighted, the least squares...etc. A FIR filter is characterized by the fact that its impulse response (the output of a filter using an impulse as input) is finite, this mean that the impulse response won't have infinite outputs unlike IIR filters.
They are extremely simple to design to, even without the Fourier transform, this is why i post this template that will let you create custom filters from step responses. Don't hesitate to post your results.
How It Works
Originally you create your filters from the frequency response you want your filter to have, this is because the inverse Fourier transform of the frequency response is the filter impulse response.
After that step you use convolution (convolution is the sum of the product between the signal and the impulse response) and you will have your filter. But we don't have Fourier transforms in pine so how can we possibly make FIR filters from convolution ? Well here the thing, the impulse response is the derivative of the step response and the step response is the sum of the impulse response, this mean we can create filters from step responses.
Step response of a moving average.
Step responses are easy to design, you just need a function that start at 0 and end up at 1.
How To Use The Template
All the work is done for you, the only thing you need to do is to enter your function at line 5 :
f(x)=> your function
For example if you want your filter to have a step response equal to sqrt(x) just enter :
f(x)=> sqrt(x)
This will give the following filter output :
You can create custom step responses from online graphing tools like fooplot or wolfram alpha, i recommend fooplot.
You can also design your filter step response from the line 14/15/16, b will be your filter step response, just use a , for example b = pow(a,2) , then replace output in plot by b and use overlay false, you can also plot step , if you like your step response copy the content of b and paste after f(x) => .
Filter Characteristics
The impulse response determine how many of a certain signal you want in your filter, this is also called weighting, you can think of filter design as cooking where your ingredients are the the signal at different periods and the impulse response determine how many of an ingredient you must include in the recipe. The step response can also tell you about your filter characteristics, for example :
This one converge faster to the step function, this mean that the filter will have less lag.
However this one converge slower to the step function, this mean the filter might have more lag but could be smoother.
Be aware that you must find a good weighting balance, else you can have output equals to the signal or just a delayed version of the signal without smoothing.
Real Case
Lets design a sine weighted moving average (swma), this FIR filter use the first 180 degrees of a sine wave function as impulse response.
Impulse response of the swma.
We can design it from the step response without much problems, remember that the impulse response is the derivative of the step response, therefore the derivative of the step response is equal to the first 180 degrees of a sine wave, the derivative of the cosine function is a sine function, therefore :
f(x)=> .5*(1 - cos(x*pi))
And voila.
Designing A BandPass Filter
The bandpass filter like a low-pass and high pass filter, you can think of it as a smooth oscillator.
To design a bandpass filter your step response must be bell shaped, or starting at 0 and ending at 0, for example :
f(x)=>sin(x*pi) give :
Conclusion
Just use fooplot and experiment, you could get nice filters, i will try to post some using this template but it would be really nice to have other people use it. If you need further help pm me.
Thanks for reading !
Combo Strategy 123 Reversal & Bandpass Filter This is combo strategies for get
a cumulative signal. Result signal will return 1 if two strategies
is long, -1 if all strategies is short and 0 if signals of strategies is not equal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The related article is copyrighted material from
Stocks & Commodities Mar 2010
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
WARNING:
- For purpose educate only
- This script to change bars colors.