NEWCard payments are live · from $18/month, USDT also acceptedSee plans
COINPRED / STRATEGY LIBRARY

Bitcoin RSI Divergence Reversal: Optional Filters and Percent Stops

An open-source (MPL 2.0) BullByte long/short reversal strategy. By default it enters only on a simplified price-and-RSI divergence; volume, ADX, Bollinger Band and fast/slow RSI-cross filters are optional and off. Stops and targets are fixed percentages of the entry price. Includes the author’s BTCUSDT 15-minute chart and an inputs guide. No invented backtest figures.

Illustrated guidesPine Script®Included with monthly & annual plans
← All strategies
BullByte · 8.0 · 2026-11-19 · Mean reversion
Bitcoin RSI Divergence Reversal: Optional Filters and Percent Stops

The idea

This long/short system looks for short-term reversals. It compares a short window of price extremes with the same window on RSI: a lower price low plus a higher RSI low counts as bullish divergence, and a higher price high plus a lower RSI high counts as bearish divergence. On a confirmed bar it enters, then places a fixed-percent stop and target from average entry price.

The publication write-up presents volume, volatility and trend filters as part of the setup, but in the source those four filters—volume, ADX, Bollinger close confirmation and the fast/slow RSI cross—are optional and off by default. With the defaults unchanged, entries depend only on that simplified divergence. This guide follows the source. The script is Pine Script v6 strategy() code with process_orders_on_close enabled.

Author chart of the RSI divergence reversal strategy on BINANCE:BTCUSDT 15-minute
Author chart: BINANCE:BTCUSDT, 15-minute timeframe, taken from the publication page. The image shows the strategy UI and trade marks; it only illustrates appearance and is not a Coinpred backtest.

Indicators

  • Main RSI: ta.rsi(close, rsiLength), default length 8; the script uses the previous bar’s value in the rules.
  • Divergence window: 5 bars by default. For longs it compares the lowest low of the last 5 bars with the lowest low of that window shifted one bar earlier, and does the same for RSI troughs; a lower price low with a higher RSI low is bullish divergence. Shorts use highs and RSI peaks the same way.
  • This is not classic pivot divergence (no confirmed swing high/low first). It is a sliding-window high/low comparison.
  • Optional filters (all off by default): previous volume at least twice its 20-bar SMA; ADX(14,14) above the threshold (default 20) with DI alignment; previous close below the lower band for longs or above the upper band for shorts (Bollinger length 20, 2 standard deviations); fast RSI(14) crossing slow RSI(21).
  • DMI, Bollinger Bands and the volume SMA also use the previous bar, so decisions are not taken on an unfinished candle.

Entry rules

  • Both long and short; strategy.entry runs when barstate.isconfirmed is true.
  • Long: bullDiv is true and every enabled filter passes.
  • Short: bearDiv is true and every enabled filter passes.
  • Default size is 30% of equity, with initial_capital set to 1000. calc_on_every_tick = false and process_orders_on_close = true, so orders are processed on the close.
  • Alert conditions exist for long and short entries. They are plain-text notices; the script does not fill exchange or bot credentials.

Exits and position sizing

  • Longs stop at average entry × (1 − stop-loss %) and target average entry × (1 + take-profit %). Shorts use the inverse.
  • Defaults are a 1% stop and a 2% target, placed together with strategy.exit as stop and limit.
  • There is no trailing stop and no time-based exit; the trade stays open until stop or target.
  • Dashed green and red lines mark the target and stop after entry and are deleted on exit. They are visual only and do not add a second exit rule.

Inputs (source defaults)

InputDefaultPurpose
RSI Length8Main RSI period used for divergence
Fast / Slow RSI Length14 / 21Optional crossover filter RSIs
BB Length20Bollinger period (std-dev multiplier is fixed at 2)
ADX Threshold20Minimum ADX for the optional trend filter
Divergence Lookback5Window for price and RSI extremes
Volume ≥ 2× SMAfalseOptional volume filter, off by default
ADX Strength & AlignmentfalseOptional ADX and DI filter, off by default
BB Close ConfirmationfalseOptional Bollinger close filter, off by default
RSI Crossover ConfirmationfalseOptional RSI cross filter, off by default
Stop-Loss % / Take-Profit %1.0 / 2.0Fixed percentages from average entry
default_qty_value3030% of equity per entry

Things to know before using it

  • The publication text reads as if several filters are always in play; in the source they default to off. Turn them on in settings if you want the multi-condition behaviour described on the page.
  • The divergence test is a sliding-window comparison, so the rhythm will differ from hand-marked pivot divergence, especially in a run of new highs or lows.
  • Most series use the previous bar, and orders process on the close, so signals lag the live RSI you see mid-bar.
  • A 30% equity default with a 1% stop can still stack losses on a 15-minute chart. Reduce size to match the drawdown you can tolerate.
  • The author chart is BTCUSDT on 15 minutes. Backtest other intervals or markets on their own, and consider retuning RSI length and the divergence window.

Installing it on TradingView

  1. Download the .pine file from Coinpred (active membership required, see below), or check the original page for the latest version.
  2. Open the Pine Editor on TradingView, create a blank script, paste the full source and save.
  3. Click Add to chart; start with BTCUSDT 15-minute so you can compare with the author image.
  4. If you want volume, ADX, Bollinger or RSI-cross confirmation, enable those inputs, then tune the stop and target percentages.
  5. Study signals and fills in the Strategy Tester before setting alerts. Past results do not guarantee future returns.

About backtest figures

Source, license and version

  • Author: BullByte. Original title: Reversal Trading Bot Strategy [BullByte] Final Version. Version 8.0 (pine-facade).
  • License: Mozilla Public License 2.0 (MPL 2.0). Coinpred provides the full, unmodified source.
  • Original page: https://www.tradingview.com/script/cXVnf1WH-Reversal-Trading-Bot-Strategy-BullByte/
  • Pine version: v6; script type: strategy().
  • Images come from the author’s publication page, are not covered by the MPL, and are captioned “Author chart”.
  • Downloads are subject to Coinpred membership terms. If you modify the source file, the modified file must remain under MPL 2.0.

Source, license and version

Mozilla Public License 2.0 (MPL 2.0),© BullByte,依据源码头部许可声明。再分发须保留原版权与许可声明;如修改源码文件,修改后的文件仍须按 MPL 2.0 提供。Coinpred 未修改源码。 / Licensed under MPL 2.0 per the source header, © BullByte. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified source.

View original source ↗

Check the script license and your TradingView account features. Historical results do not guarantee future performance.