OPEN-SOURCE SCRIPT

Suporte e Resistência com Sinais de Compra/Venda

//version=5
indicator("Suporte e Resistência com Sinais de Compra/Venda", shorttitle="S&R com Sinais", overlay=true)

// Parâmetros
resistanceColor = color.red
supportColor = color.green

// Função para calcular os níveis de suporte e resistência
calculateSupportResistance() =>
// Calcule os níveis de suporte e resistência
support = ta.lowest(low, 20)
resistance = ta.highest(high, 20)

[support, resistance]

[supportLevel, resistanceLevel] = calculateSupportResistance()

// Plotar linhas de suporte e resistência
plot(supportLevel, title="Suporte", color=supportColor, linewidth=2)
plot(resistanceLevel, title="Resistência", color=resistanceColor, linewidth=2)

// Sinal de Compra quando toca no Suporte
plotshape(series=ta.crossover(close, supportLevel) ? 1 : na, title="Sinal de Compra", location=location.belowbar, color=color.green, style=shape.triangleup, text="Compra")

// Sinal de Venda quando toca na Resistência
plotshape(series=ta.crossunder(close, resistanceLevel) ? 1 : na, title="Sinal de Venda", location=location.abovebar, color=color.red, style=shape.triangledown, text="Venda")
Bill Williams Indicators

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer