OPEN-SOURCE SCRIPT
EMA HI/LO Cloud Shift + Extra EMA

//version=6
indicator("EMA HI/LO Cloud Shift + Extra EMA + Shift EMA Line", overlay=true, max_lines_count=6, max_labels_count=0)
// ------------------------
// Inputs
// ------------------------
emaLength = input.int(22, "Main EMA Length", minval=1, maxval=200)
emaLineColor = input.color(color.blue, "Main EMA Lines Color")
// Main Cloud colors
cloudAboveColor = input.color(color.new(color.green, 80), "Main Cloud Color (Price Above)")
cloudBelowColor = input.color(color.new(color.red, 80), "Main Cloud Color (Price Below)")
cloudInsideColor = input.color(color.new(color.orange, 80), "Main Cloud Color (Price Inside)")
// ------------------------
// Shift EMA (new logic)
// ------------------------
showShiftEMA = input.bool(true, "Show Shift EMA Line?")
shiftEMALength = input.int(26, "Shift EMA Length", minval=1, maxval=500)
shiftEMASource = input.source(close, "Shift EMA Source") // fully customizable source
shiftEMAColor = input.color(color.purple, "Shift EMA Color")
shiftEMAWide = input.int(2, "Shift EMA Line Width", minval=1, maxval=5)
shiftEMAOffset = input.int(0, "Shift EMA Offset", minval=-100, maxval=100)
// ------------------------
// Second EMA (independent)
// ------------------------
showSecondEMA = input.bool(true, "Show Second EMA?")
secondEMALength = input.int(200, "Second EMA Length", minval=1, maxval=1000)
secondEMAColor = input.color(color.yellow, "Second EMA Color")
secondEMAWide = input.int(2, "Second EMA Line Width", minval=1, maxval=5)
// ------------------------
// Main EMA Cloud Calculations
// ------------------------
emaHigh = ta.ema(high, emaLength)
emaLow = ta.ema(low, emaLength)
// ------------------------
// Main Cloud logic
// ------------------------
priceAboveMain = close > emaHigh
priceBelowMain = close < emaLow
priceInsideMain = not priceAboveMain and not priceBelowMain
cloudColorMain = priceAboveMain ? cloudAboveColor : priceBelowMain ? cloudBelowColor : cloudInsideColor
p1_main = plot(emaHigh, title="Main EMA High", color=emaLineColor, linewidth=2)
p2_main = plot(emaLow, title="Main EMA Low", color=emaLineColor, linewidth=2)
fill(p1_main, p2_main, color=cloudColorMain, title="Main EMA Cloud")
// ------------------------
// Shift EMA Line (replaces cloud offset)
// ------------------------
shiftEMA = ta.ema(shiftEMASource, shiftEMALength)
plot(showShiftEMA ? shiftEMA : na, title="Shift EMA Line", color=shiftEMAColor, linewidth=shiftEMAWide, offset=shiftEMAOffset)
// ------------------------
// Second EMA Plot (Independent)
// ------------------------
secondEMA = ta.ema(close, secondEMALength)
plot(showSecondEMA ? secondEMA : na, title="Second EMA", color=secondEMAColor, linewidth=secondEMAWide)
indicator("EMA HI/LO Cloud Shift + Extra EMA + Shift EMA Line", overlay=true, max_lines_count=6, max_labels_count=0)
// ------------------------
// Inputs
// ------------------------
emaLength = input.int(22, "Main EMA Length", minval=1, maxval=200)
emaLineColor = input.color(color.blue, "Main EMA Lines Color")
// Main Cloud colors
cloudAboveColor = input.color(color.new(color.green, 80), "Main Cloud Color (Price Above)")
cloudBelowColor = input.color(color.new(color.red, 80), "Main Cloud Color (Price Below)")
cloudInsideColor = input.color(color.new(color.orange, 80), "Main Cloud Color (Price Inside)")
// ------------------------
// Shift EMA (new logic)
// ------------------------
showShiftEMA = input.bool(true, "Show Shift EMA Line?")
shiftEMALength = input.int(26, "Shift EMA Length", minval=1, maxval=500)
shiftEMASource = input.source(close, "Shift EMA Source") // fully customizable source
shiftEMAColor = input.color(color.purple, "Shift EMA Color")
shiftEMAWide = input.int(2, "Shift EMA Line Width", minval=1, maxval=5)
shiftEMAOffset = input.int(0, "Shift EMA Offset", minval=-100, maxval=100)
// ------------------------
// Second EMA (independent)
// ------------------------
showSecondEMA = input.bool(true, "Show Second EMA?")
secondEMALength = input.int(200, "Second EMA Length", minval=1, maxval=1000)
secondEMAColor = input.color(color.yellow, "Second EMA Color")
secondEMAWide = input.int(2, "Second EMA Line Width", minval=1, maxval=5)
// ------------------------
// Main EMA Cloud Calculations
// ------------------------
emaHigh = ta.ema(high, emaLength)
emaLow = ta.ema(low, emaLength)
// ------------------------
// Main Cloud logic
// ------------------------
priceAboveMain = close > emaHigh
priceBelowMain = close < emaLow
priceInsideMain = not priceAboveMain and not priceBelowMain
cloudColorMain = priceAboveMain ? cloudAboveColor : priceBelowMain ? cloudBelowColor : cloudInsideColor
p1_main = plot(emaHigh, title="Main EMA High", color=emaLineColor, linewidth=2)
p2_main = plot(emaLow, title="Main EMA Low", color=emaLineColor, linewidth=2)
fill(p1_main, p2_main, color=cloudColorMain, title="Main EMA Cloud")
// ------------------------
// Shift EMA Line (replaces cloud offset)
// ------------------------
shiftEMA = ta.ema(shiftEMASource, shiftEMALength)
plot(showShiftEMA ? shiftEMA : na, title="Shift EMA Line", color=shiftEMAColor, linewidth=shiftEMAWide, offset=shiftEMAOffset)
// ------------------------
// Second EMA Plot (Independent)
// ------------------------
secondEMA = ta.ema(close, secondEMALength)
plot(showSecondEMA ? secondEMA : na, title="Second EMA", color=secondEMAColor, linewidth=secondEMAWide)
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.