RG Structure is a pivot-constrained break-and-retest strategy that calculates dynamic trendlines, market structure changes, and regime states on the price chart.
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
RG Structure Visual Edition identifies support and resistance lines through pivot points and evaluates break-and-retest signals using ATR-based penetration and rejection scoring. The strategy enters positions on validated setup retests and exits via ATR-based initial stop losses, break-even adjustments, partial take-profits, and trailing stops. Configurable settings adjust pivot lookback periods, touch tolerances, regime thresholds, and risk management parameters. The script plots dynamic trendlines, pivot markers, trade event labels, and an on-screen dashboard.
Pivot-constrained dynamic trendlines
Market regime and structure change detection
Break-and-retest entry signals with rejection scoring
ATR-based stop loss, break-even, and trailing exits
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Lookback Window (N)
int
200
i_N
Pivot Left Bars
int
2
i_left
Pivot Right Bars
int
2
i_right
Max Pivots for Line Fitting
int
12
i_maxPivots
Violation Eval Step
int
4
i_evalStep
Min Pivot Touches
int
2
i_minTouches
Touch Tolerance (α × ATR)
float
0.10
i_alpha
Span Reward Weight (ωs)
float
0.20
i_omegaS
Violation Penalty (λ)
float
1.50
i_lambda
Break Penetration (βp × ATR)
float
0.10
i_betaP
Break Confirmation (βc × ATR)
float
0.15
i_betaC
Retest Buffer (γ × ATR)
float
0.20
i_gamma
Show all 39 settings
Setting
Type
Default
Variable
Fail Buffer (δ × ATR)
float
0.20
i_delta
Retest Window (M bars)
int
12
i_M
Regime Window
int
150
i_erLen
ER Trend Threshold
float
0.35
i_erTrend
ER Range Threshold
float
0.20
i_erRange
Max Crossings for Trend
int
8
i_crossMax
Min Crossings for Range
int
20
i_crossMin
Risk % (A Setup)
float
1.0
i_riskA
Risk % (B Setup)
float
0.5
i_riskB
A Setup Q Threshold
float
0.70
i_qA
B Setup Q Threshold
float
0.60
i_qB
Max dGeom (ATR units)
float
2.5
i_dMax
Stop Buffer (× ATR)
float
0.20
i_stopBuf
BE Trigger (R)
float
0.8
i_beTrigger
Partial Take Profit (R)
float
1.0
i_tpR
Partial Qty %
int
60
i_tpPct
Trail Start (R)
float
1.0
i_trailStart
Trail Buffer (× ATR)
float
0.20
i_trailBuf
Time Stop Bars
int
20
i_timeStop
Show Pivot Markers
bool
true
i_showPivots
Show Trendlines
bool
true
i_showTrendlines
Show Break/Retest Zones
bool
true
i_showZones
Show Trailing Stop
bool
true
i_showTrail
Show Regime Background
bool
true
i_showRegime
Show Event Labels
bool
true
i_showLabels
Show Info Table
bool
true
i_showTable
Show CHOCH/MSS Markers
bool
true
i_showCHOCH
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 enters trades in the opposite direction of filled value gaps, operating under the assumption that price action will resume the primary trend after filling a recent gap. It plots directly on the main price chart and supports MA-based trend filters
This multi-timeframe scalping strategy plots moving averages alongside Smart Money Concepts elements on the price chart. It calculates trend signals using configurable moving average types like ALMA, Hull MA, or TEMA across alternate timeframes. It also plots
Calculates three-bar Fair Value Gaps (FVG) and filters them using Average True Range. When price mitigates the FVG midpoint, the strategy enters a position in the direction of the gap, provided an optional EMA trend filter is satisfied. Exits are defined by an
This ICT-based strategy trades during the 9:45 AM to 10:15 AM New York session window. It calculates a daily bias using a 20-period daily EMA and tracks previous day highs and lows to identify liquidity sweeps. The script refines order block entry levels and m
FxHD Strategy v2.0 is a Fibonacci multi-timeframe strategy drawn on the price chart. It reads a higher timeframe, defaulting to four hours, and sets bias with CRT kill zones, the last two candles, dynamic CRT, or market structure, plus a fallback method. It pl
This strategy evaluates trading opportunities using a probabilistic scoring model combined with Smart Money Concepts (SMC) pattern detection, including Break of Structure (BOS), Fair Value Gaps (FVG), and Order Blocks. It overlays signals directly on the price