Strategy · Pine Script v4 · On the chart

Greeffer RSI Strategy

by SammyEnigma· code credited to Greeffer

Greeffer RSI Strategy is a trading strategy that generates buy and sell entries based on Bollinger Bands and RSI levels.

View on GitHub

GitHub stars18on the repository
Pine versionv4older, still runs
Lines of code48
Settings2inputs
LicenceNone statedfile: MPL-2.0
Last update6 years ago15 Oct 2020

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 strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

48 lines of Pine Script v4 from bb-rsi.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

bb-rsi.pine
//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Greeffer
strategy("Greeffer RSI Strategy", "Greeffer", true, format=format.volume, scale=scale.right, precision=0, pyramiding=5, default_qty_type=strategy.percent_of_equity, default_qty_value=2, initial_capital=100000, currency=currency.USD, commission_type=strategy.commission.percent, commission_value=0.075, process_orders_on_close=true)

source = close
length = input(20, minval=1)
mult = input(2.0, minval=0.001, maxval=50)

basis = sma(source, length)
dev = mult * stdev(source, length)

upper = basis + dev
lower = basis - dev

buyEntry = crossover(source, lower)
sellEntry = crossunder(source, upper)

// R S I
myRsi = rsi(close, 14)
//plot(myRsi, title="myRsi", color=color.blue, linewidth=2, style=plot.style_line, transp=70)
//hline(31, title='oversold', color=color.red, linestyle=hline.style_dotted, linewidth=1)
//hline(69, title='overbought', color=color.red, linestyle=hline.style_dotted, linewidth=1)

if (crossover(source, lower))
    strategy.entry("BBandRsiLE", strategy.long, stop=lower, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="BBandLE")
else
    strategy.cancel(id="BBandLE")

if (crossunder(source, upper))
    strategy.entry("BBandSE", strategy.short, stop=upper, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="BBandSE")
else
    strategy.cancel(id="BBandSE")

//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)

// L o n g  C o n d i t i o n
longCondition = myRsi <= 29 and close > lower

if (longCondition)
    strategy.entry("RsiBuy", true, 2, oca_name="Rsi069", oca_type=strategy.oca.reduce)
    // strategy.entry("RsiBuy", true, 2)
    // strategy.entry("RsiBuy", true, 1, limit, stop, oca_name="Rsi069", oca_type=strategy.oca.reduce, comment="rsiLong", when=open > high[1])

// S h o r t  C o n d i t i o n
shortCondition = myRsi >= 70
if (shortCondition)
    strategy.entry("Rsi Sell", false, 2,2, oca_name="Rsi069", oca_type=strategy.oca.reduce)

Overview

Greeffer RSI Strategy places stop orders at upper and lower Bollinger Bands on band crossovers, and adds positions when RSI reaches extreme levels. Users can customize the Bollinger Band length and standard deviation multiplier. The strategy plots on the main price chart and features pyramiding, but does not include explicit exit or stop-loss rules.

Details

Published by

SammyEnigma on GitHub

Code credit

Greeffer, as written in the script's header

Type

Strategy, Pine Script v4

Draws

On the price chart

Category

Oscillators & momentum, Volatility & bands, Mean reversion

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy can add several entries in the same direction
  • The strategy enters trades without a stop loss

Settings

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

SettingTypeDefaultVariable
lengthint20length
multfloat2.0mult
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

330 stars

Alert BB + RSI [Alorse] is a multi-symbol mean-reversion strategy designed for cryptocurrency trading. It evaluates Bollinger Bands and the Relative Strength Index (RSI) across up to 20 user-defined ticker symbols simultaneously. The strategy enters long posit

Strategy v4 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of Alert BB + RSI [Alorse]
106 stars

A multi-timeframe Dollar Cost Averaging (DCA) trading strategy that combines signals from three RSI indicators, three CCI indicators, and Bollinger Bands. It places up to five weighted scale-in safety orders to lower the average entry price. The script offers

Strategy v5 Oscillators & momentumVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of 3RSI 3CCI BB 5orders DCA Strategy+
104 stars

This strategy combines Bollinger Bands with a short RSI to fade moves that leave the bands and then return. A long requires the prior bar below the lower band and oversold, then a close back inside the band while RSI is between 30 and 50. Shorts mirror that at

Strategy v5 Oscillators & momentumVolatility & bands
Updated 3 years ago · MIT GitHub repository of Bollinger Bands and RSI Strategy
13 stars

This strategy overlays the price chart to trade DAX futures during European market hours. It calculates exponential and simple moving averages, RSI, MACD, Bollinger Bands, ATR, and realized volatility to simulate VIX levels. Trades execute when session time fi

Strategy v5 Sessions & timeOscillators & momentum
Updated 8 months ago · Custom licence GitHub repository of ClaudeHedge - DAX Session Strategy

Calculates a combination of the Relative Strength Index, MACD histogram, and Bollinger Bands contraction to identify long trade entries. The strategy signals a long position on a bullish bar when the MACD histogram turns upward while negative, RSI remains belo

Strategy v4 Oscillators & momentumVolatility & bands
Updated 3 years ago · Apache-2.0 GitHub repository of RSI + MACD + BB Long Strategy (Not Good)

More strategys

Trade Your Charts With a Regulated Broker

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

Compare brokers