This strategy backtests a Candle Range Theory model on the price chart, with variants that also require a CVD divergence, an absorption candle, or both.
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 taken on a midline retest, with the stop placed using an ATR buffer. Risk is sized as a percentage of equity or a fixed quantity, with a dollar cap, an optional daily loss limit, two reward-to-risk targets, a partial close at the first target and a move to breakeven. Direction and the test date window are adjustable, and only one position is open at a time.
Candle Range Theory entries with midline retest
Optional CVD divergence and absorption confirmation
Risk percent or fixed quantity sizing with daily loss limit
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Strategy Variant
string
CRT Only
strategyVariant
Trade Direction
string
Long+Short
tradeDirection
Backtest Start Date
time
timestamp("2024-01-01 00:00 UTC")
backTestStart
Backtest End Date
time
timestamp("2030-01-01 00:00 UTC")
backTestEnd
CRT Timeframe
string
Auto
crtTfMode
Strict Mode (C2 must sweep PDH/PDL)
bool
false
crtStrictMode
Entry Mode
string
Midline Retest
crtEntryMode
SL Buffer × ATR14
float
0.3
crtSlBufferAtr
Base Risk per Trade (% of equity)
float
1.0
riskPerTrade
Risk Base
string
Equity (compounding)
riskBaseMode
Max Risk per Trade ($, 0 = off)
float
10000
maxRiskUsd
Quantity Mode
string
Risk-based
qtySizingMode
Show all 40 settings
Setting
Type
Default
Variable
Fixed Contracts / Units
float
1.0
fixedQtyIn
Max Position Size (0 = off)
float
0
maxQtyCap
Max Daily Loss ($, 0 = off)
float
0
maxDailyLossUsd
TP1 Risk:Reward
float
2.0
tp1RR
TP2 Risk:Reward
float
3.0
tp2RR
Close % at TP1
float
50
partialCloseTP1
Move SL to Breakeven after TP1
bool
true
breakevenAfterTP1
Max Concurrent Positions
int
1
maxConcurrent
Position Sizing Mode
string
Fixed Risk %
sizingMode
Target Annualized Volatility %
float
20.0
targetVolPct
Volatility Lookback (bars)
int
25
volLookbackBars
Max Effective Risk Cap (%)
float
3.0
maxRiskCap
Vol Blend Weight (0=Fixed, 1=Full VT)
float
0.5
volBlendWeight
Confluence Lookback (bars)
int
40
divLookback
CVD Reset Anchor
string
Never
cvdResetMode
Div Pivot Length
int
3
divPivotLen
Div Max Distance Between Pivots
int
120
divMaxDist
Absorption Min Volume Z
float
1.5
absVolZ
Absorption Max Body/Range
float
0.5
absBodyRatio
Absorption Min |Delta|/Volume
float
0.4
absDeltaRatio
Absorption Volume Lookback
int
50
absVolLookback
Restrict Trades to Sessions
bool
false
restrictSessions
Asia (00-09 UTC)
bool
false
allowAsia
London (08-17 UTC)
bool
true
allowLondon
NY (13-22 UTC)
bool
true
allowNY
Show CRT Boxes on chart
bool
true
showCRTBoxes
Show Stats Panel
bool
true
showStats
Stats Panel Position
string
bottom_right
statsPos
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.
Donald - AI Futures 5M 15M Timeframe is an overlay trading strategy designed for intraday futures trading. It utilizes rational quadratic kernel regression to construct dynamic momentum zones and smoothed price boundaries on the main price chart. The strategy
This overlay strategy plots previous-day high and low, the daily open, and fair value gap zones on the price chart. It takes entries on a selectable timeframe when the FVG requirement and an optional session window allow them, then uses an ATR or fixed pip sto
Gold Scalping BOS & CHoCH is an overlay strategy designed for detecting market structure shifts. It calculates rolling swing highs and lows to identify Break of Structure (BOS) and Change of Character (CHoCH) events. Long signals trigger when bullish BOS and C
This strategy identifies trend reversals through market structure changes (CHoCH) filtered by MACD momentum. It initiates long positions on bullish structure breaks when MACD is positive and above its signal line, and short positions on bearish breaks when MAC
Gold Scalping BOS & CHoCH with MA Filter is a strategy that identifies market structure shifts using Break of Structure (BOS) and Change of Character (CHoCH) signals alongside exponential moving average trend filters. Long trades enter when bullish BOS, bullis
Donald - AI Futures is a price-chart strategy that estimates inner and outer high-low zones and a smoothed close with rational quadratic kernel regression. It builds bullish and bearish momentum signals, optionally compares volume with a volume-weighted moving