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
Ehlers
predictive_moving_average
Description:
Originated by John F. Ehlers, could be found within (Rocket Science for Traders, pg. 212). Aim to provide a leading indicator (I assumed for the shorter time period), which smoothed the price with no lag. The indicator derives from 2 lines crossing i.e. a weighted moving average, of higher length as a predictor and shorter length as a trigger.
Predictive Moving Average:
predict = 2*wma1 - wma2
trigger = (4*predict+3*predict +2*predict +predict)/10
Feature:
Predictive moving average
Deviation band
Notes
Consider the support/resistance (dynamic) when entering the position
Some short direction change might be identified from deviation shrink
Green indicates to enter/long, while red indicates to close/short position
TASC 2022.06 Ehlers Loops█ OVERVIEW
TASC's June 2022 edition Traders' Tips includes an article by John Ehlers titled "Ehlers Loops. Part 1". This is the code implementing the price-volume Ehlers Loops he introduced in the publication.
█ CONCEPTS
John Ehlers developed Ehlers loops as a tool to visualize the performance of one data stream versus another, both filtered and scaled. In this article, the author applies his concept to exploit and/or dispel the dogmatic principles of reliable price-volume relationships.
The script offers two different ways to visualize Ehlers Loops:
Oscillators (default option)
In this implementation, filtered and scaled volume is plotted along with filtered and scaled price as zero-mean oscillators. Observation of the relative direction of volume and price oscillators can be discretionarily used to interpret and predict market conditions. For example, it is generally assumed that an increase in volume and an increase in price define a bullish condition. Similarly, decreasing volume and increasing price are generally considered bearish. A decrease in volume and a decrease in price is considered a bullish condition. The increase in volume and decrease in price is often thought to be bearish.
Scatterplot
This Crocker-style visualization displays filtered and scaled price against filtered and scaled volume for the selected timespan. Fluctuations in volume are plotted along the x -axis, while price changes along the y -axis. This way of visualizing the Ehlers Loop allows you to analyze the curvature and directional path of the price in relation to volume, offering a different comparative perspective. The boundaries of the price and volume scale on the Ehlers Loop Crocker-chart are presented in standard deviations. Deviations can be used to predict possible future price or volume fluctuations. The expected probability of potential reversals is 68%, 95% and 99.7% at one, two and three standard deviations, respectively.
█ CALCULATIONS
The following steps are used to build an Ehlers Loop:
• Both price and volume are filtered to be band-limited signals. This is done by applying the high-pass Butterworth filter in combination with the low-pass SuperSmooth filter.
The cutoff wavelengths of the high-pass and low-pass filters are defined by the input parameters HPPeriod and LPPeriod , respectively.
These values change the appearance of the Ehlers Loops and can be customized to your trading style.
• The filtered price and volume time series are then scaled in terms of standard deviation by dividing each by their root-mean-square values.
• The resultant price and volume data are plotted as zero-mean oscillators or as a scatterplot.
COG SSMACD COL combo with ADX Filter [orion35]This indicator consists of a combination of indicators produced by the most valuable developers in the market.
These are: Center of Gravity (COG) and Super Smoothed MACD (SSMACD) shared by @KivancOzbilgic and Center of Linearity (COL) shared by @alexgrover
I produced this indicator by writing new conditions that compare the signals given by these indicators with each other. I re-coded the change in the thickness of the cloud from the COL indicator as the middle horizontal line with varying color intensity and type. I have provided options for switching between these three indicators when desired.
Note: The strongest signals in the indicator are the blue colored triangles. Moderately strong ones are yellow signals. White colored signals are considered as the weakest signals.
Some minor fixes:
Some confusing words were thrown in the alarms section,
Added new alarm codes for any Triple or Double signals.
Major changes have been made with this update.
It is very important to know the direction and strength of the trend in financial markets. Therefore, ADX (Average Directional movement index) was developed by J. Welles Wilder in 1978 as an indicator of the trend strength in the prices of a financial instrument.
Especially in sideways markets, most indicators produce many false signals. However, these signals can be filtered with the ADX indicator. The price is considered sideways when the ADX is less than 20 as the threshold value.
With this update,
ADX filter can be activated when desired, and signals can be filtered flexibly according to the "threshold" value determined by the user. When the ADX filter is active, it will also reflect on the alarm conditions. Therefore, if an alarm is to be set according to the ADX filter, the filter must be activated first.
The colors of the lines and signals have been made changeable.
The visual level and thickness of the COL line has been made adjustable.
With this update, signals can be filtered according to the MavilimW indicator developed by @KivancOzbilgic
Filter Methods:
Normal: If the price is below the BlueW line, "bull" signals are filtered out, and above "bear" signals are filtered out.
Reverse : Applies the opposite of the normal method.
Fixed some visual bugs in switching between indicators.
Adaptive MA Difference constructor [lastguru]A complimentary indicator to my Adaptive MA constructor. It calculates the difference between the two MA lines (inspired by the Moving Average Difference (MAD) indicator by John F. Ehlers). You can then further smooth the resulting curve. The parameters and options are explained here:
The difference is normalized by dividing the difference by twice its Root mean square (RMS) over Slow MA length. Inverse Fisher Transform is then used to force the -1..1 range.
Same Postfilter options are provided as in my Adaptive Oscillator constructor:
Stochastic - Stochastic
Super Smooth Stochastic - Super Smooth Stochastic (part of MESA Stochastic ) by John F. Ehlers
Inverse Fisher Transform - Inverse Fisher Transform
Noise Elimination Technology - a simplified Kendall correlation algorithm "Noise Elimination Technology" by John F. Ehlers
Momentum - momentum (derivative)
Except for Inverse Fisher Transform, all Postfilter algorithms can have Length parameter. If it is not specified (set to 0), then the calculated Slow MA Length is used.
Adaptive Oscillator constructor [lastguru]Adaptive Oscillators use the same principle as Adaptive Moving Averages. This is an experiment to separate length generation from oscillators, offering multiple alternatives to be combined. Some of the combinations are widely known, some are not. Note that all Oscillators here are normalized to -1..1 range. This indicator is based on my previously published public libraries and also serve as a usage demonstration for them. I will try to expand the collection (suggestions are welcome), however it is not meant as an encyclopaedic resource , so you are encouraged to experiment yourself: by looking on the source code of this indicator, I am sure you will see how trivial it is to use the provided libraries and expand them with your own ideas and combinations. I give no recommendation on what settings to use, but if you find some useful setting, combination or application ideas (or bugs in my code), I would be happy to read about them in the comments section.
The indicator works in three stages: Prefiltering, Length Adaptation and Oscillators.
Prefiltering is a fast smoothing to get rid of high-frequency (2, 3 or 4 bar) noise.
Adaptation algorithms are roughly subdivided in two categories: classic Length Adaptations and Cycle Estimators (they are also implemented in separate libraries), all are selected in Adaptation dropdown. Length Adaptation used in the Adaptive Moving Averages and the Adaptive Oscillators try to follow price movements and accelerate/decelerate accordingly (usually quite rapidly with a huge range). Cycle Estimators, on the other hand, try to measure the cycle period of the current market, which does not reflect price movement or the rate of change (the rate of change may also differ depending on the cycle phase, but the cycle period itself usually changes slowly).
Chande (Price) - based on Chande's Dynamic Momentum Index (CDMI or DYMOI), which is dynamic RSI with this length
Chande (Volume) - a variant of Chande's algorithm, where volume is used instead of price
VIDYA - based on VIDYA algorithm. The period oscillates from the Lower Bound up (slow)
VIDYA-RS - based on Vitali Apirine's modification of VIDYA algorithm (he calls it Relative Strength Moving Average). The period oscillates from the Upper Bound down (fast)
Kaufman Efficiency Scaling - based on Efficiency Ratio calculation originally used in KAMA
Deviation Scaling - based on DSSS by John F. Ehlers
Median Average - based on Median Average Adaptive Filter by John F. Ehlers
Fractal Adaptation - based on FRAMA by John F. Ehlers
MESA MAMA Alpha - based on MESA Adaptive Moving Average by John F. Ehlers
MESA MAMA Cycle - based on MESA Adaptive Moving Average by John F. Ehlers , but unlike Alpha calculation, this adaptation estimates cycle period
Pearson Autocorrelation* - based on Pearson Autocorrelation Periodogram by John F. Ehlers
DFT Cycle* - based on Discrete Fourier Transform Spectrum estimator by John F. Ehlers
Phase Accumulation* - based on Dominant Cycle from Phase Accumulation by John F. Ehlers
Length Adaptation usually take two parameters: Bound From (lower bound) and To (upper bound). These are the limits for Adaptation values. Note that the Cycle Estimators marked with asterisks(*) are very computationally intensive, so the bounds should not be set much higher than 50, otherwise you may receive a timeout error (also, it does not seem to be a useful thing to do, but you may correct me if I'm wrong).
The Cycle Estimators marked with asterisks(*) also have 3 checkboxes: HP (Highpass Filter), SS (Super Smoother) and HW (Hann Window). These enable or disable their internal prefilters, which are recommended by their author - John F. Ehlers . I do not know, which combination works best, so you can experiment.
Chande's Adaptations also have 3 additional parameters: SD Length (lookback length of Standard deviation), Smooth (smoothing length of Standard deviation) and Power ( exponent of the length adaptation - lower is smaller variation). These are internal tweaks for the calculation.
Oscillators section offer you a choice of Oscillator algorithms:
Stochastic - Stochastic
Super Smooth Stochastic - Super Smooth Stochastic (part of MESA Stochastic) by John F. Ehlers
CMO - Chande Momentum Oscillator
RSI - Relative Strength Index
Volume-scaled RSI - my own version of RSI. It scales price movements by the proportion of RMS of volume
Momentum RSI - RSI of price momentum
Rocket RSI - inspired by RocketRSI by John F. Ehlers (not an exact implementation)
MFI - Money Flow Index
LRSI - Laguerre RSI by John F. Ehlers
LRSI with Fractal Energy - a combo oscillator that uses Fractal Energy to tune LRSI gamma
Fractal Energy - Fractal Energy or Choppiness Index by E. W. Dreiss
Efficiency ratio - based on Kaufman Adaptive Moving Average calculation
DMI - Directional Movement Index (only ADX is drawn)
Fast DMI - same as DMI, but without secondary smoothing
If no Adaptation is selected (None option), you can set Length directly. If an Adaptation is selected, then Cycle multiplier can be set.
Before an Oscillator, a High Pass filter may be executed to remove cyclic components longer than the provided Highpass Length (no High Pass filter, if Highpass Length = 0). Both before and after the Oscillator a Moving Average can be applied. The following Moving Averages are included: SMA, RMA, EMA, HMA , VWMA, 2-pole Super Smoother, 3-pole Super Smoother, Filt11, Triangle Window, Hamming Window, Hann Window, Lowpass, DSSS. For more details on these Moving Averages, you can check my other Adaptive Constructor indicator:
The Oscillator output may be renormalized and postprocessed with the following Normalization algorithms:
Stochastic - Stochastic
Super Smooth Stochastic - Super Smooth Stochastic (part of MESA Stochastic) by John F. Ehlers
Inverse Fisher Transform - Inverse Fisher Transform
Noise Elimination Technology - a simplified Kendall correlation algorithm "Noise Elimination Technology" by John F. Ehlers
Except for Inverse Fisher Transform, all Normalization algorithms can have Length parameter. If it is not specified (set to 0), then the calculated Oscillator length is used.
More information on the algorithms is given in the code for the libraries used. I am also very grateful to other TradingView community members (they are also mentioned in the library code) without whom this script would not have been possible.
Adaptive MA constructor [lastguru]Adaptive Moving Averages are nothing new, however most of them use EMA as their MA of choice once the preferred smoothing length is determined. I have decided to make an experiment and separate length generation from smoothing, offering multiple alternatives to be combined. Some of the combinations are widely known, some are not. This indicator is based on my previously published public libraries and also serve as a usage demonstration for them. I will try to expand the collection (suggestions are welcome), however it is not meant as an encyclopaedic resource, so you are encouraged to experiment yourself: by looking on the source code of this indicator, I am sure you will see how trivial it is to use the provided libraries and expand them with your own ideas and combinations. I give no recommendation on what settings to use, but if you find some useful setting, combination or application ideas (or bugs in my code), I would be happy to read about them in the comments section.
The indicator works in three stages: Prefiltering, Length Adaptation and Moving Averages.
Prefiltering is a fast smoothing to get rid of high-frequency (2, 3 or 4 bar) noise.
Adaptation algorithms are roughly subdivided in two categories: classic Length Adaptations and Cycle Estimators (they are also implemented in separate libraries), all are selected in Adaptation dropdown. Length Adaptation used in the Adaptive Moving Averages and the Adaptive Oscillators try to follow price movements and accelerate/decelerate accordingly (usually quite rapidly with a huge range). Cycle Estimators, on the other hand, try to measure the cycle period of the current market, which does not reflect price movement or the rate of change (the rate of change may also differ depending on the cycle phase, but the cycle period itself usually changes slowly).
Chande (Price) - based on Chande's Dynamic Momentum Index (CDMI or DYMOI), which is dynamic RSI with this length
Chande (Volume) - a variant of Chande's algorithm, where volume is used instead of price
VIDYA - based on VIDYA algorithm. The period oscillates from the Lower Bound up (slow)
VIDYA-RS - based on Vitali Apirine's modification of VIDYA algorithm (he calls it Relative Strength Moving Average). The period oscillates from the Upper Bound down (fast)
Kaufman Efficiency Scaling - based on Efficiency Ratio calculation originally used in KAMA
Deviation Scaling - based on DSSS by John F. Ehlers
Median Average - based on Median Average Adaptive Filter by John F. Ehlers
Fractal Adaptation - based on FRAMA by John F. Ehlers
MESA MAMA Alpha - based on MESA Adaptive Moving Average by John F. Ehlers
MESA MAMA Cycle - based on MESA Adaptive Moving Average by John F. Ehlers, but unlike Alpha calculation, this adaptation estimates cycle period
Pearson Autocorrelation* - based on Pearson Autocorrelation Periodogram by John F. Ehlers
DFT Cycle* - based on Discrete Fourier Transform Spectrum estimator by John F. Ehlers
Phase Accumulation* - based on Dominant Cycle from Phase Accumulation by John F. Ehlers
Length Adaptation usually take two parameters: Bound From (lower bound) and To (upper bound). These are the limits for Adaptation values. Note that the Cycle Estimators marked with asterisks(*) are very computationally intensive, so the bounds should not be set much higher than 50, otherwise you may receive a timeout error (also, it does not seem to be a useful thing to do, but you may correct me if I'm wrong).
The Cycle Estimators marked with asterisks(*) also have 3 checkboxes: HP (Highpass Filter), SS (Super Smoother) and HW (Hann Window). These enable or disable their internal prefilters, which are recommended by their author - John F. Ehlers. I do not know, which combination works best, so you can experiment.
Chande's Adaptations also have 3 additional parameters: SD Length (lookback length of Standard deviation), Smooth (smoothing length of Standard deviation) and Power (exponent of the length adaptation - lower is smaller variation). These are internal tweaks for the calculation.
Length Adaptaton section offer you a choice of Moving Average algorithms. Most of the Adaptations are originally used with EMA, so this is a good starting point for exploration.
SMA - Simple Moving Average
RMA - Running Moving Average
EMA - Exponential Moving Average
HMA - Hull Moving Average
VWMA - Volume Weighted Moving Average
2-pole Super Smoother - 2-pole Super Smoother by John F. Ehlers
3-pole Super Smoother - 3-pole Super Smoother by John F. Ehlers
Filt11 -a variant of 2-pole Super Smoother with error averaging for zero-lag response by John F. Ehlers
Triangle Window - Triangle Window Filter by John F. Ehlers
Hamming Window - Hamming Window Filter by John F. Ehlers
Hann Window - Hann Window Filter by John F. Ehlers
Lowpass - removes cyclic components shorter than length (Price - Highpass)
DSSS - Derivation Scaled Super Smoother by John F. Ehlers
There are two Moving Averages that are drown on the chart, so length for both needs to be selected. If no Adaptation is selected ( None option), you can set Fast Length and Slow Length directly. If an Adaptation is selected, then Cycle multiplier can be selected for Fast and Slow MA.
More information on the algorithms is given in the code for the libraries used. I am also very grateful to other TradingView community members (they are also mentioned in the library code) without whom this script would not have been possible.
Leading Indicator [TH]The leading indicator is helpful to identify early entries and exits (especially near support and resistance).
Green = trend up
Red = trend down
How it works:
The leading indicator calculates the difference between price and an exponential moving average.
Adding the difference creates a negative lag relative to the original function.
Negative lag is what makes this a leading indicator.
The amount of lead is exactly equal to the amount of lag of the moving average.
The leading indicator has lagging signals at turning points.
The leading indicator will always have noise gain, which gets eliminated by applying a moving average.
Modifying the alpha values will modify the amount of noise and change the sensitivity of trend change.
Example 1: Changing alpha1 from 0.25 to 0.15 lowers noise, more clearly identifies trend, and adds delay to this indicator.
Example 2: Changing alpha1 from 0.25 to 0.35 increases noise, less clearly identifies trend, BUT more quickly indicates a trend change.
Calculations:
Where:
alpha1 = 0.25
alpha2 = 0.33
Leading = 2 * (arithmetical mean of current High and Low price) + (alpha1 - 2) * (arithmetical mean of previous High and Low price) + (1 - alpha1) * (previous 'Leading' value)
Total Leading = alpha2 * leading + (1 - alpha2) * (previous 'Total Leading' value)
EMA = 0.5 * (arithmetical mean of previous High and Low price) + 0.5 * (previous 'EMA' value)
Uptrend when 'Total Leading' value is greator than the EMA
Downtrend when 'Total Leading' value is lesser than the EMA
Cybernetic Analysis for Stocks and Futures, by John Ehlers (page 231-235)
Ehlers Triangle Moving Average [CC]The Triangle Moving Average is the last of custom scripts converting Ehlers Window Indicators to Moving Averages. As you can see this is actually very similar to the Hamming Moving Average and the Hann Moving Average so I would recommend to test this one out with different settings and see what works best for you. As far as the formula calculation, it is a custom weighted moving average that determines how close the price is compared to the middle of the length period and gives a custom weight to that price. For example it will assign heavier weights according to how close the price is to the beginning of the loop (which is the most recent data) and lighter weights, the further the price is away from the recent prices. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
Ehlers Hamming Moving Average [CC]The Hamming Moving Average is a custom script I made to attempt to create a moving average using Ehler's Hamming Window Indicator . Let me stress that this is extremely experimental considering the original indicator works by creating a sine wave by adjusting the Pedestal value. Change the Pedestal value to anything 5 or higher and you will see what I mean. I think this is a fun experiment so let me know what you think. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
Ehlers Hann Moving Average [CC]The Hann Moving Average is an original script but a slightly modified version of the Hann Window Filter created by John Ehlers. I am using the same length but changed the default data source to use the new Weighted Close that tv added after I requested it awhile ago so thank you tv! The big strength of this moving average/filter is that it creates an extremely smooth filter with the added benefit of very little lag to smooth ratio. The weakness of this moving average/filter is that it does have a decent amount of lag which means it isn't as useful during choppy periods but does work well for sustained uptrends or downtrends. Feel free to experiment and let me know what settings work better for you. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
[blackcat] L2 Hann Ehanced DMILevel: 2
Background
Among the many indicators, it can be said that DMI is the only "super turning" indicator. This indicator can alone send out risk warning signals when extreme market conditions occur in the stock market, helping us to solve some problems.
If we can operate according to the instructions of DMI, firstly, we can avoid the mistake of buying stocks at the head. Secondly, in the process of falling fear of the market, we can follow the direction signal sent by DMI and catch every time on the way down. Opportunity to rebound to unwind.
If you look at the diagram of the DMI, you will think it is very complicated, because there are four lines in its diagram, and they are intertwined, and it is difficult to distinguish the complex signals in it. But don't worry about its complex structure, we will fully dissect this indicator.
Function
These four lines are: PDI, MDI, ADX and ADXR. The scale of the table is from 0-100, which means from very weak to very strong. The PDI curve and MDI curve on some software are called +DI curve and -DI curve , all have the same meaning.
PDI: Represents the position of multiple parties in the market.
In market movements, the higher the PDI, the stronger the current market. On the contrary, it is a weak market. The A-share market is easy to go to extremes. Therefore, we can see that in the past A-share market, the PDI sometimes fell to near zero, and at this time, it often indicated that a rebound and uptrend was about to start.
MDI: Represents the position of the bears in the market.
In the market movement, the higher the MDI goes, the weaker the current market is, and vice versa, it is a strong market. Before a big bull market comes, we can see the MDI drop to a position close to zero, and at this time, the bears in the market have no power to fight back.
The relationship between PDI and MDI:
In the operation of the market, PDI and MDI are intertwined with each other. If the PDI is above the MDI, the market at this time is a strong market. The MDI is above the PDI, which is a bear market. The closer the distance between the two, the market is in a stalemate of consolidation. On the contrary, the further apart the two lines are, the more obvious the unilateral nature of the market is, whether it is a bull market or a bear market. The so-called unilateral market means that there is no midway adjustment when it rises, and there is no rebound correction when it falls.
ADX: Fast steering pullback.
The difference between ADX and other analysis indicators is that whether it is rising or falling, as long as there is a unilateral market, it runs upwards, not like other indicators, the strong market runs upwards and the weak market runs downwards.
The thread is almost entwined with PDI and MDI in general market movement, which makes no sense at this time. However, once the market breaks out of the market and starts to go to extremes, whether the market is rising or falling, ADX will start to run upwards. At this time, ADX has a clear meaning, because DMI has begun to issue early warning of impending turn!
ADXR: slow pull back.
This line is matched to ADX and is a moving average of ADX values. When ADX goes up, ADXR goes up with it, just slower.
When a round of rapid decline ends, it usually needs to be corrected by a rebound, and ADX will take the lead in turning up. Once it crosses with ADXR, it is regarded as an effective breakthrough.
Numerical division. I set an input threshold for HEDMI, and users can set the optimal threshold to buy and sell according to different TFs.
When PDI crosses the threshold, no matter how strong the bull market is, we must beware of risks from happening at any time.
In order to distinguish more clearly, I slightly modified the formula of the system, and when this happens, the indicator will issue a green warning label, so as to avoid risks in time.
Comprehensive use of four lines:
If the four lines in the steering indicator DMI are intertwined below 50, it usually means that the market is in a state of mild consolidation at this time. The DMI indicator at this time is useless because it does not generate a strong pullback force. Don't worry about an unexpected turnaround in the market. As for the consolidation, it's not a turnaround, it's a breakout.
When PDI and MDI gradually separate, at this time, ADX and ADXR will also rise. At this time, the DIM that is usually messy like twine will be clearly separated. When rising, PDI rises along with ADX and ADXR, while MDI sinks weakly. On the contrary, when the market starts to fall, MDI will rise along with ADX and ADXR, and PDI will sink helplessly. At this time, the DMI will be like a "tiger's mouth", gradually opening its bloody mouth. The bigger the opening, the more lethal the bite.
Here comes a tactic, or technical trend, called double hooves, that is, PDI and MDI split, ADX and ADXR upward to produce golden forks, PDI and MDI are like the double front hooves of a horse, ADX and ADXR The golden fork is like the rear hooves of a steed ready to take off, and this trend of the four lines is like the four legs of a steed that is about to run.
If you think it is too complicated to look at DMI like this, then I can tell you the easiest way to judge, that is, just look at the PDI line. When the PDI line falls below 10, boldly buy the dip, because it is a dip, so you need to calculate the rebound At this time, combined with the golden section theory I often talk about, you can easily find the selling point by making the golden section of the downward trend for the previous trend.
This kind of bottom-hunting method uses the golden section theory, and basically there will be no losses. Remember that one thing is not to be greedy and strictly enforce discipline. This is bottom-hunting, and advancing with both hooves is chasing up. The two styles are different, and the operation styles are different. You also need to explore more in actual combat. Any kind of trick, if you practice it proficiently, it is a unique trick.
Remark
Hanning Window Enhanced DMI
Free and Open Source Indicator
Detrended Ehlers Leading Indicator [CC]The Detrended Ehlers Leading Indicator was created by Bill Mars based off of Ehlers work and this is his attempt to create a leading indicator based on the previous Detrended Synthetic Price . I will be honest that this is a bit of a strange script because it is an indicator based off of the detrended synthetic price which is based off of Ehlers work so I haven't found clear buy and sell signals so I'm open to suggestions. His suggestion for buy and sell signals is to only buy and sell at the indicator crossings but haven't found buy and sell logic that I'm sure about. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
windowing_taAll Signals Are the Sum of Sines. When looking at real-world signals, you usually view them as a price changing over time. This is referred to as the time domain. Fourier’s theorem states that any waveform in the time domain can be represented by the weighted sum of sines and cosines. For example, take two sine waves, where one is three times as fast as the other–or the frequency is 1/3 the first signal. When you add them, you can see you get a different signal.
Although performing an FFT on a signal can provide great insight, it is important to know the limitations of the FFT and how to improve the signal clarity using windowing. When you use the FFT to measure the frequency component of a signal, you are basing the analysis on a finite set of data. The actual FFT transform assumes that it is a finite data set, a continuous spectrum that is one period of a periodic signal. For the FFT, both the time domain and the frequency domain are circular topologies, so the two endpoints of the time waveform are interpreted as though they were connected together. When the measured signal is periodic and an integer number of periods fill the acquisition time interval, the FFT turns out fine as it matches this assumption. However, many times, the measured signal isn’t an integer number of periods. Therefore, the finiteness of the measured signal may result in a truncated waveform with different characteristics from the original continuous-time signal, and the finiteness can introduce sharp transition changes into the measured signal. The sharp transitions are discontinuities.
When the number of periods in the acquisition is not an integer, the endpoints are discontinuous. These artificial discontinuities show up in the FFT as high-frequency components not present in the original signal. These frequencies can be much higher than the Nyquist frequency and are aliased between 0 and half of your sampling rate. The spectrum you get by using a FFT, therefore, is not the actual spectrum of the original signal, but a smeared version. It appears as if energy at one frequency leaks into other frequencies. This phenomenon is known as spectral leakage, which causes the fine spectral lines to spread into wider signals.
You can minimize the effects of performing an FFT over a noninteger number of cycles by using a technique called windowing. Windowing reduces the amplitude of the discontinuities at the boundaries of each finite sequence acquired by the digitizer. Windowing consists of multiplying the time record by a finite-length window with an amplitude that varies smoothly and gradually toward zero at the edges. This makes the endpoints of the waveform meet and, therefore, results in a continuous waveform without sharp transitions. This technique is also referred to as applying a window.
Here is a windowing_ta library with J.F Ehlers Windowing functions proposed on Sep, 2021.
Library "windowing_ta"
hann()
hamm()
fir_sma()
fir_triangle()
Detrended Synthetic Price [CC]The Detrended Synthetic Price was created by Bill Mars and this indicator is another undiscovered gem that I have found very useful. He obviously took inspiration from John Ehlers in the creation of this indicator and I would describe this indicator as a combination of a MACD and Ehlers work. This indicator is extremely smooth and gives very clear buy and sell signals. Let me know how this indicator works for you. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
Ehlers Median Average Adaptive Filter [CC]The Median Average Adaptive Filter was created by John Ehlers and this is another in my current series of undiscovered gems. I'm sure you are all saying but Franklin, Ehlers doesn't have any undiscovered gems but in this case you would be wrong. This was actually an indicator so buried on the internet that I had to use the wayback machine to find the original source code. Ehlers notoriously hates adaptive moving averages which is funny because he has made a decent amount of them. This is a very unique indicator that uses a while loop to adjust the length and I thought it deserved some extra recognition from the TV community. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other scripts or indicators you would like to see me publish!
dc_taAdaptive technical indicators are importants in a non stationary market, the ability to adapt to a situation can boost the efficiency of your strategy. A lot of methods have been proposed to make technical indicators "smarters", the dominant cycle tuned indicators are one of them which are based on J.F.Ehlers theory. Here is a collections of algorithms to calculate dominant cycles. ENJOY!
Library "dc_ta"
bton()
EhlersHoDyDC()
EhlersPhAcDC()
EhlersDuDiDC()
EhlersCycPer()
EhlersCycPer2()
EhlersBPZC()
EhlersAutoPer()
EhlersHoDyDCE()
EhlersPhAcDCE()
EhlersDuDiDCE()
EhlersDFTDC()
EhlersDFTDC2()
Ehlers Hann Relative Strength Index [CC]The Hann Relative Strength Index was created by John Ehlers (Stocks and Commodities Jan 2022 pgs 26-28) and this indicator builds upon his Hann Window Indicator to create an unique rsi indicator that doesn't rely on overbought or oversold levels to determine a reversal point and also provides a very superior smoothing without any of the lag associated with traditional smoothing. A much more useful RSI than the standard version in my honest opinion. Short term you buy when the line turns green and sell when it turns red. Medium to long term you buy when the indicator rises above the 0 line and sell when it falls below the 0 line. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color.
Let me know if there are any other indicators or scripts you would like to see me publish!
Ehlers Elegant Oscillator [CC]The Elegant Oscillator was created by John Ehlers (Stocks and Commodities Feb 2022 pg 21) and for those of you who don't know, he introduced the indicators for the Fisher Transform and Inverse Fisher Transform and this is a new updated version to that idea based on his latest research. This uses a soft limiter which he says is superior to a hard limiter. There are several ways to interpret this indicator. First if the indicator is above the 0 line then it is a long term bullish trend and below 0 a long term bearish trend. Second this indicator can be used for reversal points with the peaks and valleys. Finally when the indicator line starts moving higher for example it is a bullish short term trend and vice versa. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
Volume Adaptive Bollinger Bands (MZ VABB)This indicator is a functional enhancement to John Bollinger's Bollinger Bands. I've used Volume to adapt dynamic length which is used in basis (middle line) of Bollinger Bands and Simple Moving Average is replaced with Adaptive Ehlers Deviation Scaled Moving Average ( AEDSMA ).
BOLLINGER BANDS BASIC USAGE AND LIMITATIONS
Bollinger bands are popular among traders because of their simple way to detect volatility in market and redefine support and resistance accordingly. These are some basic usages of original Bollinger Bands:
Most commonly Bollinger Band works on 20 period Simple Moving Average as Basis / Middle Line and standard deviation of 2 for volatility detection.
Upper and lower bands can act as support and resistance which accordingly update with standard deviation of same period as of Simple Moving Average.
As upper and lower bands act as volatility measure which benefits in Squeeze detection and breakout trading.
Among all the usages there are some limitations as follows:
Original Bollinger Bands use 20 period Simple Moving Average as Basis which itself restricted to some number of data pints and if market moves in one direction or simply goes sideways for long time; candles can stay on either bands for long time. This gives benefit for staying in directional trade but will completely nullify the use of both bands as support and resistance.
Above point simply be explained as markets can stay overbought / oversold for long time and one way to make Bollinger Bands more useful is to simply use higher periods in SMA but as we know with higher periods SMA becomes more laggy and less adaptive.
Most traders use BBs alongside some other Volume Oscillator for example "On Balance Volume" but that does solve BBs limitations issue that it should be more adaptive to detect volatility in market.
VOLUME ADAPTIVE BOLLINGER BAND WORKING PRINCIPLE
Best way to make original Bollinger band more adaptive was to just use dynamic length instead on constant 20 period. This dynamic length had to be based on some other powerful parameter which can't be volatility as BB itself is a volatility indicator and adapting its length based volatility would have been superimposing volatility on Bollinger bands giving unrealistic results.
For adaptive length, I tried using Volume and for this purpose I used my Relative Volume Strength Index " RVSI " indicator. RVSI is the best way to detect if Volume is going for a breakout or not and based on that indication length of Bollinger Band Basis Moving Average changes.
RVSI breaking above provided value would indicate Volume breakout and hence dynamic length would accordingly make Bollinger band basis moving average more over fitted and similarly standard deviation of achieved dynamic length would give better bands for support and resistance. Similar case would happen if Volume goes down and dynamic length becomes more underfit.
According to my back testing studies I found that Simple Moving Average wasn't the best choice for dynamic length usage in Bollinger Band Basis. So, I used Adaptive Ehlers Deviation Scaled Moving Average ( AEDSMA ) which is more adaptive and already modified to adapt with RVSI.
SLOPE USAGE FOR TREND STRENGTH DETCTION
Volume Adaptive Bollinger Bands are more reactive to market trends so, I used slope for trend strength detection.
If slope of Volume Adaptive Bollinger Band Basis (i.e. AEDSMA ), Upper and Lower Bands is supporting a trend at same time then script will provide signal in that direction. That signal can also use Volume as confirmation if Bollinger Bands trend direction is supported by Volume or not.
DYNAMIC COLORS AND TREND CORRELATION
I’ve used dynamic coloring in Basis ( AEDSMA ) to identify trends with more detail which are as follows:
Lime Color: Slope supported Strong Uptrend also supported by Volume and Volatility or whatever you’ve chosen from both of them.
Fuchsia Color: Weak uptrend only supported by Slope or whatever you’ve selected.
Red Color: Slope supported Strong Downtrend also supported by Volume and Volatility or whatever you’ve chosen from both of them.
Grey Color: Weak Downtrend only supported by Slope or whatever you’ve selected.
Yellow Color: Possible reversal indication by Slope if enabled. Market is either sideways, consolidating or showing choppiness during that period.
SIGNALS
Green Circle: Market good for long with support of Volume and Volatility or whatever you’ve chosen from both of them.
Red Circle: Market good to short with support from Volume and Volatility or whatever you’ve chosen from both of them.
Flag: Market either touched upper or lower band and can act as good TP and warning for reversal.
FIBONACCI BANDS
I’ve included Fibonacci multiple bands which would act as good support/resistance zones. For example, 0.618 Fib level act as good local support and resistance in both upper and lower zones. Fibonacci values can be modified but should be lower than 1.
DEFAULT SETTINGS
I’ve set default Minimum length to 50 and Maximum length to 100 which I’ve found works best for almost all timeframes but you can change this delta to adapt your timeframe accordingly with more precision.
Dynamic length adoption is enabled based on Volume only but volatility can be selected which is already explained above.
Trend signals are enabled based on Slope and Volume but Volatility can be enabled for more precise confirmations.
In “ RVSI ” settings "Klinger Volume Oscillator" is set to default but others work good too especially Volume Zone Oscillator. For more details about Volume Breakout you can check “MZ RVSI Indicator".
ATR breakout is set to be positive if period 14 exceeds period 46 but can be changed if more adaption with volatility is required.
EDSMA super smoother filter length is set to 20 which can be increased to 50 or more for better smoothing but this will also change slope results accordingly.
EDSMA super smoother filter poles are set to 2 because found better results with 2 instead of 3.
FURTHER ENHANCEMENTS
So far, I've achieved better results with "Klinger Volume Oscillator" in RVSI but TFS Volume Oscillator and On Balance Volume can be used which would change dynamic length differently. It doesn't mean that results would be wrong with some oscillator and precise with others but every oscillator works in its specific way for and RVSI just detect strength of Volume based on provided oscillator.
Adaptive Ehlers Deviation Scaled Moving Average (AEDSMA)AEDSMA INTRODUCTION
This indicator is a functional enhancement to “Ehlers Deviation Scaled Moving Average (EDSMA / DSMA)”. I’ve used Volume Breakout and Volatility for dynamic length adaption and further Slope too for trend evaluation.
EDSMA was originally developed by John F. Ehlers (Stocks & Commodities V. 36:8: The Deviation-Scaled Moving Average).
IDEA PLACEMENT
I’ve traded almost every kind of market with different volatility conditions using Moving Averages. It was too much of a hassle to select and use different MA length depending upon market trend. So, the journey started with adapting Moving Averages with another parameter and that’s how “MZ SAMA ” came into being where Slope was used to adapt Adaptive Moving Average with trend change. The problem was still pretty much the same as SAMA might not be effective on every market condition. Hence, I worked on Volume to adapt Moving Averages accordingly. I cane up with “MZ RVSI ” which I used in “MZ DVAMA ” to adapt dynamic length in Adaptive Moving Average and also used “MZ RVSI " alongside Slope as confirmation of trend changes.
Meanwhile, I started using DVAMA methodology on different types on Moving Averages that allow dynamic length for example Hull Moving Average, Linear Regression Curve, SMA, WMA, TMA and many more. All of my tested Mas showed too much flexibility because of volume based Adaptive length.
I came across a script of “Adaptive Hull Moving Average” which pretty much used the similar methodology as DVAMA but when I looked into its depth, its volume oscillator wasn’t working at all and only volatility based dynamic length was used. It was an interesting idea so, I decided to use Volume and Volatility alongside for better results but was nearly impossible to achieve what I wanted using only Hull Moving Average.
I had been using EDSMA in “MA MTF Cross Strategy” and “MZ SRSI Strategy V1.0” previously. It was the perfect choice when comparing to usage of slope on it. DSMA works perfectly as support and resistance as its Deviation Scaled. So, I tried using it to adapt dynamic length based on Volume and Volatility and I wasn’t disappointed. It worked like a charm when I adapted dynamic length between 50 and 255.
DYNAMIC LENGTH BENEFITS
Dynamic length adaption methodology works in a way of adapting Relatively Lower Length leading toward overfitting if trend is supported by Volume and Volatility . Similarly, adapting Relatively Higher Length leading toward underfitting if trend isn’t supported by Volume and Volatility .
Dynamic length adaption makes Moving Average to work better for both Bull and Bear-runs avoiding almost every fake break-in and breakouts. Hence, adaptive MA becomes more reliable for breakout trading.
MA would be more useful as it would adapt almost every chart based on its Volume and Volatility data.
DYNAMIC COLORS AND TREND CORRELATION
I’ve used dynamic coloring to identify trends with more detail which are as follows:
Lime Color: Strong Uptrend supported by Volume and Volatility or whatever you’ve chosen from both of them.
Fuchsia Color: Weak uptrend only supported by Slope or whatever you’ve selected.
Red Color: Strong Downtrend supported by Volume and Volatility or whatever you’ve chosen from both of them.
Grey Color: Weak Downtrend only supported by Slope or whatever you’ve selected.
Yellow Color: Possible reversal indication by Slope if enabled. Market is either sideways, consolidating or showing choppiness during that period.
SIGNALS
Green Circle: Market good for long with support of Volume and Volatility or whatever you’ve chosen from both of them.
Red Circle: Market good to short with support from Volume and Volatility or whatever you’ve chosen from both of them.
Yellow Cross: Market either touched top or bottom ATR band and can act as good TP or SL.
EDSMA EVELOPE/BANDS: I’ve included ATR based bands to the Adaptive EDSMA which act as good support/resistance despite from main Adaptive EDSMA Curve.
DEFAULT SETTINGS
I’ve set default Minimum length to 50 and Maximum length to 255 which I’ve found works best for almost all timeframes but you can change this delta to adapt your timeframe accordingly with more precision.
Dynamic length adoption is enabled based on both Volume and Volatility but only one or none of them can also be selected.
Trend signals are enabled based on Slope and Volume but Volatility can be enabled for more precise confirmations.
In “ RVSI ” settings TFS Volume Oscillator is set to default but others work good too especially Volume Zone Oscillator. For more details about Volume Breakout you can check “MZ RVSI Indicator".
ATR breakout is set to be positive if period 14 exceeds period 46 but can be changed if more adaption with volatility is required.
EDSMA super smoother filter length is set to 20 which can be increased to 50 or more for better smoothing but this will also change slope results accordingly.
EDSMA super smoother filter poles are set to 2 because found better results with 2 instead of 3.
FURTHER ENHANCEMENTS
So far, I’ve seen better results with Volume Breakout and Volatility but other parameters such as Linear Slope of Particular MA, MACD, “MZ SRSI ”, a Conditional Uptrend MA or simply KDJ can also be used for dynamic length adaption.
I haven't yet gotten used to pine script arrays so, defining and using conditional operators is pretty much lazy programming for me. Would be great redefining everything through truth matrix instead of using if-else conditions.
All for One Moving AverageThis is a collection of all the moving averages available. Some are built-in, a couple were tricky to source out.
Higher timeframes can be specified so you aren't limited to your chart setting.
Repainting has been disabled by default.
There is also an option to use Heikin Ashi candles as the input source rather than standard bars.
Hope that someone finds this useful.
If you'd like anything added please DM me and I'll include it!
Feel free to copy this into your own strategies/indicators.
~Dark
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!