OPEN-SOURCE SCRIPT
Z-scored ZLEMA | Oquant

Z-Scored ZLEMA | Oquant
This indicator combines the Zero-Lag Exponential Moving Average (ZLEMA) with Z-score normalization to present recent ZLEMA values relative to its mean. It helps users observe trend direction and momentum with reduced lag, while also highlighting potential overbought or oversold levels based on how far ZLEMA values deviate from their mean.
🧠 Concept Overview
📉 Zero Lag Exponential Moving Average (ZLEMA)
The EMA is a popular tool that calculates an average price, but unlike a simple moving average, it gives more weight to recent prices. This means the EMA reacts faster to new price changes and is less affected by older data. However, even with this weighting, the EMA still introduces some lag.
ZLEMA improves on the EMA by reducing this lag. It does this by adjusting how it accounts for previous prices, effectively "shifting" the data to better align the average with current market action. The result is an average that stays smooth but responds more quickly to real price changes—helping traders spot turning points or trend shifts earlier without being fooled by random noise.
📏 Z-score Normalization
Once ZLEMA is calculated, the indicator applies Z-score normalization to measure how far the current ZLEMA value is from its mean. The Z-score expresses this difference using standard deviations, providing a clear, standardized scale. This helps highlight when price moves are unusually strong—either upward or downward—beyond normal fluctuations.
🔍 How This Indicator Works
Smooth Price Data with ZLEMA
The indicator begins by applying the Zero-Lag Exponential Moving Average (ZLEMA) to the chosen price data. Unlike a regular moving average, ZLEMA reduces the typical delay by adjusting the input data before averaging. It does this by "shifting" the price series to remove the lag caused by older prices. This way, ZLEMA stays smooth but reacts more quickly to recent price changes—helping the indicator follow market moves faster without being too noisy.
Normalize ZLEMA values Using Z-score
Once ZLEMA is calculated, the indicator applies Z-score normalization to measure how far the current ZLEMA value is from its mean. The Z-score expresses this difference in terms of standard deviations, creating a clear, standardized scale. This helps highlight when price moves are unusually strong—either up or down—beyond normal fluctuations.
Set Signal Thresholds
Two threshold levels are set on the Z-score scale—crossing above the upper threshold is considered a long (buy) signal, indicating bullish momentum, while crossing below the lower threshold is considered a short (sell) signal, indicating bearish momentum.
Show Visual Signals on the Chart
The Z-score and bars are plotted with colors: green when Z-score is above the bullish threshold, purple when Z-score is below the bearish threshold.
⚙️ Customizable Inputs
Source: Choose the price source (close, open, etc.) for calculations.
ZLEMA Length: Adjust the ZLEMA length to control smoothness versus responsiveness.
Z-score period: Set the Z-score period to define how far back the indicator measures normal price behavior.
Thresholds: Adjust the upper and lower thresholds to control how sensitive the indicator is to strong momentum changes.
📈 Practical Use
This indicator helps identify trend directions and changes faster by combining ZLEMA with statistical analysis. It highlights when price moves are stronger than normal, making it easier to spot early signs of momentum shifts. Traders can use it to confirm trends or detect potential reversals with more timely signals.
🔔 Alert Support
This indicator includes optional built-in alert conditions that notify you when the Z-score crosses above the bullish threshold (long signal) or below the bearish threshold (short signal). You can enable these alerts to get timely updates on potential momentum shifts without constantly watching the chart.
⚠️ Disclaimer: This indicator is intended for educational and informational purposes only. Trading/investing involves risk, and past performance does not guarantee future results. Always test and evaluate indicators/strategies before applying them in live markets. Use at your own risk.
This indicator combines the Zero-Lag Exponential Moving Average (ZLEMA) with Z-score normalization to present recent ZLEMA values relative to its mean. It helps users observe trend direction and momentum with reduced lag, while also highlighting potential overbought or oversold levels based on how far ZLEMA values deviate from their mean.
🧠 Concept Overview
📉 Zero Lag Exponential Moving Average (ZLEMA)
The EMA is a popular tool that calculates an average price, but unlike a simple moving average, it gives more weight to recent prices. This means the EMA reacts faster to new price changes and is less affected by older data. However, even with this weighting, the EMA still introduces some lag.
ZLEMA improves on the EMA by reducing this lag. It does this by adjusting how it accounts for previous prices, effectively "shifting" the data to better align the average with current market action. The result is an average that stays smooth but responds more quickly to real price changes—helping traders spot turning points or trend shifts earlier without being fooled by random noise.
📏 Z-score Normalization
Once ZLEMA is calculated, the indicator applies Z-score normalization to measure how far the current ZLEMA value is from its mean. The Z-score expresses this difference using standard deviations, providing a clear, standardized scale. This helps highlight when price moves are unusually strong—either upward or downward—beyond normal fluctuations.
🔍 How This Indicator Works
Smooth Price Data with ZLEMA
The indicator begins by applying the Zero-Lag Exponential Moving Average (ZLEMA) to the chosen price data. Unlike a regular moving average, ZLEMA reduces the typical delay by adjusting the input data before averaging. It does this by "shifting" the price series to remove the lag caused by older prices. This way, ZLEMA stays smooth but reacts more quickly to recent price changes—helping the indicator follow market moves faster without being too noisy.
Normalize ZLEMA values Using Z-score
Once ZLEMA is calculated, the indicator applies Z-score normalization to measure how far the current ZLEMA value is from its mean. The Z-score expresses this difference in terms of standard deviations, creating a clear, standardized scale. This helps highlight when price moves are unusually strong—either up or down—beyond normal fluctuations.
Set Signal Thresholds
Two threshold levels are set on the Z-score scale—crossing above the upper threshold is considered a long (buy) signal, indicating bullish momentum, while crossing below the lower threshold is considered a short (sell) signal, indicating bearish momentum.
Show Visual Signals on the Chart
The Z-score and bars are plotted with colors: green when Z-score is above the bullish threshold, purple when Z-score is below the bearish threshold.
⚙️ Customizable Inputs
Source: Choose the price source (close, open, etc.) for calculations.
ZLEMA Length: Adjust the ZLEMA length to control smoothness versus responsiveness.
Z-score period: Set the Z-score period to define how far back the indicator measures normal price behavior.
Thresholds: Adjust the upper and lower thresholds to control how sensitive the indicator is to strong momentum changes.
📈 Practical Use
This indicator helps identify trend directions and changes faster by combining ZLEMA with statistical analysis. It highlights when price moves are stronger than normal, making it easier to spot early signs of momentum shifts. Traders can use it to confirm trends or detect potential reversals with more timely signals.
🔔 Alert Support
This indicator includes optional built-in alert conditions that notify you when the Z-score crosses above the bullish threshold (long signal) or below the bearish threshold (short signal). You can enable these alerts to get timely updates on potential momentum shifts without constantly watching the chart.
⚠️ Disclaimer: This indicator is intended for educational and informational purposes only. Trading/investing involves risk, and past performance does not guarantee future results. Always test and evaluate indicators/strategies before applying them in live markets. Use at your own risk.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.