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
54 lines of Pine Script v6 from scripts/larry-connors-rsi-2.pine.txt, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.
RSI-2 (Larry Connors) [JR] enters long positions when price trades above a long-term simple moving average (default 200) and the 2-period RSI drops below 10. Optional short positions enter below the trend average when RSI is overbought. Positions exit when price crosses a short-term moving average (default 5), reaches an optional maximum holding period, or hits an optional percentage stop loss. It plots the trend and exit moving averages directly on the price chart. By default, no stop loss is active.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
RSI length
int
2
rsiLen
Buy when RSI below
float
10
buyLvl
Only long above the N-day average
int
200
trendLen
Also short: below average, RSI above 100 − level
bool
false
shortOn
Exit when close crosses the N-day average
int
5
exitLen
Optional stop % (0 = none, as in the book)
float
0.0
stopPct
Optional max days (0 = none)
int
0
maxHold
Trade from
time
timestamp("2000-01-01T00:00:00")
fromT
Trade until
time
timestamp("2100-01-01T00:00:00")
toT
Show averages
bool
true
showLv
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 trend-following strategy identifies buying opportunities during bullish pullbacks on the price chart. It defines a bull market when the 50-period simple moving average trades above the 200-period moving average. Long entries trigger when the RSI drops bel
This strategy combines a Simple Moving Average (SMA) and the Relative Strength Index (RSI) to generate long trading signals. It enters a long position when price closes above the SMA filter while RSI drops below the oversold threshold. The strategy exits the p
This strategy trades pullbacks in the direction of a moving-average trend and draws on the price chart. An uptrend requires the 50-period EMA above the 200-period EMA with price above the slower average, and a downtrend is the reverse. It enters long or short
This strategy executes mean-reversion trades based on RSI overbought and oversold levels directly on the price chart. It generates long signals when the RSI crosses back above the oversold boundary and short signals when it crosses below the overbought boundar
The Buy/Sell Position Strategy combines a long-term Exponential Moving Average (EMA) with a short-term Relative Strength Index (RSI) to capture pullbacks in an uptrend. It enters a long position on the price chart when the price is above the EMA filter and the
Calculates a long-term Exponential Moving Average as a baseline for fair value alongside a Relative Strength Index. Generates long entry signals when the close price trades at least five percent below the moving average while the RSI is oversold. Exits trades