John Ehlers Indicators | Forex Factory

HeroPoker_HeroPoker扑克_HeroPoker德扑圈官网

Attachments: John Ehlers Indicators

John Ehlers Indicators

Couldn't find a thread dedicated to indicators by John Ehlers, so started this one. Please anyone feel free to post any Ehler's related indicators or systems here.
MESA Adaptive Moving Averages

by John F. Ehlers

What if you combined the power of maximum entropy spectral analysis with the Hilbert transform's ability to discern phase change?
The Mesa adaptive moving average (MAMA) adapts to price movement in a new and unique way. The adaptation is based on the rate change of phase as measured by the Hilbert transform discriminator I described in my December 2000 S&C article. In that article I derived the Hilbert transform, which generates the real and imaginary components from the analytical price waveform. The arctangent of the ratio of the imaginary component to the real one is the phase angle at a given point in time. Since the summation of the delta phases from bar to bar reaches 360 degrees, completing a cycle, the Hilbert discriminator computes the dominant cycle on the basis of the average phase differential.
The advantage of this method of adaptation is that it features a fast attack average and a slow decay average so that the composite average rapidly ratchets behind price changes and holds the average value until the next ratchet occurs. Ratcheting refers to the short time constant upon command that allows the adaptive moving average to approach price value; thereafter, the moving average moves slowly with price until the next command it receives to apply the faster moving average. The ratcheting gives the adaptive moving average a stairstep appearance. The combination of fast attack and slow decay is like an electronic sample and hold circuit -- that is, the adaptive moving average rapidly moves toward the current price upon command and essentially holds that value, or slowly follows price, until the next update command arrives.

The starting point for MAMA is a conventional exponential moving average (EMA). The equation for an EMA is written as:

Ema = a*Price + (1 - a)*Ema[1]
where a is less than 1
In plain English, the EMA is created by taking a fraction of the current price and adding one minus that fraction times the previous value of the EMA. The larger the value of a (alpha), the more responsive the EMA becomes to the current price. Conversely, if a becomes smaller, the EMA is more dependent on previous values of the average rather than the current price. Therefore, one way to make an EMA adaptive is to vary the value of a according to some independent parameter. The Kaufman adaptive moving average (KAMA) and the variable index dynamic average (VIDYA) introduced by Tushar Chande both use the variation in prices, or volatility, as the basis of their adaptations.

...Continued in the September 2001 issue of Technical Analysis of STOCKS & COMMODITIES


John Ehlers is president of Mesa Software and a frequent contributor to STOCKS & COMMODITIES. He pioneered the Mesa algorithm for measuring market cycles. This article was adapted from Rocket Science For Traders from John Wiley & Sons. Ehlers may be reached via his website at www.mesasoftware.com.
Excerpted from an article originally published in the September 2001 issue of Technical Analysis of STOCKS & COMMODITIES magazine. All rights reserved. Copyright 2001, Technical Analysis, Inc.

Posting a mt5 Mladen Rakic version and a smoothed mt4 version by me.
Attached Image(s) (click to enlarge)
Click to Enlarge

Name: mama mt5.png
Size: 17 KB
Click to Enlarge

Name: mama mt4.png
Size: 30 KB
Attached File(s)
File Type: mq5 Mama + fama.mq5   14 KB | 46 downloads
File Type: mq4 ! mama + fama smoothed.mq4   14 KB | 66 downloads
This script implements the Reversion Index as presented by John F. Ehlers in the January 2026 edition of the TASC Traders' Tips, "Identifying Peaks and Valleys in Ranging Markets”. This indicator was created to provide timely buy and sell signals for mean reversion strategies.
Attached Image (click to enlarge)
Click to Enlarge

Name: GBPUSDH1.png
Size: 24 KB
Attached File(s)
File Type: mq4 ! Reversion Index.mq4   7 KB | 55 downloads
File Type: pdf ReversionIndex (3).pdf   2.4 MB | 46 downloads
One of the series of indicators created by John Ehler's. According to Ehlers:
Instantaneous trend Line:
It works because it completely removes the dominant cycle from a smoothing average.
For the mathematically inclined, the Fourier Transform of a rectangular window (formed by a simple average) is a Sin(X)/X distribution. The objective is to place the first null of this distribution exactly at the dominant cycle. For the intuitively inclined, what we are doing is taking a simple average over the full dominant cycle period. In such an average, there are as many sample points above the midpoint as below the midpoint with the result that the sum of all these sample points is zero.

This version by Mladen Rakic.
Attached Image (click to enlarge)
Click to Enlarge

Name: cb-1.png
Size: 6 KB
Attached File(s)
File Type: mq5 Instantaneous Trend Line.mq5   7 KB | 50 downloads
DSL From Mladen Rakic:

DSL (Discontinued Signal Line) indicators

Thread for dsl (discontinued signal line) indicators

What is the DSL Discontinued Signal Line?

A lot of indicators are using signal lines in order to determine the trend (or some desired state of the indicator) easier. The idea of the signal line is easy: comparing the value to its smoothed (slightly lagging) state, the idea of current momentum/state is made.

Discontinued signal line is inheriting that simple signal line idea, and it is extending it: instead of having one signal line, more lines depending on the current value of the indicator.

"Signal" line is calculated the following way:

 

  1. When a certain level is crossed into the desired direction, the EMA of that value is calculated for the desired signal line
  2. When that level is crossed into the opposite direction, the previous "signal" line value is simply "inherited" and it becomes a kind of a level


This way it becomes a combination of signal lines and levels that are trying to combine both the good from both methods.

In simple terms, DSL uses the concept of a signal line and betters it by inheriting the previous signal line's value & makes it a level.


For the Ehlers part:
This version the discontinued signal line instead of an EMA changed it to using an Ehlers super smoother, and the RSI is an RSI of Ehler's ultimate smoother.

Attached Image (click to enlarge)
Click to Enlarge

Name: EURCADM15.png
Size: 19 KB
Attached File(s)
File Type: ex5 dsl - ultimate smoother rsi.ex5   26 KB | 36 downloads
From Mladen Rakic:

General description: In his June 2020 TASC article 'Correlation as a cycle indicator ' John Ehlers describes one possible way to determine trend in the markets His article describes 3 possible ways of determining the trend and here we shall post all the 3 possible ways This version: these versions are showing the "market state", "phasor", and the "angle" parts of the correlation calculation.

I just updated the code somewhat.
Attached Image (click to enlarge)
Click to Enlarge

Name: ehlers correlation.png
Size: 26 KB
Attached File(s)
File Type: mq5 Correlation - angle.mq5   7 KB | 29 downloads
File Type: mq5 Correlation - phasor.mq5   8 KB | 28 downloads
File Type: mq5 Correlation - market state.mq5   8 KB | 30 downloads
File Type: pdf CORRELATION AS A CYCLE INDICATOR.pdf   1.2 MB | 68 downloads
From here TASC 2024.09 Precision Trend Analysis — Indicator by PineCodersTASC — TradingView

and here TRADERS’ TIPS - SEPTEMBER 2024

OVERVIEW:
This script introduces an approach for detecting and confirming trends in price series based on digital signal processing principles, as presented by John Ehlers in the "Precision Trend Analysis" article from the September 2024 edition of TASC's Traders' Tips.

CONCEPTS:
Traditional trend-following indicators, such as moving averages, are low pass filters that pass low-frequency components in a series and remove high-frequency components. Because lowpass filters preserve lengthy cycles in the data while attenuating shorter cycles, such filters have unavoidable lag that impacts the timeliness of trading signals.

In his article, John Ehlers presents an alternative approach that combines two high pass filters with different lengths to remove undesired high-frequency content via cancellation. High pass filters have nearly zero lag. As such, the resulting trend indicator from this approach is very responsive to changes in the price series, with peaks and valleys that closely align with those of the price data. The indicator signifies an uptrend when its value is positive (i.e., above the balance point) and a downtrend when it is negative.

Subsequently, John Ehlers demonstrates that one can use the trend indicator's rate of change (ROC) to determine the onset of new trend movements. The ROC is zero at peaks and valleys in the trend indicator. Therefore, when the ROC crosses above zero, it signifies the onset or continuation of an uptrend. Likewise, the ROC crossing below zero indicates the onset or continuation of a downtrend. Note, however, that because the ROC does not preserve lower-frequency information, it can produce whipsaw trading signals in sideways or continuously trending price series.

This script implements both the trend indicator and its ROC along with the following on-chart signals:

CALCULATIONS:
The math behind the trend indicator comes from digital - filter design principles. The first step applies a digital high pass filter that attenuates long cycles with periods above the user-specified critical period. The default value is 250 bars, representing roughly one year for instruments such as stocks on the daily timeframe. The next step applies a high pass filter with a shorter period (40 bars by default). The difference between these filters determines the trend indicator, which preserves cyclic components between 40 and 250 bars by default while attenuating and eliminating others. The ROC represents the scaled one-bar difference in the trend indicator.
Attached Image (click to enlarge)
Click to Enlarge

Name: GBPAUDDaily.png
Size: 33 KB
Attached File(s)
File Type: ex4 ! PTA (mtf + alerts + arrows).ex4   91 KB | 44 downloads
From here TASC 2024.09 Precision Trend Analysis — Indicator by PineCodersTASC — TradingView and here TRADERS’ TIPS - SEPTEMBER 2024 OVERVIEW: This script introduces an approach for detecting and confirming trends in price series based on digital signal processing principles, as presented by John Ehlers in the "Precision Trend Analysis" article from the September...
Thank you very much Mrtools. It looks pretty interesting. It would be great if we can have MT5 version later. Thanks.
Simplicity is the ultimate sophistication - Leonardo da Vinci
{quote} Thank you very much Mrtools. It looks pretty interesting. It would be great if we can have MT5 version later. Thanks.
Made a MT5 version.
Attached Image (click to enlarge)
Click to Enlarge

Name: EURUSDM15.png
Size: 19 KB
Attached File(s)
{quote} Made a MT5 version. {file} {image}
Thank you very much Mrtools! So quick!!
Simplicity is the ultimate sophistication - Leonardo da Vinci
Ehlers Optimal Tracking Filter
is an adaptive digital filter for trend tracking and smoothing out market noise with minimal phase delay. Developed by John Ehlers based on the principles of digital signal processing ?the optimal Kalman filter (R.E. Kalman) and optimizing the filter's response to signal characteristics.

Adaptive digital filter for trend tracking and smoothing out market noise with minimal phase delay. It was developed by John Ehlers based on the principles of digital signal processing ?the optimal Kalman filter (R.E. Kalman) and optimization of the filter response to signal characteristics.

Added price pre-smoothing and some more user-friendly settings for customization.
Attached Image (click to enlarge)
Click to Enlarge

Name: AUDUSDM15.png
Size: 25 KB
Attached File(s)
File Type: mq5 Ehlers optimal tracking filter.mq5   20 KB | 38 downloads
Ehlers Triangular Moving Average


Theory:
Triangular moving average is a sort of a weighted moving average that is known for very smooth results. The weights in the triangular moving average are adding more weight to central values of the averaged data. Hence the coefficients are specifically distributed. Some of the examples that can give a clear picture of the coefficient's progression:

period 1: 1
period 2: 1 1
period 3: 1 2 1
period 4: 1 2 2 1
period 5: 1 2 3 2 1
period 6: 1 2 3 3 2 1
period 7: 1 2 3 4 3 2 1
period 8: 1 2 3 4 4 3 2 1
period 9: 1 2 3 4 5 4 3 2 1
and so, on and on ...


Made a couple of rsi's one is using a triangular exponential moving average and the other is using a regularized exponential moving average.
Attached Image (click to enlarge)
Click to Enlarge

Name: EURCADH1.png
Size: 20 KB
Attached File(s)
File Type: ex4 ! rsi regularized ema.ex4   31 KB | 27 downloads
File Type: ex4 ! rsi TriEma.ex4   32 KB | 35 downloads
! mama + fama smoothed.mq4 can you make this mtf?
! mama + fama smoothed.mq4 can you make this mtf?

Hello, added mtf.
Attached Image (click to enlarge)
Click to Enlarge

Name: GBPAUDDaily.png
Size: 42 KB
Attached File(s)
File Type: mq4 ! mama + fama smoothed (mtf).mq4   19 KB | 26 downloads
This is a generalized Triangular Ema.

This version:
Instead of using fixed multiplication factor in the final Tri Ema formula, the generalized version allows you to change it. By varying the "volume factor" from 0 to 1 you apply different multiplications and thus producing Tri Ema with different "speed" - the higher the volume factor is the "faster" the Tri Ema will be (but also the slope of it will be less smooth). The volume factor is limited in the calculation to 1 since any volume factor that is larger than 1 is increasing the overshooting to the extent that some volume factors usage makes the indicator unusable.

Also:
It is using percent of various types of ATR (Average True Range) or STD (Standard deviation) as a filter. It is done in order to fix one of the weak points of using fixed (pips) step size: different time frames tend to have different results for fixed step size (ie: higher time frames become almost without steps and lower time frames still have those steps for same setting). Percent of ATR or STD usage fixes that and makes it a sort of adaptive. The rest is the same: if the average does not change for more than the required step, the value of the average remains the same. Otherwise, it is changed in order to reflect the nearest value based on the required steps.

Usage:
You can use it as any regular average, or you can use the color change of the indicator as a signal.
Attached Image (click to enlarge)
Click to Enlarge

Name: AUDUSDM15.png
Size: 31 KB
Attached File(s)
{quote} Hello, added mtf. {file} {image}
Hi Mr.Tools ,

Wondering if we could get a button version for the the base and mtf options of the mama+fama indicator please. Thanks in advance.
{quote} Hi Mr.Tools , Wondering if we could get a button version for the the base and mtf options of the mama+fama indicator please. Thanks in advance.
Hello, added an on/off button.
Attached Image (click to enlarge)
Click to Enlarge

Name: AUDUSDM15.png
Size: 36 KB
Attached File(s)
File Type: ex4 ! mama + fama smoothed (mtf + btn).ex4   65 KB | 33 downloads