OPEN-SOURCE SCRIPT

EMA Buy/Sell Signals

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

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.