instrument {
name = "Sinal Pro EMA + RSI",
icon = "indicators:MA",
overlay = true
}
-- Definindo os períodos como entradas do usuário
fast_length = input(9, "Período EMA Rápida", input.integer, 1)
slow_length = input(21, "Período EMA Lenta", input.integer, 1)
rsi_length = input(14, "Período RSI", input.integer, 1)
-- Calculando os indicadores
emaFast = ema(close, fast_length)
emaSlow = ema(close, slow_length)
rsiValue = rsi(close, rsi_length)
-- Plotando os indicadores
plot(emaFast, "EMA Rápida", color.green)
plot(emaSlow, "EMA Lenta", color.red)
-- Condições de compra e venda
if (emaFast > emaSlow and rsiValue < 70) then
signal("call", "COMPRA Forte (EMA cruzou e RSI OK)")
end
if (emaFast < emaSlow and rsiValue > 30) then
signal("put", "VENDA Forte (EMA cruzou e RSI OK)")
end