OPEN-SOURCE SCRIPT
Aktualisiert

SD Stochastic RSI Trend

1 347
SD Stochastic RSI Trend
SD Stochastic RSI Trend is a trend-following indicator that combines a percentile-based standard deviation filter with a Stochastic RSI momentum confirmation — identifying high-conviction directional moves while keeping exits fast and responsive.

The result is a dynamic line that moves with the market — turning blue when a bullish trend is confirmed and red when bearish, with a fill between the line and price for clear visual trend identification.

How It Works
Two independent systems validate whether a trend change is genuine:
  • Standard Deviation Filter — a percentile median is calculated from a configurable price source. The standard deviation of this median defines an upper statistical boundary. Price must close above this boundary for a long and below it for a short — ensuring only statistically significant moves trigger a signal
  • Stochastic RSI — measures where the RSI is relative to its own recent range. K must be above D for a long — confirming that momentum is genuinely building in the bullish direction. The Stochastic RSI is only required for long signals, making short exits faster and more responsive than entries


The long condition requires both systems to agree simultaneously. The short condition only requires the SD filter — exits are deliberately faster than entries.

Why This Approach Works
Most trend indicators rely on price position alone to detect direction. SD Stochastic RSI Trend adds a second independent layer — momentum confirmation via Stochastic RSI — ensuring that a long signal only fires when price is statistically above its own median boundary AND momentum is genuinely building. This eliminates weak or noise-driven entries where price crosses a level without real conviction behind it.

The asymmetric design is intentional and reflects the structural reality of markets like crypto. Longs require both conditions — statistical price strength and momentum confirmation. Shorts only require the SD filter — allowing quick exits when the statistical boundary is lost without waiting for momentum to fully confirm.

Settings
  • Median Source — Price source for the percentile median calculation (default: hl2)
  • Median Length — Lookback period for the percentile median (default: 62)
  • SD Length — Lookback period for the standard deviation calculation (default: 30)
  • K — Smoothing period for the Stochastic K line (default: 25)
  • D — Smoothing period for the Stochastic D line (default: 8)
  • RSI Length — Lookback period for the RSI calculation (default: 9)
  • Stochastic Length — Lookback period for the Stochastic calculation (default: 30)
  • Use Bar Coloring — Colors bars based on the current trend state (default: true)
  • Color Background — Enables background coloring of the chart based on the current state (default: false)
  • Background Transparency — Controls the transparency of the background color (default: 85)


How to trade it
  • Long — when the line turns blue and sits below price with a blue fill above it, both systems have confirmed a bullish trend. This is the signal to look for long entries or to hold existing long positions
  • Short / Cash — when the line turns red and sits above price with a red fill below it, the statistical boundary has been lost. This is the signal to exit longs, move to cash, or look for short entries depending on your strategy
  • Avoid trading against the trend — if the line is red do not look for longs, if the line is blue do not look for shorts


Recommended Usage
  • Best used on the 1D timeframe for clean and reliable trend identification
  • Should not be used alone for trade entries — combine with an additional volume or structural indicator for confirmation
  • The asymmetric design makes this indicator particularly well suited for bullish-biased markets like crypto — longs require full confirmation while shorts are fast and decisive
  • Higher Stochastic Length values smooth the momentum signal — lower values make it more sensitive to short-term momentum shifts
  • Adjust Median Length and SD Length together to control how wide the statistical boundary is — longer values create more stable signals, shorter values make the indicator more reactive


All signals are confirmed on bar close.
Versionshinweise
Added an optional "Show Cloud" setting under Plot — when disabled the fill between the SD line and price is hidden, showing only the indicator line and bar coloring. Enabled by default.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.