//@version=5
indicator(title="Elder Force Index Strategy", shorttitle="EFI", format=format.volume, timeframe="", timeframe_gaps=true)

// Input para o comprimento da EMA
length = input.int(13, title="Length", minval=1)

// Cálculo do Elder Force Index (EFI)
efi = ta.ema(ta.change(close) * volume, length)

// Plot do EFI
plot(efi, color=#F44336, title="Elder Force Index")

// Sinal de Compra (Cruzamento acima de 0)
buySignal = efi > 0 and efi <= 0
// Sinal de Venda (Cruzamento abaixo de 0)
sellSignal = efi < 0 and efi >= 0

// Plot dos sinais de compra e venda no gráfico
plotshape(series=buySignal, title="Buy Signal", color=color.green, style=shape.triangleup, location=location.belowbar, size=size.small)
plotshape(series=sellSignal, title="Sell Signal", color=color.red, style=shape.triangledown, location=location.abovebar, size=size.small)

// Adiciona setas para sinais
bgcolor(buySignal ? color.new(color.green, 95) : na)
bgcolor(sellSignal ? color.new(color.red, 95) : na)
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.