OPEN-SOURCE SCRIPT
RSI Mansfield +

RSI Mansfield+ – Adaptive Relative Strength Indicator with Divergences
Overview
RSI Mansfield+ is an advanced relative strength indicator that compares your instrument’s performance against a configurable benchmark index or asset (e.g., Bitcoin Dominance, S&P 500). It combines Mansfield normalization, adaptive smoothing techniques, and automatic detection of bullish and bearish divergences (regular and hidden), delivering a comprehensive tool for assessing relative strength across any market and timeframe.
Originality and Motivation
Unlike traditional relative strength scripts, this indicator introduces several distinctive improvements:
These enhancements make RSI Mansfield+ more practical and powerful than conventional relative strength scripts with static benchmarks or without divergence capabilities.
Core Concepts
How It Works
Usage Guidelines
Interpretation
Credits
The concept of Mansfield Relative Strength is based on Stan Weinstein’s original work on relative performance analysis. This script was built entirely from scratch in TradingView Pine Script v6, incorporating original logic for adaptive smoothing, normalized scaling, and divergence detection, without reusing any external open-source code.
Overview
RSI Mansfield+ is an advanced relative strength indicator that compares your instrument’s performance against a configurable benchmark index or asset (e.g., Bitcoin Dominance, S&P 500). It combines Mansfield normalization, adaptive smoothing techniques, and automatic detection of bullish and bearish divergences (regular and hidden), delivering a comprehensive tool for assessing relative strength across any market and timeframe.
Originality and Motivation
Unlike traditional relative strength scripts, this indicator introduces several distinctive improvements:
- Mansfield Normalization: Scales the ratio between the asset and the benchmark relative to its moving average, transforming it into a normalized oscillator that fluctuates around zero, making it easier to spot outperformance or underperformance.
- Adaptive Smoothing: Automatically selects whether to use EMA or SMA based on the market type (crypto or stocks) and timeframe (intraday, daily, weekly, monthly), avoiding manual configuration and providing more robust results under varying volatility conditions.
- Divergence Detection: Identifies four types of divergences in the Mansfield oscillator to help anticipate potential reversal points or trend confirmations.
- Multi-Market Support: Offers benchmark selection among major crypto and global stock indices from a single input.
These enhancements make RSI Mansfield+ more practical and powerful than conventional relative strength scripts with static benchmarks or without divergence capabilities.
Core Concepts
- Relative Strength (RS): Compares price evolution between your asset and the selected benchmark.
- Mansfield Normalization: Measures how much the RS deviates from its historical moving average, expressed as a scaled oscillator.
- Divergences: Detects regular and hidden bullish or bearish divergences within the Mansfield oscillator.
- Timeframe Adaptation: Dynamically adjusts moving average lengths based on timeframe and market type.
How It Works
- Benchmark Selection
Choose among over 10 indices or market domains (BTC Dominance, ETH Dominance, S&P 500, European indices, etc.). - Ratio Calculation
Computes the price-to-benchmark ratio and smooths it with the adaptive moving average. - Normalization and Scaling
Transforms deviations into a Mansfield oscillator centered around zero. - Dynamic Coloring
Green indicates relative outperformance, red signals underperformance. - Divergence Detection
Automatically identifies bullish and bearish (regular and hidden) divergences by comparing oscillator pivots against price pivots. - Baseline Reference
A clear zero line helps interpret relative strength trends.
Usage Guidelines
- Benchmark Comparison
Ideal for traders analyzing whether an asset is outperforming or lagging its sector or market. - Divergence Analysis
Helps detect potential reversal or continuation signals in relative strength. - Multi-Timeframe Compatibility
Can be applied to intraday, daily, weekly, or monthly charts.
Interpretation
- Oscillator >0 and green: outperforming the benchmark.
- Oscillator <0 and red: underperforming.
- Bullish divergences: potential relative strength reversal to the upside.
- Bearish divergences: possible loss of momentum or reversal to the downside.
Credits
The concept of Mansfield Relative Strength is based on Stan Weinstein’s original work on relative performance analysis. This script was built entirely from scratch in TradingView Pine Script v6, incorporating original logic for adaptive smoothing, normalized scaling, and divergence detection, without reusing any external open-source code.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.