Indicator · Pine Script v6 · On the chart

Parabolic SAR + Stoch RSI

by dcaoyuan

The script calculates and plots Parabolic SAR with default parameters on the price chart.

View on GitHub

GitHub stars55on the repository
Pine versionv6current
Lines of code32
Settings0inputs
LicenceApache-2.0
Last update6 months ago20 Apr 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

32 lines of Pine Script v6 from public/indicators/sarstoch.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

sarstoch.pine
//@version=6
// This script plots Parabolic SAR and Stochastic RSI
indicator("Parabolic SAR + Stoch RSI", overlay=true)

// Parabolic SAR
start = 0.02
increment = 0.02
maximum = 0.2
psar = ta.sar(start, increment, maximum)
plot(psar, "Parabolic SAR", style=plot.style_cross, color=#2962FF)

// Stochastic RSI (We need to create a visual signal on the chart or plot it in a separate pane. 
// Since overlay=true, we can't plot the oscillator lines nicely on the main chart. 
// Strategy: I will plot "Sell" shapes when Stoch RSI crosses down in overbought area, and "Buy" shapes for oversold cross up.
// This is more actionable for the user.)

// Stoch RSI Calculation
smoothK = 3
smoothD = 3
lengthRSI = 14
lengthStoch = 14
src = close
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)

// Signals
sellSignal = ta.crossunder(k, d) and (k > 80)
buySignal = ta.crossover(k, d) and (k < 20)

plotshape(sellSignal, title="StochRSI Sell", location=location.abovebar, color=color.red, style=shape.arrowdown, text="S", textcolor=color.white, size=size.small)
plotshape(buySignal, title="StochRSI Buy", location=location.belowbar, color=color.green, style=shape.arrowup, text="B", textcolor=color.white, size=size.small)

Overview

Parabolic SAR + Stoch RSI also computes Stochastic RSI using a 14-period RSI and 14-period Stoch with 3-period smoothing. Buy signals occur when Stochastic RSI crosses above its signal line from below 20, indicated by green arrows below the bar. Sell signals trigger on cross below from above 80, shown as red arrows above the bar. All elements are overlaid on the main chart.

Details

Published by

dcaoyuan on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Oscillators & momentum, Moving averages

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

aicharttradingvibepinescripttechnical-analysispinestock

Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

948 stars

The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma

Indicator v4 Moving averagesOscillators & momentum
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average

This overlay indicator plots a Supertrend from an ATR length and factor, four exponential moving averages, and a selectable VWAP or TWAP taken from a chosen timeframe on the price chart. It also shows MACD and stochastic with adjustable lengths, smoothing, ver

Indicator v5 Oscillators & momentumMoving averages
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup: Vijay Thakare Option Buying Scalping Setup

This indicator plots trade entry and exit signals on the price chart by combining Bollinger Bands with optional filter conditions. It calculates standard Bollinger Bands along with RSI, Aroon, and moving average filters. Reversal signals trigger when price bre

Indicator v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner IND [Alorse]
318 stars

This indicator plots three moving averages on the price chart alongside colored fills between the lines to visualize trend structure. Internally, it calculates a Stochastic RSI oscillator to detect oversold reversals. When the Stochastic %K line rises above 10

Indicator v5 Moving averagesOscillators & momentum
Updated 2 months ago · MIT GitHub repository of TVT 3X Scale In Out
285 stars

Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a

Indicator v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Study

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers