3/9/27/9 Zero Lag EMA / EMA / Pivots / Dynamic Support

My most useful indicator yet. This is a combo 9/27 zero lag EMA/EMA with a trailing 3/9 and close/9 indicator with dynamic pivots and levels and a 9-candle-count candle painter. Clearly identifies possible entry and exits as well as points of decision identifying possible partial buy/sell points.
Remove from Favorite Scripts Add to Favorite Scripts
// @author lonestar108
study(title = "3/9/27/9 Zero Lag EMA / EMA / Pivots / Dynamic Support", shorttitle="3/9/27/9 ZLEMA/EMA/Pivots/Support", overlay=true)

lengths=input(3, title="Short Period Length")
length=input(9, title="Fast Period Length")
length2=input(27, title="Slow Period Length")
plen=input(9, minval=1, title="Pivot Period Length")

// ema, zero lag ema
ema1=ema(src, length)
ema2=ema(ema1, length)
ema3=ema(src, length2)

// ema, zero lag ema
ema4=ema(src, length)
ema5=ema(ema4, length)
ema6=ema(src, length2)

// pivot points
highest_high = highest(high, plen)
highest_dev = dev(highest_high, plen) ? na : highest_high
high_pivot = highest_dev[-plen+1]
high_series = fixnan(high_pivot)
lowest_low = lowest(low, plen)
lowest_dev = dev(lowest_low, plen) ? na : lowest_low
low_pivot = lowest_dev[-plen + 1]
low_series = fixnan(low_pivot)

// Sell Setup 
priceflip = barssince(close<close[4])
sellsetup = close>close[4] and priceflip
sell = sellsetup and barssince(priceflip!=9)
sell8 = sellsetup and barssince(priceflip!=8)
sellovershoot = sellsetup and barssince(priceflip!=13)
sellovershoot1 = sellsetup and barssince(priceflip!=14)
sellovershoot2 = sellsetup and barssince(priceflip!=15)
sellovershoot3 = sellsetup and barssince(priceflip!=16)

// Buy setup
priceflip1 = barssince(close>close[4])
buysetup = close<close[4] and priceflip1
buy = buysetup and barssince(priceflip1!=9)
buy8 = buysetup and barssince(priceflip1!=8)
buyovershoot = barssince(priceflip1!=13) and buysetup
buyovershoot1 = barssince(priceflip1!=14) and buysetup
buyovershoot2 = barssince(priceflip1!=15) and buysetup
buyovershoot3 = barssince(priceflip1!=16) and buysetup

// TD lines
val= buy !=sell[9]
TDhigh = valuewhen(val,high[9],0)
val1= sell !=buy[9]
TDlow = valuewhen(val1,low[9],0)


icolor=rising(zlema,1) ? lime : red

plot(zlema, color=yellow, linewidth=1)
plot(ema3, color=lime, linewidth=1)

plot(high_series, style=circles, color=lime, linewidth=1)
plot(low_series, style=circles, color=red, linewidth=1)

plot(high_pivot + 1, color=red, style=circles, linewidth=3)
plot(low_pivot - 1, color=lime, style=circles, linewidth=3)

plot(cross(zlema, ema3) ? rising(zlema,1) ? low - 1 : high + 1 : na, color=icolor, style=cross, linewidth=2)
plot(cross(zlema2, ema3) ? rising(zlema2,1) ? low - 1.25 : high + 1.25 : na, color=yellow, style=circles, linewidth=2)
plot(cross(zlema2, ema6) ? rising(zlema2,1) ? low - 1.35 : high + 1.35 : na, color=orange, style=circles, linewidth=2)
plot(cross(close, ema3) ? rising(zlema,1) ? low - 1.15 : high + 1.15 : na, color=fuchsia, style=circles, linewidth=2)


plot(TDhigh ? TDhigh : na ,style=circles, linewidth=1, color=lime,offset=-9)
plot(TDlow ? TDlow : na ,style=circles, linewidth=1, color=red, offset=-9)

barcolor(sellovershoot? #FF66A3 : sellovershoot1? #FF3385 : sellovershoot2? #FF0066 : sellovershoot3? #CC0052 : buyovershoot? #D6FF5C : buyovershoot1? #D1FF47 : buyovershoot2? #B8E62E : buyovershoot3? #8FB224 : na)

// Uncode for line chart with indicators //
c = sell? #FF0000 : buy? #00FF00 : sellovershoot? #FF66A3 : sellovershoot1? #FF3385 : sellovershoot2? #FF0066 : sellovershoot3? #CC0052 : buyovershoot? #D6FF5C : buyovershoot1? #D1FF47 : buyovershoot2? #B8E62E : buyovershoot3? #8FB224 : #c0c0c0
plot(close, color=c, linewidth=1)
3/9/27/9 Zero Lag EMA / EMA / Pivots / Dynamic Suppor
I liked the concept !!!
Thank you!!!
The problem is that it does not work! (Writes: Index should not be negative! (-8)
Help fix it !!!!! you are welcome!!!
3/9/27/9 Zero Lag EMA / EMA / Pivots / Dynamic Suppor
I liked the concept !!!
Thank you!!!
The problem is that it does not work! (Writes: Index should not be negative! (-8)
Help fix it !!!!! you are welcome!!!
I found this script very promising but with the default settings I got error message "Index should not be negative(-8)". Setting the last parameter "Pivot Period Length" to 1 it is working but it makes the chart and the script unusable. I don't know how to correct this. Can you help me out?
+12 Reply
@korn, I just saw this script yesterday and I'm trying to find a workaround. I think that a possible way to fix it is to replace '' in both 'high_pivot' and 'low_pivot' for ''. Then, you need to include ', offset= - (plen + plen)' in every plot that uses high_pivot and low_pivot as a direct or indirect source, for example:

plot(high_pivot + 1, color=red, style=circles, linewidth=3, offset= - (plen + plen))

naoligo naoligo
@naoligo, don't know what happened, but the suggested replacements went missing lol. I think it was about HTML stuff. Anyway, you need to modify the script as below:

replace BRACKETS - dev + 1 BRACKETS for BRACKETS dev + 1 BRACKETS in both 'high_pivot' and 'low_pivot'.
+4 Reply
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out