OPEN-SOURCE SCRIPT
RSI Trend Navigator [QuantAlgo]

🟢 Overview
The RSI Trend Navigator integrates RSI momentum calculations with adaptive exponential moving averages and ATR-based volatility bands to generate trend-following signals. The indicator applies variable smoothing coefficients based on RSI readings and incorporates normalized momentum adjustments to position a trend line that responds to both price action and underlying momentum conditions.

🟢 How It Works
The indicator begins by calculating and smoothing the RSI to reduce short-term fluctuations while preserving momentum information:
Pine Script®
It then creates an adaptive smoothing coefficient that varies based on RSI positioning relative to the midpoint:
Pine Script®
This coefficient drives an adaptive trend calculation that responds more quickly when RSI indicates bullish momentum and more slowly during bearish conditions:
Pine Script®
The normalized RSI values are converted into price-based adjustments using ATR for volatility scaling:
Pine Script®
ATR-based bands are constructed around this RSI-adjusted trend value to create dynamic boundaries that constrain trend line positioning:
Pine Script®
The trend line positioning uses these band constraints to determine its final value:
Pine Script®
Signal generation occurs through directional comparison of the trend line against its previous value to establish bullish and bearish states:
Pine Script®
The final output colors the trend line green during bullish states and red during bearish states, creating visual buy/long and sell/short opportunity signals based on the combined RSI momentum and volatility-adjusted trend positioning.

🟢 Signal Interpretation
The RSI Trend Navigator integrates RSI momentum calculations with adaptive exponential moving averages and ATR-based volatility bands to generate trend-following signals. The indicator applies variable smoothing coefficients based on RSI readings and incorporates normalized momentum adjustments to position a trend line that responds to both price action and underlying momentum conditions.
🟢 How It Works
The indicator begins by calculating and smoothing the RSI to reduce short-term fluctuations while preserving momentum information:
rsiValue = ta.rsi(source, rsiPeriod)
smoothedRSI = ta.ema(rsiValue, rsiSmoothing)
normalizedRSI = (smoothedRSI - 50) / 50
It then creates an adaptive smoothing coefficient that varies based on RSI positioning relative to the midpoint:
adaptiveAlpha = smoothedRSI > 50 ? 2.0 / (trendPeriod * 0.5 + 1) : 2.0 / (trendPeriod * 1.5 + 1)
This coefficient drives an adaptive trend calculation that responds more quickly when RSI indicates bullish momentum and more slowly during bearish conditions:
var float adaptiveTrend = source
adaptiveTrend := adaptiveAlpha * source + (1 - adaptiveAlpha) * nz(adaptiveTrend[1], source)
The normalized RSI values are converted into price-based adjustments using ATR for volatility scaling:
rsiAdjustment = normalizedRSI * ta.atr(14) * sensitivity
rsiTrendValue = adaptiveTrend + rsiAdjustment
ATR-based bands are constructed around this RSI-adjusted trend value to create dynamic boundaries that constrain trend line positioning:
atr = ta.atr(atrPeriod)
deviation = atr * atrMultiplier
upperBound = rsiTrendValue + deviation
lowerBound = rsiTrendValue - deviation
The trend line positioning uses these band constraints to determine its final value:
if upperBound < trendLine
trendLine := upperBound
if lowerBound > trendLine
trendLine := lowerBound
Signal generation occurs through directional comparison of the trend line against its previous value to establish bullish and bearish states:
trendUp = trendLine > trendLine[1]
trendDown = trendLine < trendLine[1]
if trendUp
isBullish := true
isBearish := false
else if trendDown
isBullish := false
isBearish := true
The final output colors the trend line green during bullish states and red during bearish states, creating visual buy/long and sell/short opportunity signals based on the combined RSI momentum and volatility-adjusted trend positioning.
🟢 Signal Interpretation
- Rising Trend Line (Green): Indicates upward momentum where RSI influence and adaptive smoothing favor continued price advancement = Potential buy/long positions
- Declining Trend Line (Red): Indicates downward momentum where RSI influence and adaptive smoothing favor continued price decline = Potential sell/short positions
- Flattening Trend Lines: Occur when momentum weakens and the trend line slope approaches neutral, suggesting potential consolidation before the next move
- Built-in Alert System: Automated notifications trigger when bullish or bearish states change, sending "RSI Trend Bullish Signal" or "RSI Trend Bearish Signal" messages for timely entry/exit
- Color Bar Candles Option: Optional candle coloring feature that applies the same green/red trend colors to price bars, providing additional visual confirmation of the current trend direction
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
👉 Access the best tools for trading & investing here (3-day FREE trial): joinquantalgo.com/
📩 DM if you need any custom-built indicators.
📩 DM if you need any custom-built indicators.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
👉 Access the best tools for trading & investing here (3-day FREE trial): joinquantalgo.com/
📩 DM if you need any custom-built indicators.
📩 DM if you need any custom-built indicators.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.