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
XAGUSD Trend Double Pullback Stable 20 compares short and medium EMA positions to identify bullish or bearish trend states and waits for stability over a configurable number of bars. Entries occur on pullback signals within the established trend when body size and distance conditions are satisfied, with positions sized as a percentage of equity. Stop loss is set using an ATR multiplier while take profit follows a risk-reward ratio. Settings control EMA lengths, stability and cooldown periods, entry filters, and risk parameters. The indicator draws trend background shading directly on the price chart.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Short EMA 1 Top / 动力
int
12
shortEmaTopLen
Short EMA 2 Bottom / 支撑
int
25
shortEmaBotLen
Medium EMA 1 Top / 防守
int
50
mediumEmaTopLen
Medium EMA 2 Bottom / 整体
int
70
mediumEmaBotLen
Baseline / Visual Only
int
199
baselineLen
Trend Stability Bars / 稳定K线数
int
20
trendStabilityBars
Signal Cooldown / 信号冷却
int
10
cooldownBars
Breakout Tolerance Bars / 破位容忍度
int
5
breakoutToleranceBars
允许做多
bool
true
enableLong
允许做空
bool
true
enableShort
最小实体 ATR倍数
float
0.08
minBodyAtr
距离50EMA最大ATR倍数
float
2.2
maxDistanceAtr
Show all 18 settings
Setting
Type
Default
Variable
ATR周期
int
14
atrLen
ATR保护止损倍数
float
1.2
slAtr
盈亏比
float
1.8
rr
结构高低点周期
int
8
swingLen
结构止损缓冲ATR
float
0.3
bufferAtr
Show Trend Background
bool
true
showTrendBackground
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 runs on the price chart and enters long when a fast simple moving average crosses above a slow one, and short on the opposite cross, while closing the other side. Entries also need ATR above a filter, a pullback check, a minimum candle-body chang
This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the
This strategy plots Donchian channels, trailing stops, and profit targets directly on the price chart. It enters breakout trades using a 55-bar Donchian channel and sizes positions according to an ATR-based risk percentage per unit. The system adds units as pr
This strategy combines channel breakout concepts with an ATR-ADX volatility trailing framework and multi-timeframe moving averages. It evaluates trend conditions using configurable moving average types, including SMA, EMA, Hull MA, and Tilson T3, paired with d
This strategy executes trend-following trades based on Bollinger Band breakouts confirmed by a long-term moving average filter. A long position opens when the price crosses above the upper Bollinger Band, provided the band spread meets a minimum threshold and
The Keltner Channel Strategy is a breakout system plotted directly on the main price chart. It calculates upper and lower channel bands around an exponential or simple moving average using ATR, True Range, or bar range multiplied by a specified factor. A long