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

Bitcoin Dual RSI Differential: Trade the RSI Spread with a Holding Window

An open-source (MPL 2.0) PresentTrading strategy that subtracts a shorter RSI from a longer RSI, going long when the spread drops below a negative threshold and short when it rises above a positive one. A 5-day holding window is on by default, with an earlier exit if the spread flips; stop and take-profit are off. Some on-chart labels disagree with the default inputs—this guide follows the source. Includes the author’s BTCUSD 6-hour chart. No invented backtest figures.

Illustrated guidesPine Script®Included with monthly & annual plans
← All strategies
PresentTrading · 1.0 · 2026-11-19 · Trend following
Bitcoin Dual RSI Differential: Trade the RSI Spread with a Holding Window

The idea

This system does not trade a single RSI against overbought or oversold bands. It compares two RSI lengths. In the source the spread is the longer RSI minus the shorter RSI. When the short RSI is clearly stronger and the spread falls through the negative threshold, it goes long. When the short RSI is clearly weaker and the spread rises through the positive threshold, it goes short. That is momentum in the RSI spread, not a classic 30/70 mean-reversion rule.

A 5-day holding window is on by default: the trade exits when that time is up, or sooner if the spread hits the opposite threshold. The stop and take-profit option defaults to None. The script uses overlay = false, so the main plot is the spread, not candles. A few labels on the page and in the source still mention RSI 7/35 or ±20, which does not match the default inputs of 21/42 and a threshold of 5. The sections below follow the inputs. The script is Pine Script v5 strategy() code.

Author chart of the dual RSI differential strategy on BITFINEX:BTCUSD 6-hour
Author chart: BITFINEX:BTCUSD, 6-hour timeframe, taken from the publication page. The spread, thresholds and Strategy Tester UI are visible; the image only shows what the UI looks like and is not a Coinpred backtest.

Indicators

  • Short RSI: ta.rsi(close, lengthShort), default 21.
  • Long RSI: ta.rsi(close, lengthLong), default 42.
  • Spread rsiDifference = rsiLong − rsiShort. The threshold is rsiDiffLevel, default 5.
  • Long condition: spread < −threshold (the short RSI is at least the threshold above the long RSI). Short condition: spread > +threshold.
  • Long exit: spread > +threshold. Short exit: spread < −threshold. The same symmetric levels unwind the other side.
  • The hline titles say Level +20 / Level -20, the plot title says RSI Difference (35-7), and the alert text mentions RSI7 and RSI35. Those are labels only; they do not change the default inputs of 21, 42 and 5.

Entry rules

  • Long, short or both, controlled by Trading Direction (default Both).
  • Long: when combinedLongCondition is true, strategy.entry("Long") and store longEntryTime.
  • Short: when combinedShortCondition is true, strategy.entry("Short") and store shortEntryTime.
  • Default size is 10% of equity, with 0.1% commission, slippage 1 and initial capital 10,000.
  • The entry call can fire again on every bar while the condition stays true. Watch the fill log if the tester allows pyramiding or repeat orders.

Exits and position sizing

  • Use Hold Days defaults to true and Hold Days to 5. When that switch is on, strategy.close runs if current time minus entry time is at least five days, or if the spread reaches the opposite threshold.
  • If you turn the holding window off, the script closes only when the spread hits the opposite threshold.
  • TPSL Condition defaults to None, so strategy.exit stops and targets are not placed by default.
  • If you set TPSL to TP, SL or Both, the source writes profit/loss (tick-style arguments) and limit/stop (price arguments) from the current close, and it recalculates them every bar. That is not the usual “percent from entry” stop. Check actual exit prices in the tester before relying on it.
  • There is no trailing stop. The default path is the holding window or a spread reversal.

Inputs (source defaults)

InputDefaultPurpose
Trading DirectionBothLong only, short only, or both
Short RSI Period21Shorter RSI (the label’s 7 is not the default)
Long RSI Period42Longer RSI (the label’s 35 is not the default)
RSI Difference Level5Spread threshold (hline titles still say ±20)
Use Hold Days / Hold Daystrue / 5Default time exit; max input is 20 days
TPSL ConditionNoneOptional stop/target; off by default
Take Profit (%) / Stop Loss (%)15.0 / 10.0Used only if TPSL is enabled
default_qty_value1010% of equity per entry

Things to know before using it

  • The publication frames this as a finer way to trade overbought and oversold conditions, but the source has no 30/70 RSI bands. It only compares the spread between two RSI lengths.
  • The 7, 35 and ±20 figures in labels and alerts do not match the default inputs. Trust the input fields, not the label text.
  • The script plots in a separate pane. Open the Strategy Tester as well so you can line signals up with the price chart.
  • The default five-day hold uses 5 × 86,400,000 milliseconds of calendar time, not a bar count. On a 6-hour chart that is about 20 bars; on other intervals the number of bars changes while the day count stays the same.
  • The author chart is Bitfinex BTCUSD on 6 hours. Backtest other symbols or intervals on their own, and consider retuning both RSI lengths and the spread threshold.

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 BTCUSD 6-hour so you can compare with the author image, and open the Strategy Tester.
  4. Confirm the holding window and trade direction first. Only enable TPSL after you have checked exit prices in the tester.
  5. Study the spread signals and fills before setting alerts. Past results do not guarantee future returns.

About backtest figures

Source, license and version

  • Author: PresentTrading. Original title: Dual RSI Differential - Strategy [presentTrading]. Version 1.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/VHbRaeUe-Dual-RSI-Differential-Strategy-presentTrading/
  • Pine version: v5; 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),© PresentTrading,依据源码头部许可声明。再分发须保留原版权与许可声明;如修改源码文件,修改后的文件仍须按 MPL 2.0 提供。Coinpred 未修改源码。 / Licensed under MPL 2.0 per the source header, © PresentTrading. 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.