Indicator · Pine Script v4 · On the chart

Señal Compra/Venta

by LucasNatoli

This indicator plots buy and sell markers on the price chart using RSI and Bollinger Bands.

View on GitHub

GitHub stars1on the repository
Pine versionv4older, still runs
Lines of code35
Settings7inputs
LicenceCC0-1.0
Last update2 years ago8 Jan 2024

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

35 lines of Pine Script v4 from señales.pine, published under CC0-1.0. Keep the author's credit and licence lines when you reuse it.

señales.pine
//@version=4
study(title="Señal Compra/Venta", shorttitle="Señal Compra/Venta", overlay=true)

// Input del usuario
rsiSource = input(title="RSI Source", type=input.source, defval=close)
rsiLength = input(title="RSI Length", type=input.integer, defval=14)
rsiOverbought = input(title="RSI Overbought Level", type=input.integer, defval=70)
rsiOversold = input(title="RSI Oversold Level", type=input.integer, defval=30)

bbSource = input(title="BB Source", type=input.source, defval=close)
bbLength  = input(title="BB Length", type=input.integer, defval=20)
bbMult = input(title="BB Mult", type=input.integer, defval=2)

// Obtener el RSI
rsiValue = rsi(rsiSource, rsiLength)
isRsiOB = rsiValue >= rsiOverbought
isRsiOS = rsiValue <= rsiOversold

// Obtener Bollinger Bands
[middle, upper, lower] = bb(bbSource, bbLength, bbMult)
isBBTop = upper <= close
isBBBottom = lower >= close

isSellSignal = isRsiOB and isBBTop
isBuySignal = isRsiOS and isBBBottom

// Dibujar las señales en el gráfico
plotshape(isSellSignal, title="SELL", location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, size=size.tiny, text="SELL")
plotshape(isBuySignal, title="BUY", location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup, size=size.tiny, text="BUY")

p1 = plot(upper, title='Upper', color=#0091ff, linewidth=1)
p2 = plot(lower, title='Lower', color=#0091ff, linewidth=1)
p3 = plot(middle, title='Middle', color=#ff0000, linewidth=1)
// Enviar una alerta si esta vela cumple las condiciones.
alertcondition(isSellSignal or isBuySignal, title="Señal Activada!", message="Señal Compra/Venta activada para XXX")

Overview

A buy triangle appears when RSI is at or below the oversold level and the close is at or below the lower band. A sell triangle appears when RSI is at or above the overbought level and the close is at or above the upper band. Inputs set the RSI source, length and levels, plus the Bollinger source, length and multiplier. It also draws the three bands and fires an alert when either signal is true. It does not manage exits or position size.

Details

Published by

LucasNatoli on GitHub

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Oscillators & momentum, Volatility & bands, Mean reversion

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
RSI SourcesourceclosersiSource
RSI Lengthint14rsiLength
RSI Overbought Levelint70rsiOverbought
RSI Oversold Levelint30rsiOversold
BB SourcesourceclosebbSource
BB Lengthint20bbLength
BB Multint2bbMult
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This indicator plots trade entry and exit signals on the price chart by combining Bollinger Bands with optional filter conditions. It calculates standard Bollinger Bands along with RSI, Aroon, and moving average filters. Reversal signals trigger when price bre

Indicator v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner IND [Alorse]
147 stars

This indicator combines Bollinger Bands, RSI, Stochastic RSI, and volume spike detection to identify mean-reversion conditions during range-bound market regimes. It calculates Bollinger Band width to identify low-volatility states and triggers buy or sell sign

Indicator v5 Oscillators & momentumVolatility & bands
Updated 6 weeks ago · MIT GitHub repository of BTC Dec 2025 — Range + Gamma Flush

Commodity Heat Reversal plots score-based mean-reversion reversal markers on the price chart for commodity futures, aimed at the four-hour timeframe. It builds separate long and short heat scores from ATR distance to a mean moving average, ATR expansion, RSI e

Indicator v6 Mean reversionVolatility & bands
Updated yesterday · MIT GitHub repository of Commodity Heat Reversal [WavesUnchained]
8 stars

This indicator detects contrarian inflection points and potential market reversals by combining sentiment, volume, and price action metrics directly on the price chart. It evaluates overbought and oversold conditions with the RSI and Stochastic oscillators, hi

Indicator v5 Oscillators & momentumVolatility & bands
Updated 7 weeks ago · None stated GitHub repository of GCR Inflection Point Scanner

Antigravity Elite

by eltonaguiar
4 stars

Antigravity Elite is an overlay indicator that screens price with seven selectable components: Mercury Fear, Connors RSI-2, volatility-spike reversal, EMA stack, Supertrend, multi-sigma bands, and an optional funding proxy. Auto-Detect chooses one method, whil

Indicator v6 Oscillators & momentumMoving averages
Updated today · None stated GitHub repository of Antigravity Elite
4 stars

Calculates Bollinger Bands, RSI, and Stochastic to identify potential reversal opportunities directly on the price chart. It plots buy signals when the bar low is within a set distance of the lower Bollinger Band while both RSI and Stochastic register oversold

Indicator v4 Oscillators & momentumVolatility & bands
Updated 4 years ago · None stated GitHub repository of RSI and Stoch (Brahim)

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers