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.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
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
The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.
Overview
Buy/Sell Position Strategy enters a long position on the price chart when the price is above the EMA filter and the short-term RSI drops below a specified oversold threshold. The position is exited when the current close exceeds the previous bar's high. Key settings adjust the EMA length, RSI period, and buy level. Notably, the strategy lacks a stop loss mechanism by default.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
MA Length
int
200
maLength
RSI Length
int
2
rsiLength
RSI Buy Level
int
10
rsiLevel
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
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
This strategy executes trades based on one of two selectable regimes: trend-following or mean reversion. In trend mode, it enters long positions on a bullish EMA crossover and exits on a bearish crossover. In reversion mode, it buys when the RSI dips below an