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
Filters include a higher-timeframe trend check, a volume surge, body and range thresholds, a prior consolidation, an RSI band and EMA slope. Stops sit beyond the swing point with an ATR buffer, with two reward-to-risk targets and a partial exit option. Sizing can follow a risk percentage of equity.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
品种(BTC / GOLD / Custom)
string
BTC
preset
允许做多
bool
true
allowLong
允许做空
bool
true
allowShort
EMA 快线周期
int
20
maFastLen
EMA 中线周期
int
60
maMidLen
ATR 周期
int
14
atrLen
波段点左侧 K 线数(Custom 使用)
int
3
swingLeft_i
波段点右侧 K 线数(Custom 使用)
int
3
swingRight_i
启用 HTF 共振过滤(建议开)
bool
true
enHTF_i
HTF 周期(Custom 使用)
timeframe
240
htfTF_i
交易量放大过滤(Custom 使用)
bool
true
useVolFilter_i
突破 K 线量 ≥ 20EMA 均量 × N
float
1.3
minVolMult_i
Show all 36 settings
Setting
Type
Default
Variable
强趋势棒 body/range 下限
float
0.65
minBodyRatio_i
强趋势棒 range ≥ N × ATR
float
1.0
minRangeATR_i
收盘价至少超突破位 N × ATR(过滤毛刺)
float
0.10
minBreakATR_i
突破前盘整观察 N 根 K 线
int
6
consolidBars_i
盘整 N 根 K 线极差 ≤ M × ATR
float
2.0
maxConsolidATR_i
RSI 周期
int
14
rsiLen
多头 RSI 下限(太弱不追)
float
45
rsiMinLong_i
多头 RSI 上限(太超买不追)
float
75
rsiMaxLong_i
空头 RSI 下限(太超卖不追)
float
25
rsiMinShort_i
空头 RSI 上限(太强不追)
float
55
rsiMaxShort_i
EMA20 斜率必须 ≥ N(多) / ≤ -N(空)
float
0.001
minSlope_i
两次同向信号最少间隔 N 根(避免连续回撤)
int
10
minBarsBetween_i
SL 在摆动点外再扩 N × ATR(Custom 使用)
float
0.4
slBufATR_i
TP1 = N × R(Custom 使用)
float
1.5
rr1_i
TP2 = N × R(Custom 使用)
float
2.5
rr2_i
按单笔风险% 动态计算仓位
bool
true
useRiskSizing
单笔风险占账户 %
float
1.0
riskPerTrade
分批止盈(TP1 平 N% + 剩余 TP2 全平)
bool
true
useTPSplit
TP1 平仓比例 %
float
50.0
tp1PctClose
TP1 触发后把 SL 移至入场价(保本)
bool
true
moveSLToBE
限制回测日期范围
bool
false
useDateRange
开始时间
time
timestamp("01 Jan 2020 00:00 +0000")
startDate
结束时间
time
timestamp("31 Dec 2099 23:59 +0000")
endDate
信号 K 线背景高亮
bool
true
showSigBG
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 trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr
This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos
The Chained Linear Regression Reversal Strategy plots linear regression channels with upper and lower standard deviation bands directly on the price chart across a user-defined time window. When price breaks out of the static channel for a confirmed number of
This strategy executes trades based on crossovers between a 12-period and a 26-period exponential moving average (EMA). Long positions can be filtered by pivot resistance breakouts and RSI boundary ranges. For trade management, it provides two configurable par
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 enters long or short on the price chart when price is on the correct side of a 200-period EMA, MACD agrees, RSI is not at the opposing extreme, ADX exceeds a threshold, volume beats a 20-bar average, and close breaks the recent high or low. A tim