1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
16 lines of Pine Script v4 from PineWealth/Resources/PineScript.txt, published under MIT. Keep the author's credit and licence lines when you reuse it.
PineScript.txt
//@version=4
strategy("RSI Overbought/Oversold", overlay=true)
x = 20
rsi = ta.rsi(close, 14)
diff = close - open
diffInd = ta.rsi(close, 14) - ta.rsi(close, 4)
[middle, upper, lower] = ta.bb(close, 20, 20)
if (rsi > 70)
strategy.entry("Short", strategy.short)
x++
if (rsi < 30)
strategy.entry("Long", strategy.long)
x--
Overview
RSI Overbought Oversold calculates the 14-period RSI and 4-period RSI to detect overbought and oversold conditions. The strategy enters short positions when the RSI crosses above 70 and long positions when it falls below 30. No stop loss or take profit is applied and there are no user inputs to adjust. The script draws signals directly on the price chart.
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.
This strategy identifies Interactive Brokers opening range periods on the price chart and performs mean reversion trades around the midpoint or opposite side. It calculates the IB high, low, and range, then skips narrow or trend days using lookback averages. E
TESLA-BestPosition is a long-only dollar-cost averaging strategy that combines custom Relative Strength Index levels with smoothed highest-high and lowest-low channels. It calculates 10-period exponential moving averages of highest highs and lowest lows over a
Alert BB + RSI [Alorse] is a multi-symbol mean-reversion strategy designed for cryptocurrency trading. It evaluates Bollinger Bands and the Relative Strength Index (RSI) across up to 20 user-defined ticker symbols simultaneously. The strategy enters long posit
Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish
The Chained Linear Regression Reversal Strategy plots linear regression channels with upper and lower standard deviation bands directly on the price chart across a user-defined time window. When price breaks out of the static channel for a confirmed number of
This strategy draws on the price chart and combines Stochastic RSI, the Money Flow Index, and an exponential moving average to open long or short trades. Longs use the lower oscillator thresholds and shorts use the upper ones, with direction limited to longs,