Indicator · Pine Script v5 · On the chart

Zero Lag Trend Signals (MTF) [AlgoAlpha]

by TamTH-Dev· code credited to AlgoAlpha

Calculates a Zero Lag Exponential Moving Average (ZLEMA) combined with Average True Range volatility bands to determine market trends.

View on GitHub

Repaints

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code111
Settings9inputs
LicenceNone statedfile: MPL-2.0
Last update5 weeks ago18 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

111 lines of Pine Script v5 from collections/ZeroLagTrendSignals.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

ZeroLagTrendSignals.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © AlgoAlpha

//@version=5
indicator("Zero Lag Trend Signals (MTF) [AlgoAlpha]", shorttitle="AlgoAlpha - 0️⃣Zero Lag Signals", overlay=true)

length = input.int(70, "Length", tooltip = "The Look-Back window for the Zero-Lag EMA calculations", group = "Main Calculations")
mult = input.float(1.2, "Band Multiplier", tooltip = "This value controls the thickness of the bands, a larger value makes the indicato less noisy", group = "Main Calculations")
t1 = input.timeframe("5", "Time frame 1", group = "Extra Timeframes")
t2 = input.timeframe("15", "Time frame 2", group = "Extra Timeframes")
t3 = input.timeframe("60", "Time frame 3", group = "Extra Timeframes")
t4 = input.timeframe("240", "Time frame 4", group = "Extra Timeframes")
t5 = input.timeframe("1D", "Time frame 5", group = "Extra Timeframes")
green = input.color(#00ffbb, "Bullish Color", group = "Appearance")
red = input.color(#ff1100, "Bearish Color", group = "Appearance")

src = close

lag = math.floor((length - 1) / 2)

zlema = ta.ema(src + (src - src[lag]), length)

volatility = ta.highest(ta.atr(length), length*3) * mult

var trend = 0

if ta.crossover(close, zlema+volatility)
    trend := 1

if ta.crossunder(close, zlema-volatility)
    trend := -1

zlemaColor = trend == 1 ? color.new(green, 70) : color.new(red, 70)
m = plot(zlema, title="Zero Lag Basis", linewidth=2, color=zlemaColor)
upper = plot(trend == -1 ? zlema+volatility : na, style = plot.style_linebr, color = color.new(red, 90), title = "Upper Deviation Band")
lower = plot(trend == 1 ? zlema-volatility : na, style = plot.style_linebr, color = color.new(green, 90), title = "Lower Deviation Band")

fill(m, upper, (open + close) / 2, zlema+volatility, color.new(red, 90), color.new(red, 70))
fill(m, lower, (open + close) / 2, zlema-volatility, color.new(green, 90), color.new(green, 70))

plotshape(ta.crossunder(trend, 0) ? zlema+volatility : na, "Bearish Trend", shape.labeldown, location.absolute, red, text = "▼", textcolor = chart.fg_color, size = size.small)
plotshape(ta.crossover(trend, 0) ? zlema-volatility : na, "Bullish Trend", shape.labelup, location.absolute, green, text = "▲", textcolor = chart.fg_color, size = size.small)

plotchar(ta.crossover(close, zlema) and trend == 1 and trend[1] == 1 ? zlema-volatility*1.5 : na, "Bullish Entry", "▲", location.absolute, green, size = size.tiny)
plotchar(ta.crossunder(close, zlema) and trend == -1 and trend[1] == -1 ? zlema+volatility*1.5 : na, "Bearish Entry", "▼", location.absolute, red, size = size.tiny)

s1 = request.security(syminfo.tickerid, t1, trend)
s2 = request.security(syminfo.tickerid, t2, trend)
s3 = request.security(syminfo.tickerid, t3, trend)
s4 = request.security(syminfo.tickerid, t4, trend)
s5 = request.security(syminfo.tickerid, t5, trend)

s1a = s1 == 1 ? "Bullish" : "Bearish"
s2a = s2 == 1 ? "Bullish" : "Bearish"
s3a = s3 == 1 ? "Bullish" : "Bearish"
s4a = s4 == 1 ? "Bullish" : "Bearish"
s5a = s5 == 1 ? "Bullish" : "Bearish"

if barstate.islast
    var data_table = table.new(position=position.top_right, columns=2, rows=6, bgcolor=chart.bg_color, border_width=1, border_color=chart.fg_color, frame_color=chart.fg_color, frame_width=1)
    table.cell(data_table, text_halign=text.align_center, column=0, row=0, text="Time Frame", text_color=chart.fg_color)
    table.cell(data_table, text_halign=text.align_center, column=1, row=0, text="Signal", text_color=chart.fg_color)

    table.cell(data_table, text_halign=text.align_center, column=0, row=1, text=t1, text_color=chart.fg_color)
    table.cell(data_table, text_halign=text.align_center, column=1, row=1, text=s1a, text_color=chart.fg_color, bgcolor=s1a == "Bullish" ? color.new(green, 70) : color.new(red, 70))

    table.cell(data_table, text_halign=text.align_center, column=0, row=2, text=t2, text_color=chart.fg_color)
    table.cell(data_table, text_halign=text.align_center, column=1, row=2, text=s2a, text_color=chart.fg_color, bgcolor=s2a == "Bullish" ? color.new(green, 70) : color.new(red, 70))

    table.cell(data_table, text_halign=text.align_center, column=0, row=3, text=t3, text_color=chart.fg_color)
    table.cell(data_table, text_halign=text.align_center, column=1, row=3, text=s3a, text_color=chart.fg_color, bgcolor=s3a == "Bullish" ? color.new(green, 70) : color.new(red, 70))

    table.cell(data_table, text_halign=text.align_center, column=0, row=4, text=t4, text_color=chart.fg_color)
    table.cell(data_table, text_halign=text.align_center, column=1, row=4, text=s4a, text_color=chart.fg_color, bgcolor=s4a == "Bullish" ? color.new(green, 70) : color.new(red, 70))

    table.cell(data_table, text_halign=text.align_center, column=0, row=5, text=t5, text_color=chart.fg_color)
    table.cell(data_table, text_halign=text.align_center, column=1, row=5, text=s5a, text_color=chart.fg_color, bgcolor=s5a == "Bullish" ? color.new(green, 70) : color.new(red, 70))

/////////////////////////////////////////ALERTS FOR SMALL ARROWS (ENTRY SIGNALS)
alertcondition(ta.crossover(close, zlema) and trend == 1 and trend[1] == 1, "Bullish Entry Signal", 
     message="Bullish Entry Signal detected. Consider entering a long position.")
alertcondition(ta.crossunder(close, zlema) and trend == -1 and trend[1] == -1, "Bearish Entry Signal", 
     message="Bearish Entry Signal detected. Consider entering a short position.")

/////////////////////////////////////////ALERTS FOR TREND CONDITIONS
alertcondition(ta.crossover(trend, 0), "Bullish Trend")
alertcondition(ta.crossunder(trend, 0), "Bearish Trend")
alertcondition(ta.cross(trend, 0), "(Bullish or Bearish) Trend")

alertcondition(ta.crossover(s1, 0), "Bullish Trend Time Frame 1")
alertcondition(ta.crossunder(s1, 0), "Bearish Trend Time Frame 1")
alertcondition(ta.cross(s1, 0), "(Bullish or Bearish) Trend Time Frame 1")

alertcondition(ta.crossover(s2, 0), "Bullish Trend Time Frame 2")
alertcondition(ta.crossunder(s2, 0), "Bearish Trend Time Frame 2")
alertcondition(ta.cross(s2, 0), "(Bullish or Bearish) Trend Time Frame 2")

alertcondition(ta.crossover(s3, 0), "Bullish Trend Time Frame 3")
alertcondition(ta.crossunder(s3, 0), "Bearish Trend Time Frame 3")
alertcondition(ta.cross(s3, 0), "(Bullish or Bearish) Trend Time Frame 3")

alertcondition(ta.crossover(s4, 0), "Bullish Trend Time Frame 4")
alertcondition(ta.crossunder(s4, 0), "Bearish Trend Time Frame 4")
alertcondition(ta.cross(s4, 0), "(Bullish or Bearish) Trend Time Frame 4")

alertcondition(ta.crossover(s5, 0), "Bullish Trend Time Frame 5")
alertcondition(ta.crossunder(s5, 0), "Bearish Trend Time Frame 5")
alertcondition(ta.cross(s5, 0), "(Bullish or Bearish) Trend Time Frame 5")

alertcondition(ta.crossover(close, zlema) and trend == 1 and trend[1] == 1, "Bullish Entry")
alertcondition(ta.crossunder(close, zlema) and trend == -1 and trend[1] == -1, "Bearish Entry")

Overview

Zero Lag Trend Signals (MTF) [AlgoAlpha] plots the ZLEMA basis line, volatility bands, trend reversal labels, and entry signals directly on the price chart. Additionally, it includes a multi-timeframe dashboard table displaying trend direction across five user-defined timeframes. Higher-timeframe table status updates dynamically on unclosed higher-timeframe bars.

Details

Published by

TamTH-Dev on GitHub

Code credit

AlgoAlpha, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Trend, Moving averages, Volatility & bands, Screeners & dashboards

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Lengthint70length
Band Multiplierfloat1.2mult
Time frame 1timeframe5t1
Time frame 2timeframe15t2
Time frame 3timeframe60t3
Time frame 4timeframe240t4
Time frame 5timeframe1Dt5
Bullish Colorcolor#00ffbbgreen
Bearish Colorcolor#ff1100red
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

43 stars

This indicator evaluates market momentum and risk by calculating trend metrics and volatility stats, displaying them in an on-chart table pane. It measures short-term and long-term trend strength via two MACD configurations built on three customizable EMA leng

Indicator v5 TrendVolatility & bands
Updated 1 year ago · None stated GitHub repository of Trend Strength & Volatility
7 stars

This indicator plots a zero-lag EMA center line with ATR bands on the price chart. It marks bullish or bearish mode after closes stay beyond a band for a set number of bars and the center line slopes that way. Confirmed buy and sell labels appear only after th

Indicator v6 TrendMoving averages Repaints
Updated 3 months ago · None stated GitHub repository of GK Trend Ribbon SWING + PREPARE HUD

Calculates market volatility, velocity, dynamic VIX thresholds, and multi-timeframe directional bias to assess risk regimes for Nifty index options trading. It computes a danger score based on ATR, VIX rate of change, Bollinger Band width, and price velocity t

Indicator v5 Volatility & bandsScreeners & dashboards
Updated 13 days ago · None stated GitHub repository of NIFTY SpreadGuard V2024 - Mega-Sidebar Sniper

Quick Stats

by etnt
2 stars

Quick Stats displays key trading metrics directly on the price chart overlay. It calculates Mark Minervini's Trend Template rules by scoring moving average alignments (50, 150, and 200 SMAs), 200 SMA slope, and 52-week high/low proximities. Additionally, it co

Indicator v5 TrendVolatility & bands
Updated 1 year ago · MPL-2.0 GitHub repository of Quick Stats

This indicator draws a SPY scalping panel in a separate pane. It calculates a Supertrend side from ATR smoothed by a selectable average, defaulting to HMA, and uses three moving averages of selectable type, defaulting to EMA lengths 13, 50, and 75. Colors mark

Indicator v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of J8 30 123 Spy Scalping Lower Pro 2 Jerry

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers