Jurik Moving Average Pine Script — Complete TradingView Guide
The Jurik Moving Average (JMA) is a low-lag, adaptive moving average available in Pine Script v6 that filters market noise far more effectively than traditional EMA or SMA. Developed by Mark Jurik in the 1990s, JMA uses three recursive smoothing stages combined with a phase correction parameter to minimize overshoot and reduce signal delay. In TradingView Pine Script, the JMA is implemented as a custom function using the built-in math.pow and nz helpers. The default configuration uses a period of 14 bars on the close price, a phase of 3, and a power of 1. JMA is widely used across stocks, crypto, forex, and futures for trend-following and crossover strategies where lag reduction is critical. This guide covers the complete Pine Script implementation, all configurable parameters, three ready-to-trade strategies, and step-by-step instructions for generating JMA scripts with Pineify.
What Is the Jurik Moving Average?
The Jurik Moving Average is an adaptive low-lag moving average that uses phase correction and exponential smoothing to track price trends with minimal delay and reduced noise. It was developed by Mark Jurik, a mathematician and quantitative analyst, who introduced the algorithm commercially in the mid-1990s. Jurik's core insight was that standard moving averages face an unavoidable trade-off: reducing lag increases noise, and reducing noise increases lag. JMA resolves this by applying adaptive weighting that responds differently during trending versus choppy market conditions.
The JMA formula operates through three recursive exponential variables. The first stage, e0, is a standard exponential smoother of the source price using alpha as the smoothing coefficient: e0 = (1 − alpha) × price + alpha × e0[1]. The second stage, e1, tracks the deviation of price from e0: e1 = (price − e0) × (1 − beta) + beta × e1[1]. The third stage, e2, is an adaptive correction term: e2 = (e0 + phaseRatio × e1 − JMA[1]) × (1 − alpha)² + alpha² × e2[1]. The final JMA value is computed as JMA = e2 + JMA[1].
Two key derived constants control the filter's behavior. Beta is computed as 0.45 × (len − 1) / (0.45 × (len − 1) + 2), which maps the length input to a normalized smoothing coefficient. Alpha is beta ^ power — raising beta to the power parameter increases smoothing at the cost of additional lag. The phase ratio converts the phase input (range −100 to +100) into a multiplier between 0.5 and 2.5, which biases the correction term toward either lag (negative phase) or responsiveness (positive phase).
JMA is best suited for trending markets where its noise-reduction advantage is most visible. It performs well across all major asset classes: equities (intraday and daily charts), cryptocurrency (Bitcoin, Ethereum — particularly effective due to high volatility), forex major pairs, and futures (ES, NQ, crude oil). For timeframes, JMA with period 7–14 works on 1-minute to 15-minute charts for scalping; period 20–35 on 1-hour to 4-hour charts for intraday swing trades; and period 40–55 on daily charts for position trading. It is less effective in range-bound, low-volatility environments.
Jurik Moving Average Pine Script Code Example
The Pine Script v6 code below implements a complete, ready-to-use Jurik Moving Average indicator. Copy the entire script, open TradingView's Pine Script Editor (Alt+P), paste the code, and click Add to chart — the JMA line will appear on the price pane overlay. The custom function p_ta_jurik accepts a price series and a length, and returns the JMA value for each bar using the three-stage recursive algorithm described above.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify
//@version=6
indicator(title="Jurik Moving Average", overlay=true, max_labels_count=500)
// JMA — Jurik Moving Average with low lag and minimal noise
p_ta_jurik(series float source, simple int len) =>
jurik_phase = 3
jurik_power = 1
phaseRatio_l = jurik_phase < -100 ? 0.5 : jurik_phase > 100 ? 2.5 : jurik_phase / 100 + 1.5
beta_l = 0.45 * (len - 1) / (0.45 * (len - 1) + 2)
alpha_l = math.pow(beta_l, jurik_power)
jma_l = 0.0
e0_l = 0.0
e0_l := (1 - alpha_l) * source + alpha_l * nz(e0_l[1])
e1_l = 0.0
e1_l := (source - e0_l) * (1 - beta_l) + beta_l * nz(e1_l[1])
e2_l = 0.0
e2_l := (e0_l + phaseRatio_l * e1_l - nz(jma_l[1])) * math.pow(1 - alpha_l, 2) + math.pow(alpha_l, 2) * nz(e2_l[1])
jma_l := e2_l + nz(jma_l[1])
jma_l
p_ind_1 = p_ta_jurik(close, 14) // JMA with default period 14
// Plot the JMA line on the price chart
plot(p_ind_1, "JMA", color.rgb(41, 98, 255, 0), 1)
JMA Parameters
The Jurik Moving Average exposes three core parameters that control its smoothing behavior. The table below lists each parameter, its default value, purpose, and recommended range.
| Parameter | Default Value | Description | Recommended Range |
|---|---|---|---|
| len (length) | 14 | Number of bars used to compute the smoothing coefficient beta. Larger values produce a smoother, slower JMA line. | 7–55 |
| jurik_phase | 3 | Phase correction bias. Values closer to +100 make JMA more responsive; values closer to −100 add smoothing at the cost of more lag. | −100 to +100 |
| jurik_power | 1 | Exponent applied to beta when computing alpha. Increasing power above 1 increases smoothing but adds lag; values below 1 are not recommended. | 1–3 |
| source | close | The price series to smooth. Accepts close, open, high, low, hl2, hlc3, ohlc4, or any custom series. | close, hlc3, hl2 |
- Scalping (1–5 min charts): Use length 7–10, phase 10–20, power 1 for fast reaction with moderate noise filtering.
- Swing trading (1H–4H charts): Use length 20–35, phase 3 (default), power 1 — this is the standard balanced configuration.
- Position trading (daily charts): Use length 40–55, phase −10 to 0, power 2 for maximum smoothing with an acceptable lag for long-duration trades.
JMA Trading Strategies
Three proven strategies use the Jurik Moving Average as the primary signal generator. Each strategy includes specific entry and exit conditions designed for a defined market environment.
Strategy 1: JMA Dual Crossover (Trending Markets)
Uses two JMA lines (fast period 7, slow period 21) to generate crossover signals. Best in trending markets with ADX above 20. Works on crypto, forex, and futures on 15-minute to 1-hour charts.
Long Entry Conditions:
- JMA(7) crosses above JMA(21) on a confirmed closed bar.
- ADX(14) is above 20, confirming an active trend.
- Price is above both JMA(7) and JMA(21).
- Enter on the next bar's open after the crossover bar closes.
Long Exit Conditions:
- JMA(7) crosses below JMA(21) — close position on next bar open.
- Alternatively, close when price closes below JMA(21) by more than 0.5 ATR(14).
Strategy 2: JMA Slope + RSI Momentum Filter
Uses the slope of a single JMA(14) combined with RSI(14) to identify momentum-confirmed trend entries. Effective in stock and crypto swing trading on 1-hour to 4-hour charts.
Long Entry Conditions:
- JMA(14) slope is positive for at least 3 consecutive bars (JMA rising).
- RSI(14) crosses above 50 from below, confirming upward momentum.
- Price closes above JMA(14).
- Enter on the next bar's open after all three conditions are met.
Long Exit Conditions:
- JMA(14) slope turns negative (JMA falling for 2 consecutive bars).
- RSI(14) crosses below 50, or price closes below JMA(14).
Strategy 3: JMA Pullback to Dynamic Support
Uses JMA(21) as a dynamic support level in an established uptrend. Pairs with a higher-timeframe trend filter (daily JMA(50) slope). Ideal for swing trading equities and crypto on 4-hour charts.
Long Entry Conditions:
- Daily chart JMA(50) slope is positive — confirming higher-timeframe uptrend.
- Price on the 4H chart pulls back to touch JMA(21) from above (within 0.25 ATR(14)).
- The next 4H bar closes back above JMA(21), showing rejection of the support level.
- Enter on the bar after the confirmed rejection close.
Long Exit Conditions:
- Price closes below JMA(21) on the 4H chart — trend support broken.
- Set stop-loss at 1.5 × ATR(14) below entry price.
How to Generate a Jurik Moving Average Pine Script with Pineify
Pineify generates production-ready Pine Script v6 JMA indicators in seconds. Follow these five steps to create and deploy your custom JMA script.
- 1
Open Pineify at pineify.app and sign in to your free account.
No credit card required. Your generated scripts are saved automatically to your dashboard.
- 2
Click New Indicator and select Jurik Moving Average from the indicator library.
Alternatively, type "JMA" in the search bar to find the indicator directly.
- 3
Describe your JMA configuration: set the period, phase, power, and source price in plain English.
Example: "JMA period 21, phase 10, applied to hlc3, with an alert when JMA slope turns positive."
- 4
Copy the generated Pine Script v6 code from the Pineify editor with one click.
The code is production-ready, fully typed, and compatible with TradingView Pine Script v6.
- 5
Adjust parameters directly in TradingView's Settings panel after adding the indicator to your chart.
All inputs are exposed as user-configurable settings — no code editing required for parameter tuning.
Frequently Asked Questions
Related Pine Script Indicators
Explore other moving average and trend-following indicators available as ready-to-use Pine Script guides on Pineify.
Ready to Build Your JMA Strategy?
Generate production-ready Jurik Moving Average Pine Script v6 code in seconds with Pineify's AI-powered indicator builder.
Start Building for Free