Ehlers Band-Pass FilterHeyo,
This indicator is an original translation from Ehlers' book "Cycle Analytics for Traders Advanced".
First, I describe the indicator as usual and later you can find a very insightful quote of the book.
Key Features
Signal Line: Represents the output of the band-pass filter, highlighting the dominant cycle in the data.
Trigger Line: A leading indicator derived from the signal line, providing early signals for potential market reversals.
Dominant Cycle: Measures the dominant cycle period by counting the number of bars between zero crossings of the band-pass filter output.
Calculation:
The band-pass filter is implemented using a combination of high-pass and low-pass filters.
The filter's parameters, such as period and bandwidth, can be adjusted to tune the filter to specific market cycles.
The signal line is normalized using an Automatic Gain Control (AGC) to provide consistent amplitude regardless of price swings.
The trigger line is derived by applying a high-pass filter to the signal line, creating a leading
waveform.
Usage
The indicator is effective in identifying peaks and valleys in the market data.
It works best in cyclic market conditions and may produce false signals during trending periods.
The dominant cycle measurement helps traders understand the prevailing market cycle length, aiding in better decision-making.
Quoted from the Book
Band-Pass Filters
“A little of the data narrowly passed,” said Tom broadly.
Perhaps the least appreciated and most underutilized filter in technical analysis is the band-pass filter. The band-pass filter simultaneously diminishes the amplitude at low frequencies, qualifying it as a detrender, and diminishes the amplitude at high frequencies, qualifying it as a data smoother.
It passes only those frequency components from input to output in which the trader is interested. The filtering produced by a band-pass filter is superior because the rejection in the stop bands is related to its bandwidth. The degree of rejection of undesired frequency components is called selectivity. The band-stop filter is the dual of the band-pass filter. It rejects a band of frequency components as a notch at the output and passes all other frequency components virtually unattenuated. Since the bandwidth of the deep rejection in the notch is relatively narrow and since the spectrum of market cycles is relatively broad due to systemic noise, the band-stop filter has little application in trading.
Measuring the Cycle Period
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 half-bandwidth 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.
Since the measurement of the dominant cycle can vary dramatically from zero crossing to zero
crossing, the code limits the change between measurements to be no more than 25 percent.
While measuring the changing dominant cycle period via zero crossings of the band-pass waveform is easy, it is not necessarily the most accurate method.
Best regards,
simwai
Good Luck with your trading! 🙌
Digitalsignalfilter
MLExtensionsLibrary "MLExtensions"
normalizeDeriv(src, quadraticMeanLength)
Returns the smoothed hyperbolic tangent of the input series.
Parameters:
src : The input series (i.e., the first-order derivative for price).
quadraticMeanLength : The length of the quadratic mean (RMS).
Returns: nDeriv The normalized derivative of the input series.
normalize(src, min, max)
Rescales a source value with an unbounded range to a target range.
Parameters:
src : The input series
min : The minimum value of the unbounded range
max : The maximum value of the unbounded range
Returns: The normalized series
rescale(src, oldMin, oldMax, newMin, newMax)
Rescales a source value with a bounded range to anther bounded range
Parameters:
src : The input series
oldMin : The minimum value of the range to rescale from
oldMax : The maximum value of the range to rescale from
newMin : The minimum value of the range to rescale to
newMax : The maximum value of the range to rescale to
Returns: The rescaled series
color_green(prediction)
Assigns varying shades of the color green based on the KNN classification
Parameters:
prediction : Value (int|float) of the prediction
Returns: color
color_red(prediction)
Assigns varying shades of the color red based on the KNN classification
Parameters:
prediction : Value of the prediction
Returns: color
tanh(src)
Returns the the hyperbolic tangent of the input series. The sigmoid-like hyperbolic tangent function is used to compress the input to a value between -1 and 1.
Parameters:
src : The input series (i.e., the normalized derivative).
Returns: tanh The hyperbolic tangent of the input series.
dualPoleFilter(src, lookback)
Returns the smoothed hyperbolic tangent of the input series.
Parameters:
src : The input series (i.e., the hyperbolic tangent).
lookback : The lookback window for the smoothing.
Returns: filter The smoothed hyperbolic tangent of the input series.
tanhTransform(src, smoothingFrequency, quadraticMeanLength)
Returns the tanh transform of the input series.
Parameters:
src : The input series (i.e., the result of the tanh calculation).
smoothingFrequency
quadraticMeanLength
Returns: signal The smoothed hyperbolic tangent transform of the input series.
n_rsi(src, n1, n2)
Returns the normalized RSI ideal for use in ML algorithms.
Parameters:
src : The input series (i.e., the result of the RSI calculation).
n1 : The length of the RSI.
n2 : The smoothing length of the RSI.
Returns: signal The normalized RSI.
n_cci(src, n1, n2)
Returns the normalized CCI ideal for use in ML algorithms.
Parameters:
src : The input series (i.e., the result of the CCI calculation).
n1 : The length of the CCI.
n2 : The smoothing length of the CCI.
Returns: signal The normalized CCI.
n_wt(src, n1, n2)
Returns the normalized WaveTrend Classic series ideal for use in ML algorithms.
Parameters:
src : The input series (i.e., the result of the WaveTrend Classic calculation).
n1
n2
Returns: signal The normalized WaveTrend Classic series.
n_adx(highSrc, lowSrc, closeSrc, n1)
Returns the normalized ADX ideal for use in ML algorithms.
Parameters:
highSrc : The input series for the high price.
lowSrc : The input series for the low price.
closeSrc : The input series for the close price.
n1 : The length of the ADX.
regime_filter(src, threshold, useRegimeFilter)
Parameters:
src
threshold
useRegimeFilter
filter_adx(src, length, adxThreshold, useAdxFilter)
filter_adx
Parameters:
src : The source series.
length : The length of the ADX.
adxThreshold : The ADX threshold.
useAdxFilter : Whether to use the ADX filter.
Returns: The ADX.
filter_volatility(minLength, maxLength, useVolatilityFilter)
filter_volatility
Parameters:
minLength : The minimum length of the ATR.
maxLength : The maximum length of the ATR.
useVolatilityFilter : Whether to use the volatility filter.
Returns: Boolean indicating whether or not to let the signal pass through the filter.
backtest(high, low, open, startLongTrade, endLongTrade, startShortTrade, endShortTrade, isStopLossHit, maxBarsBackIndex, thisBarIndex)
Performs a basic backtest using the specified parameters and conditions.
Parameters:
high : The input series for the high price.
low : The input series for the low price.
open : The input series for the open price.
startLongTrade : The series of conditions that indicate the start of a long trade.`
endLongTrade : The series of conditions that indicate the end of a long trade.
startShortTrade : The series of conditions that indicate the start of a short trade.
endShortTrade : The series of conditions that indicate the end of a short trade.
isStopLossHit : The stop loss hit indicator.
maxBarsBackIndex : The maximum number of bars to go back in the backtest.
thisBarIndex : The current bar index.
Returns: A tuple containing backtest values
init_table()
init_table()
Returns: tbl The backtest results.
update_table(tbl, tradeStatsHeader, totalTrades, totalWins, totalLosses, winLossRatio, winrate, stopLosses)
update_table(tbl, tradeStats)
Parameters:
tbl : The backtest results table.
tradeStatsHeader : The trade stats header.
totalTrades : The total number of trades.
totalWins : The total number of wins.
totalLosses : The total number of losses.
winLossRatio : The win loss ratio.
winrate : The winrate.
stopLosses : The total number of stop losses.
Returns: Updated backtest results table.
FATL, SATL, RFTL, & RSTL Digital Filters Raw [Loxx]FATL, SATL, RFTL, & RSTL Digital Filters Raw is an indicator to showcase FATL, SATL, RFTL, & RSTL Digital Filters with their raw output values. The coefficients used here are for an idealized environment. This is tuned for Forex.
What is FATL?
FATL (Fast Adaptive Trend Line) is calculated using low frequency digital filter (FLF-1).
FLF-1 filter is necessary for high frequency noises suppression and reduction of market cycles with a very short volatility periods that can also be considered as a noise.
Filters of low frequency FLF-1 and FLF-2 provide attenuation in the stop band with no less than 40 dB and absolutely don’t distort the amplitude and phase of entry discontinuous price series in the pass band (bandwidth). These properties of the digital filters provide significantly improved (in comparison with simple moving average) noise suppression that in its turn allows reducing sharply the probability of appearance "false" signals for buy and sell.
There are no analogues to FATL among widely known technical instruments. It is not a moving "average", but just the adaptive lines estimates of the short-term trends. Unlike moving "average", FATL has no any phase delay with regard to current prices.
What is SATL?
Slow Adaptive Trend Line (SATL) is formed with the digital filter of the low frequency FLF-2.
Filter FLF-2 serves to suppress noises and market cycles with longer periods of oscillation. Filters of low frequency FLF-1 and FLF-2 provide attenuation in the stop band with no less than 40 dB and absolutely don’t distort the amplitude and phase of entry discontinuous price series in the pass band (bandwidth).
These properties of the digital filters provide significantly improved (in comparison with simple moving average) noise suppression that in its turn allows reducing sharply the probability of appearance of "false" signals for purchase and sell.
There are no analogues to SATL among widely known technical instruments. This is not a moving "average", but just the adaptive line estimate of a long-term trend.
Unlike moving average, SATL has no any phase delay with regard to current prices.
What is RFTL?
Reference Fast Trend Line (RFTL) is a response of FLF-1 and FLF-2 digital filters to the input discrete sequence. This response is set with the delay equal to the Nyquist TNi range.
RFTL reference line is an equivalent of simple moving "averages" from the viewpoint of their delay relative to the current prices. Mentioned similarity would have been complete, in case we use an impulse parameter having 1/N weights that corresponds to the procedure of the dotted moving smoothing instead of the complicated FLF impulse parameters.
What is RSTL?
Reference Slow Trend Line (RSTL) is a response of the SATL digital filter to the series of input prices with a delay equal to the Nyquist interval of 1/2F.
Jurik Filtered Perfect CCI (PCCI) [Loxx]Jurik Filtered Perfect CCI (PCCI) is a faster and more accurate version of CCI with Jurik Filtering.
What is the PCCI (Perfect Commodity Channel Index)?
PCCI (Perfect Commodity Channel Index) indicator is calculated by the following formula:
PCCI(bar) = close(bar) – DF(bar)
PCCI resembles D. Lambert's Commodity Channel Index by the method of its calculation.
Actually, CCI index is calculated as a normalized difference between the current price and its moving average. PCCI is calculated as a difference between a day closing price and its statistical expectation presented by a Digital Fitler value. Therefore, PCCI is more efficient than CCI.
PCCI index is a high frequency part of the exchange rate fluctuations normalized according to its standard deviation.
What is Jurik Volty used in the Juirk Filter?
One of the lesser known qualities of Juirk smoothing is that the Jurik smoothing process is adaptive. "Jurik Volty" (a sort of market volatility ) is what makes Jurik smoothing adaptive. The Jurik Volty calculation can be used as both a standalone indicator and to smooth other indicators that you wish to make adaptive.
What is the Jurik Moving Average?
Have you noticed how moving averages add some lag (delay) to your signals? ... especially when price gaps up or down in a big move, and you are waiting for your moving average to catch up? Wait no more! JMA eliminates this problem forever and gives you the best of both worlds: low lag and smooth lines.
Ideally, you would like a filtered signal to be both smooth and lag-free. Lag causes delays in your trades, and increasing lag in your indicators typically result in lower profits. In other words, late comers get what's left on the table after the feast has already begun.
Included:
-Bar coloring
loxxfsrrdspfiltsLibrary "loxxfsrrdspfilts"
loxxfsrrdspfilts : FATL, SATL, RFTL, & RSTL Digital Signal Filters
fatl(src)
fatl
Parameters:
src : float
Returns: result float
rftl(src)
rftl
Parameters:
src : float
Returns: result float
satl(src)
satl
Parameters:
src : float
Returns: result float
rstl(src)
rstl
Parameters:
src : float
Returns: result float
FATL, SATL, RFTL, & RSTL Digital Signal Filter Smoother [Loxx]FATL, SATL, RFTL, & RSTL Digital Signal Filter (DSP) Smoother is is a baseline indicator with DSP processed source inputs
What are digital indicators: distinctions from standard tools, types of filters.
To date, dozens of technical analysis indicators have been developed: trend instruments, oscillators, etc. Most of them use the method of averaging historical data, which is considered crude. But there is another group of tools - digital indicators developed on the basis of mathematical methods of spectral analysis. Their formula allows the trader to filter price noise accurately and exclude occasional surges, making the forecast more effective in comparison with conventional indicators. In this review, you will learn about their distinctions, advantages, types of digital indicators and examples of strategies based on them.
Two non-standard strategies based on digital indicators
Basic technical analysis indicators built into most platforms are based on mathematical formulas. These formulas are a reflection of market behavior in past periods. In other words, these indicators are built based on patterns that were discovered as a result of statistical analysis, which allows one to predict further trend movement to some extent. But there is also a group of indicators called digital indicators. They are developed using mathematical analysis and are an algorithmic spectral system called ATCF (Adaptive Trend & Cycles Following). In this article, I will tell you more about the components of this system, describe the differences between digital and regular indicators, and give examples of 2 strategies with indicator templates.
ATCF - Market Spectrum Analysis Method
There is a theory according to which the market is chaotic and unpredictable, i.e. it cannot be accurately analyzed. After all, no one can tell how traders will react to certain news, or whether some large investor will want to play against the market like George Soros did with the Bank of England. But there is another theory: many general market trends are logical, and have a rationale, causes and effects. The economy is undulating, which means it can be described by mathematical methods.
Digital indicators are defined as a group of algorithms for assessing the market situation, which are based exclusively on mathematical methods. They differ from standard indicators by the form of analysis display. They display certain values: price, smoothed price, volumes. Many standard indicators are built on the basis of filtering the minute significant price fluctuations with the help of moving averages and their variations. But we can hardly call the MA a good filter, because digital indicators that use spectral filters make it possible to do a more accurate calculation.
Simply put, digital indicators are technical analysis tools in which spectral filters are used to filter out price noise instead of moving averages.
The display of traditional indicators is lines, areas, and channels. Digital indicators can be displayed both in the form of lines and in digital form (a set of numbers in columns, any data in a text field, etc.). The digital display of the data is more like an additional source of statistics; for trading, a standard visual linear chart view is used.
All digital models belong to the category of spectral analysis of the market situation. In conventional technical indicators, price indications are averaged over a fixed period of time, which gives a rather rough result. The use of spectral analysis allows us to increase trading efficiency due to the fact that digital indicators use a statistical data set of past periods, which is converted into a “frequency” of the market (period of fluctuations).
Fourier theory provides the following spectral ranging of the trend duration:
low frequency range (0-4) - a reflection of a long trend of 2 months or more
medium frequency range (5-40) - the trend lasts 10-60 days, thus it is referred to as a correction
high frequency range (41-130) - price noise that lasts for several days
The ATCF algorithm is built on the basis of spectral analysis and includes a set of indicators created using digital filters. Its consists of indicators and filters:
FATL: Built on the basis of a low-frequency digital trend filter
SATL: Built on the basis of a low-frequency digital trend filter of a different order
RFTL: High frequency trend line
RSTL: Low frequency trend line
Inclucded:
4 DSP filters
Bar coloring
Keltner channels with variety ranges and smoothing functions
Bollinger bands
40 Smoothing filters
33 souce types
Variable channels