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
In trending conditions it trades a 9 and 20 EMA crossover, and in ranging conditions it fades Bollinger Band extremes. Stops and targets are ATR multiples, with a wider stop and smaller size when volatile. Size is a percent of equity, pyramiding is off, and commission is included. Settings cover each regime's lengths and multipliers.
ADX and ATR market regime detection
EMA crossover logic for trends
Bollinger Band logic for ranges
ATR stop loss and take profit with volatile-market adjustment
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
ADX Length
integer
14
adxLen
ADX Trend Threshold
float
25.0
adxThresholdTrend
ADX Range Threshold
float
20.0
adxThresholdRange
ATR Length
integer
14
atrLen
ATR Volatility Multiplier
float
1.5
atrVolMult
ATR Historical Length
integer
100
atrHistLen
ATR Stop Loss Multiplier
float
3.0
atrSLMult
ATR Take Profit Multiplier
float
6.0
atrTPMult
Volatile SL Multiplier (Wider Stop)
float
4.5
volatileSLMult
Volatile Position Size Multiplier
float
0.5
volatileQtyMult
Percent of Equity per Trade
float
10.0
equityPercent
Trend Fast MA Length
integer
9
fastMALen
Show all 15 settings
Setting
Type
Default
Variable
Trend Slow MA Length
integer
20
slowMALen
Range BB Length
integer
20
bbLen
Range BB StdDev Multiplier
float
2.0
bbMult
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
Sick Sigma detects extreme statistical standard deviation moves (sigma events) to execute trades directly on the main price chart. The strategy supports both momentum and mean-reversion trading styles. Traders can configure calculation lookback periods, sigma
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
This strategy identifies shorting opportunities by calculating Fear and Greed zones based on price extremums relative to moving averages and standard deviation bands. It measures price deviation from recent highs or lows to detect extreme market conditions and