OPEN-SOURCE SCRIPT

Manish 3 EMA with Auto Lines + Numbers

61
//version=5
indicator("Manish 3 EMA with Auto Lines + Numbers", overlay=true)

// === Input for EMAs ===
ema9Length = input.int(9, title="EMA 9")
ema15Length = input.int(15, title="EMA 15")
ema44Length = input.int(44, title="EMA 44")

// === Calculate EMAs ===
ema9 = ta.ema(close, ema9Length)
ema15 = ta.ema(close, ema15Length)
ema44 = ta.ema(close, ema44Length)

// === Plot EMAs ===
plot(ema9, color=color.new(color.green, 0), title="EMA 9", linewidth=2)
plot(ema15, color=color.new(color.red, 0), title="EMA 15", linewidth=2)
plot(ema44, color=color.new(color.yellow,0), title="EMA 44", linewidth=2)

// === Variables for lines and labels ===
var line line9 = na
var line line15 = na
var line line44 = na
var label label9 = na
var label label15 = na
var label label44 = na

if barstate.islast
// Delete previous lines and labels
line.delete(line9)
line.delete(line15)
line.delete(line44)
label.delete(label9)
label.delete(label15)
label.delete(label44)

// Draw new solid lines (1px)
line9 := line.new(bar_index - 1, ema9, bar_index, ema9, extend=extend.right, color=color.new(color.green, 0), width=1)
line15 := line.new(bar_index - 1, ema15, bar_index, ema15, extend=extend.right, color=color.new(color.red, 0), width=1)
line44 := line.new(bar_index - 1, ema44, bar_index, ema44, extend=extend.right, color=color.new(color.yellow, 0), width=1)

// Add small number labels near lines
label9 := label.new(bar_index, ema9, "9", style=label.style_label_left, color=color.new(color.green, 0), textcolor=color.white, size=size.tiny)
label15 := label.new(bar_index, ema15, "15", style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.tiny)
label44 := label.new(bar_index, ema44, "44", style=label.style_label_left, color=color.new(color.yellow, 0), textcolor=color.black, size=size.tiny)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.