Ehlers EMA Smoother Pine Script — Complete TradingView Guide
The Ehlers EMA Smoother (EEMAS) is a two-stage digital signal processing filter for TradingView Pine Script that delivers lower lag and less noise than a standard EMA. Developed from John Ehlers's 2013 Super Smoother algorithm, EEMAS first applies an EMA pre-smoothing pass with period smoothK, then runs the result through a 2-pole Butterworth-derived Super Smoother with period smoothP. The output is a clean trend line plotted directly on the price chart that responds quickly to genuine trend changes while filtering out random intraday noise. Default settings are smoothK=3 and smoothP=3, making EEMAS usable straight out of the box on any liquid market — stocks, crypto, forex, and futures — across timeframes from 5-minute intraday charts to weekly swing charts. This page provides the complete Pine Script v6 code, a full parameter reference, three actionable trading strategies, and step-by-step instructions for generating a customised version with Pineify.
What Is the Ehlers EMA Smoother?
The Ehlers EMA Smoother is a two-stage low-lag moving average filter that combines an Exponential Moving Average pre-smoothing step with a 2-pole Super Smoother filter, used to generate cleaner trend signals with less lag than traditional EMAs.
The indicator was constructed on top of the Super Smoother filter introduced by John F. Ehlers in 2013 in his book Cybernetic Analysis for Stocks and Futures. Ehlers is widely credited for bringing digital signal processing (DSP) mathematics — specifically Butterworth filter design — into mainstream technical analysis. The Super Smoother applies a 2-pole infinite impulse response (IIR) filter whose coefficients are derived from the formula:
a1 = exp(−π × √2 / period)— exponential decay factorcoeff2 = 2 × a1 × cos(√2 × π / period)— feedback coefficientcoeff3 = −a1²— second-order feedback termcoeff1 = (1 − coeff2 − coeff3) / 2— feed-forward scaling
The Ehlers EMA Smoother extends this by adding an EMA pre-smoothing stage with period smoothK before the Super Smoother stage with period smoothP. The EMA pass removes the highest-frequency noise components so the Super Smoother can operate on a cleaner input, reducing overshoot and ringing artefacts. The combined formula is:
EEMAS(source, smoothK, smoothP) = SuperSmoother(EMA(source, smoothK), smoothP)
Applicable markets: The Ehlers EMA Smoother works on all liquid markets. It is particularly effective on cryptocurrency pairs (e.g. BTC/USDT, ETH/USDT) and high-beta equities where standard EMAs produce frequent false crossovers due to high volatility. It also performs well on major forex pairs (EUR/USD, GBP/USD) and equity futures (ES, NQ).
Best timeframes: The default settings (smoothK=3, smoothP=3) are calibrated for 5-minute to 1-hour intraday charts. For 4-hour and daily swing trading, increase smoothP to 8–14. For weekly position trading, use smoothP=20 to produce a slow, stable trend reference. Shorter smoothP values (3–5) preserve responsiveness for scalping strategies on 1–3 minute charts.
Unlike a simple moving average or standard EMA, EEMAS does not introduce the phase lag typical of longer-period averages because the Butterworth filter minimises group delay across the passband. This property makes it especially useful for crossover strategies where timing is critical.
Pine Script Code Example
The Pine Script v6 code below implements the complete Ehlers EMA Smoother indicator. Copy the code, open TradingView's Pine Editor, paste it in, and click "Add to chart" — the EEMAS line will immediately appear as a blue overlay on your price bars. You can adjust smoothK and smoothP directly in the indicator settings panel without editing code.
// This source code is subject to the terms of the Mozilla Public License 2.0
// © Pineify
//@version=6
indicator(title="Ehlers EMA Smoother", overlay=true, max_labels_count=500)
// ── Helper: EMA kernel ──────────────────────────────────────────────────────
p_ta_xema(series float source, simple int length) =>
mult = 2.0 / (length + 1.0)
res = float(na)
res := mult * source + (1.0 - mult) * nz(res[1], source)
// ── Helper: Ehlers Super Smoother (2-pole Butterworth-based filter) ─────────
p_ta_ehlers_super_smoother(series float source, simple int lower) =>
PI = 3.14159265359
a1 = math.exp(-PI * math.sqrt(2) / lower)
coeff2 = 2 * a1 * math.cos(math.sqrt(2) * PI / lower)
coeff3 = -math.pow(a1, 2)
coeff1 = (1 - coeff2 - coeff3) / 2
filt = 0.0
filt := nz(coeff1 * (source + nz(source[1], source)) + coeff2 * filt[1] + coeff3 * nz(filt[2], filt[1]), source)
// ── Ehlers EMA Smoother: EMA pre-smoothing → Super Smoother ────────────────
p_ta_ehlers_ema_smoother(series float source, simple int smoothK = 3, simple int smoothP = 3) =>
p_ta_ehlers_super_smoother(p_ta_xema(source, smoothK), smoothP)
// ── Indicator calculation ───────────────────────────────────────────────────
p_ind_1 = p_ta_ehlers_ema_smoother(close, 3, 3) // EEMAS
// ── Plot ────────────────────────────────────────────────────────────────────
plot(p_ind_1, "EEMAS", color.rgb(41, 98, 255, 0), 1)
Parameters
The Ehlers EMA Smoother exposes two integer parameters: an EMA pre-smoothing period and a Super Smoother filter period. Both accept simple int values and are set at compile time.
| Parameter | Default Value | Description | Recommended Range |
|---|---|---|---|
| smoothK | 3 | Period of the EMA pre-smoothing stage. Controls how aggressively high-frequency noise is removed before the Super Smoother filter. | 2 – 10 |
| smoothP | 3 | Period of the Ehlers Super Smoother (2-pole Butterworth-based IIR) stage. Larger values produce a smoother line with slightly more lag. | 3 – 30 |
| source | close | Price series to smooth. Can be substituted with open, high, low, hl2, or hlc3. | Any price series |
Tuning scenarios
- Scalping (1–5 min charts): smoothK=3, smoothP=3–5 — keeps the line close to price for fast entries.
- Swing trading (1H–4H charts): smoothK=3, smoothP=8–14 — filters intraday noise while still capturing swing highs and lows.
- Position trading (daily–weekly): smoothK=5, smoothP=20 — produces a stable trend reference comparable to a 50-period SMA but with less lag.
Trading Strategies
Strategy 1: EEMAS Price Crossover (Trend-Following)
Market environment: trending markets (avoid in choppy sideways conditions). Best on 1H–4H charts.
Entry conditions:
- Calculate EEMAS with smoothK=3, smoothP=10 on the 1-hour chart.
- Enter long when the close price crosses above the EEMAS line (
crossover(close, eemas)). - Confirm with RSI(14) above 50 to ensure bullish momentum is present.
- Set stop-loss 1× ATR(14) below the EEMAS at the time of entry.
Exit conditions:
- Exit long when close crosses below the EEMAS line (
crossunder(close, eemas)). - Or exit when RSI(14) crosses below 50, signalling momentum exhaustion.
Strategy 2: Dual EEMAS Crossover (Fast/Slow Ribbon)
Market environment: trending markets. Apply on 15-minute to 4-hour charts for swing entries.
Entry conditions:
- Plot two EEMAS lines: Fast (smoothK=3, smoothP=3) and Slow (smoothK=3, smoothP=14).
- Enter long when the Fast EEMAS crosses above the Slow EEMAS.
- Confirm with MACD histogram above zero on the same timeframe.
- Place stop-loss below the most recent swing low identified by the Slow EEMAS.
Exit conditions:
- Exit when Fast EEMAS crosses below Slow EEMAS.
- Or when MACD histogram turns negative for two consecutive bars.
Strategy 3: EEMAS Bounce (Mean-Reversion Pullback)
Market environment: trending with pullbacks — not suitable for ranging or low-volatility environments.
Entry conditions:
- Price is above EEMAS (smoothK=3, smoothP=10), confirming an uptrend.
- Price pulls back to touch or briefly cross below the EEMAS line.
- The next bar closes back above EEMAS — this is the entry bar.
- Confirm with Bollinger Bands (20, 2): price should be inside the bands, not at the lower band, to avoid catching a breakdown.
Exit conditions:
- Target the upper Bollinger Band as the first profit target.
- Stop-loss is the low of the pullback candle that touched EEMAS.
How to Generate Ehlers EMA Smoother in Pineify
Pineify generates production-ready Ehlers EMA Smoother Pine Script code in seconds. Follow these five steps to create a customised version without writing any code.
- 1
Open Pineify
Navigate to pineify.app and sign in or create a free account. The AI Pine Script generator will load automatically.
- 2
Click "New Indicator"
Select "Indicator" from the creation menu to open the natural-language prompt interface where you describe what you want to build.
- 3
Describe the Ehlers EMA Smoother
Type a prompt such as "Build an Ehlers EMA Smoother overlay indicator with configurable smoothK and smoothP parameters, plotted in blue." Pineify understands signal processing concepts and will generate the two-stage filter correctly.
- 4
Copy the generated Pine Script v6 code
Review the generated code in the editor panel. Pineify outputs Pine Script v6 with proper nz() initialisation, correct Butterworth coefficients, and a plot statement. Copy the code to your clipboard with one click.
- 5
Adjust parameters in TradingView
Paste the code into TradingView's Pine Editor and click "Add to chart." Open the indicator settings panel to change smoothK and smoothP values. Use the Recommended Range column in the parameters table on this page as a starting point.
Frequently Asked Questions
Related Indicators
Explore other Pine Script indicators available on Pineify:
- Highest Indicator— Returns the highest value over a given lookback period using
ta.highest().
Build Your Own Ehlers EMA Smoother Today
Generate customised Pine Script indicators in seconds with Pineify's AI-powered code generator. No coding experience required.
Start for Free