kobaltttt

3/9/27/9 Zero Lag EMA / EMA / Pivots / Dynamic Support (Fixed)

// Fixed error message "Index should not be negative(-8)"

//
// @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)

src=close
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)
d=ema1-ema2
zlema=ema1+d
ema3=ema(src, length2)

// ema, zero lag ema
ema4=ema(src, length)
ema5=ema(ema4, length)
d2=ema4-ema5
zlema2=ema4+d
ema6=ema(src, length2)

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


// Sell Setup
priceflip = barssince(close<close)
sellsetup = close>close 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)
buysetup = close<close 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
TDhigh = valuewhen(val,high,0)
val1= sell !=buy
TDlow = valuewhen(val1,low,0)

////////////////////////////
// PLOTTING

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)

plotchar(buy,'9b','9',location.belowbar,color=lime,transp=0)
plotchar(sell,'9s','9',location.abovebar,color=red,transp=0)
plotchar(buy8,'8b','8',location.belowbar,color=lime,transp=0)
plotchar(sell8,'8s','8',location.abovebar,color=red,transp=0)

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)
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?