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 indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
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
Version 4 is a separate state machine using a fast ZLEMA, a slow baseline, KAMA and a widened ATR trail. A signal needs a completed-box breakout, impulse displacement, a clean directional regime and opposite local and major structure. A very deep structure break can act as an emergency path. No fixed hold bars are used.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Auto-adapt thresholds by timeframe
bool
true
v4AutoTune
Use completed higher-timeframe bias
bool
true
v4UseHtf
Require HTF alignment
bool
false
v4HardHtf
Auto-select higher timeframe
bool
true
v4AutoHtf
Manual higher timeframe
timeframe
240
v4ManualHtf
HTF trail factor
float
3.0
v4HtfFactor
HTF ATR length
int
14
v4HtfAtrLen
ATR length
int
14
v4AtrLen
Fast ZLEMA length
int
12
v4FastLen
Slow baseline length
int
50
v4SlowLen
Baseline slope lookback
int
4
v4SlopeLen
Adaptive KAMA length
int
20
v4KamaLen
Show all 40 settings
Setting
Type
Default
Variable
KAMA fast length
int
2
v4KamaFast
KAMA slow length
int
40
v4KamaSlow
Adaptive baseline weight
float
0.50
v4KamaWeight
Trail distance x ATR
float
3.20
v4TrailFactor
Trail widening in noisy regime
float
1.45
v4RangeTrailBoost
ATR baseline length
int
50
v4AtrBaseLen
Pause ordinary signals above ATR ratio
float
2.80
v4ShockAtrRatio
Pause ordinary signals above candle range x ATR
float
3.20
v4ShockRangeAtr
Pause ordinary signals after abnormal gap
bool
true
v4UseGapFilter
Abnormal gap x previous ATR
float
1.75
v4GapAtrFactor
DMI/ADX length
int
14
v4AdxLen
Minimum trend ADX
float
20.0
v4AdxTrend
Minimum DMI spread
float
3.0
v4DiSpread
Choppiness length
int
21
v4ChopLen
Range state above choppiness
float
61.8
v4ChopEnter
Trend release below choppiness
float
54.0
v4ChopRelease
Efficiency length
int
20
v4EfficiencyLen
Range efficiency threshold
float
0.25
v4EfficiencyRange
Trend efficiency threshold
float
0.34
v4EfficiencyTrend
Minimum ATR ratio for ordinary signals
float
0.90
v4MinAtrRatio
Minimum ATR expansion ratio for reversal
float
0.98
v4MinExpansionRatio
Maximum choppiness for ordinary flips
float
55.0
v4MaxFlipChop
Minimum efficiency for ordinary flips
float
0.36
v4MinFlipEfficiency
Volume average length
int
20
v4VolumeLen
Volume threshold x average
float
1.05
v4VolumeFactor
Use volume when available
bool
true
v4UseVolume
Initial breakout lookback
int
30
v4EntryStructureLen
Local reversal lookback
int
14
v4LocalStructureLen
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 indicator plots an ATR-based Chandelier Exit trailing stop on the price chart. It tracks a long stop under recent highs and a short stop above recent lows, then switches direction when price crosses the opposite stop. Buy and sell labels mark those flips.
The Momentum Setup is a multi-indicator visual tool designed for trend and momentum analysis directly on the price chart. It combines Relative Strength Index (RSI), Money Flow Index (MFI), Commodity Channel Index (CCI), Supertrend, and a 250-bar percentage cha
Range Filter [Alorse] is a technical indicator overlay for TradingView designed to filter market volatility and identify price trends. It calculates a smoothed range based on historical volatility using a configurable sampling period and multiplier applied to
This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos
This indicator plots three exponential moving averages and ATR volatility envelopes on the price chart. It compares the fast and slow EMAs to shade a trend ribbon and marks confirmed upward and downward crossovers with triangle labels. Settings change the thre
This indicator plots Donchian Channel boundary lines along with dynamic fan projections directly on the price chart. It calculates the highest high, lowest low, and median price over a customizable lookback period. Whenever price establishes a new channel high