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
Entries can be limited to one direction or allowed to reverse. Stops sit beyond a swing high or low by an ATR multiple, and a reward-to-risk limit can close the trade. An optional ATR trailing stop starts after a chosen fraction of the target. Settings change average type and length, risk multiple, drawdown halt, and a session that blocks new trades.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Detect Long Trades
bool
true
longTrades
Detect Short Trades
bool
true
shortTrades
Use Limit exit
bool
true
useLimit
Use ATR Trailing Stop
bool
false
trailStop
Allow Reversal Trades
bool
false
FLIP
Set Max Total DrawDown
bool
false
setMaxDrawdown
Reward to Risk Ratio
float
1
RnR
Risk Adjustment
float
1
RiskM
Swing Lookback
int
5
swinglookback
Max Drawdown (%)
int
20
maxPercDd
ATR length
int
14
atrLen
ATR Trailing Stop Multiplier
float
1.0
trailStopSize
Show all 39 settings
Setting
Type
Default
Variable
ATR Trailing Stop Source
string
High/Low
trailSource
R:R To Trigger Exit
float
0.0
rrExit
MA Type #1
string
EMA
maType1
MA Type #2
string
EMA
maType2
MA Length #1
int
21
maLength1
MA Length #2
int
50
maLength2
maBull1
color
#64b5f6
maBull1
maBear1
color
#ef5350
maBear1
maBull2
color
#64b5f6
maBull2
maBear2
color
#ef5350
maBear2
transp1
int
0
transp1
transp2
int
0
transp2
lineW1
int
1
lineW1
lineW2
int
1
lineW2
Draw entry price
bool
false
drawEntry
Draw trail trigger price
bool
true
exitLvl
Use Time Session Filter
bool
false
useTimeFilter
Time Session To Ignore Trades
session
0000-0300
timeSession
Start Filter
time
timestamp("01 Jan 2000 00:00 GMT-7")
startTime
End Filter
time
timestamp("01 Jan 2099 00:00 GMT-7")
endTime
start
float
0.02
start
increment
float
0.02
increment
maximum
float
0.2
maximum
Entry on Nth trend bar
int
1
entry_bars
start
float
0.02
start
increment
float
0.02
increment
maximum
float
0.2
maximum
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 mean-reversion strategy plots Bollinger Bands and a long-term moving average directly on the price chart. It enters trades when price candles penetrate the outer Bollinger Bands beyond a user-defined body percentage, anticipating a price reversal. Entries
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
STRG-BBForce is a Bollinger Bands trend-following strategy. It calculates standard Bollinger Bands and tracks directional alignment across the upper, lower, and basis lines. When all three lines slope upward, it opens a long position and closes short positions
This trading strategy combines three Exponential Moving Averages (8, 14, and 50 periods by default) with Stochastic RSI and Average True Range (ATR). It enters a long position when EMA 1 is above EMA 2, EMA 2 is above EMA 3, and the Stochastic RSI %K line cros
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 overlay strategy combines a Chandelier Exit with a zero-lag least squares moving average. Although the header mentions Heikin Ashi candles, the calculations use ordinary closes. An ATR trailing stop sets long and short levels, and direction flips when pri