OPEN-SOURCE SCRIPT

EMA Buy/Sell Signals

55
//version=5
indicator("EMA Buy/Sell Signals", overlay=true)

// Calculate the 20-period EMA on the 1-hour chart
ema20 = request.security(syminfo.tickerid, "60", ta.ema(close, 20))

// Calculate the 10-period EMA on the 3-minute chart
ema10 = ta.ema(close, 10)

// Determine the bias based on the 1-hour chart
var float bias = na
if (ema20 != na)
bias := close > ema20 ? 1 : -1

// Identify entry signals on the 3-minute chart
longCondition = (bias == 1) and ta.crossover(close, ema10)
shortCondition = (bias == -1) and ta.crossunder(close, ema10)

// Plot signals on the chart
plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="Buy")
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="Sell")

// Plot EMA lines on the chart
plot(ema20, title="EMA 20", color=color.blue)
plot(ema10, title="EMA 10", color=color.orange)

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.