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
216 lines of Pine Script v5 from 01-ema-mean-reversion/script.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
VT-Lite sizes equity-percent entries from a short-term EMA and ATR band distance, with a volatility EMA threshold and a choice of close, low, or ATR-band source. It can add reentries up to a set maximum using a size multiplier and discount, then sells from a chosen price source and band after volatility calms. Cooldowns, a start-date filter, quantity precision, and an alert name are configurable. Pyramiding is enabled and no stop loss is defined.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Begin Backtest at Start Date
bool
true
i_useDateFilter
Start Date
time
timestamp("Jan 1 2023 00:00:00")
i_backtestStartDate
AlertName
string
DEFAULT
i_AlertName
Price precision
int
7
i_PricePrecision
Order qty precision
int
2
i_QtyPrecision
Order qty minimum
float
0
i_QtyMinimum
Short-term EMA Length
int
60
i_EmaShortLength
ATR Period
int
100
i_ATRPeriod
ATR Band Distance
float
1
i_ATRBand
ATR Buy Stretch
float
1
i_ATRStretch
Volatility EMA Length
int
5
i_EmaVolLength
Volatility Threshold
float
1.2
i_VThreshold
Show all 22 settings
Setting
Type
Default
Variable
Entry Source
string
ATR Bond
i_EntrySrc
Initial Order %
float
45
i_L1OrderSize
Reentry Max Order
int
1
i_ReentryMax
Reentry Multiplier
float
2
i_ReentryMultiplier
Reentry Discount
float
20
i_ReentryDiscount
Sell Price Source
source
close
i_SellSrc
Sell Band
string
Top
i_SellBand
Wait til calm
bool
true
i_SellVolatility
Entry cooldown
int
10
i_EntryCd
Exit cooldown
int
10
i_ExitCd
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 trades mean-reversion setups using the Bollinger Bands Percent Bandwidth (%B) oscillator plotted in a separate pane. It calculates upper and lower bands using a simple moving average and standard deviation multiplier. Long positions are entered w
This strategy combines Bollinger Bands, Bollinger Band Width, and the Relative Strength Index (RSI) for mean-reversion trades. It enters long when price crosses below the lower band with oversold RSI, or when band width contracts under low volatility. Short en
This strategy combines the Williams Vix Fix oscillator with volume-weighted moving average (VWMA) bands to identify reversal entries. It plots the VIX Fix histogram and optional Bollinger and percentile bands in a separate pane. Long entries trigger when the o
This strategy plots Bollinger Bands on the price chart with adjustable length, standard deviation, and offset. It defines buy and sell zones using candle size percentage and body size thresholds. Long positions enter when the lower zone is breached without con
The Mean Reversion Strategy Template calculates a baseline mean using SMA, EMA, or VWAP alongside upper and lower deviation bands based on standard deviation, ATR, or percentage offsets. It generates long and short entries when price touches, bounces from, or
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