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
The strategy supports both momentum and mean-reversion trading styles. Traders can configure calculation lookback periods, sigma thresholds, maximum sigma bounds, and exit parameters like bar timeouts, mean crosses, or band offsets. Stop loss management is disabled by default. The script updates on every tick, which causes live signals to repaint before bar close.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Sigma Threshold
float
3.0
i_sigma_threshold
└ Timeframe
timeframe
i_sigma_timeframe
└ Max Sigma
float
10.0
i_max_sigma
└ Number of Bands
int
5
i_num_bands
Calculation Mode
string
All History
i_calc_mode
└ Lookback Period
int
20
i_lookback_period
Exit Mode
string
Price Crosses Mean
i_exit_mode
└ Exit After Bars
int
10
i_exit_bars
Use Band Exit
bool
true
i_use_band_exit
i_exit_band_offset
float
1.0
i_exit_band_offset
Default Unit
string
PnL
i_global_unit
ATR Period
int
14
i_atr_period
Show all 40 settings
Setting
Type
Default
Variable
Timezone
string
America/New_York
i_global_tz
Trigger Price
string
Current
i_trigger_price
Use Date Range
bool
false
i_use_backtest_range
i_backtest_preset
string
Custom
i_backtest_preset
Start Date
time
timestamp('01 Jan 2020 00:00 +0000')
i_backtest_start
End Date
time
timestamp('31 Dec 2030 23:59 +0000')
i_backtest_end
Direction
string
Both
i_direction
i_order_type
string
Market
i_order_type
i_color_entry
color
color.gray
i_color_entry
Trade Style
string
Momentum
i_trade_style
└ Limit Offset
float
5
i_limit_offset
i_limit_offset_unit
string
Ticks
i_limit_offset_unit
Position Mode
string
Single
i_position_mode
Use Stop Loss
bool
false
i_use_sl
i_sl_value
float
200
i_sl_value
i_sl_unit
string
Global
i_sl_unit
i_color_sl
color
color.red
i_color_sl
└ Trailing ›
bool
false
i_use_trail
Trigger
float
500
i_trail_activation
Offset
float
250
i_trail_offset
└ BE ›
bool
false
i_use_breakeven
Trigger
float
1000
i_breakeven_activation
Lock In
float
500
i_breakeven_profit
i_color_be_trig
color
#ff9900ba
i_color_be_trig
Use Take Profit
bool
false
i_use_tp
i_tp_value
float
200
i_tp_value
i_tp_unit
string
Global
i_tp_unit
i_color_tp
color
color.green
i_color_tp
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 calculates Bollinger Bands and Aroon oscillator values to identify mean-reversion opportunities. It enters a long position using full equity when the closing price crosses below the lower Bollinger Band while Aroon Up remains above a user-specifi
This strategy combines Volume Weighted Moving Average (VWMA) Bollinger Bands with 200-period and 50-period Exponential Moving Averages (EMAs). It identifies long trade opportunities when the 50 EMA is above the 200 EMA and price falls to or below the lower Fib
This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po
This strategy plots a Keltner channel from an EMA basis and ATR bands on the price chart. It enters long when price crosses back above the lower band while trading above a slower trend EMA, and short when price crosses back below the upper band while below tha
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
This overlay strategy targets one-minute ES futures and plots volume-weighted moving-average bands from the open, scaled by a standard-deviation multiple, plus a slower band from ten-minute opens. A higher-timeframe exponential moving average can filter trades