This strategy enters one long trade when the bar low comes within a set point tolerance of the prior day's low and the close finishes above that level.
1Copy the scriptPress Copy script above, or the copy button on the code below.
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
58 lines of Pine Script v5 from pine/PDL_prior_day_level_retest.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
PDL_prior_day_level_retest.pine
//@version=5
strategy("PDL — Prior Day Level Retest (Bull)", overlay=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=2,
initial_capital=100000, commission_type=strategy.commission.cash_per_order, commission_value=0.5)
// ═══════════════════════════════════════════════════════════════════
// LOCKED BASELINE — from Python deep sweep (Rob 81.2, PF 1.97)
// DO NOT TUNE THESE WITHOUT PYTHON VALIDATION
// ═══════════════════════════════════════════════════════════════════
// Parameters
sessStart = input.int(9, "Session Start Hour (UTC)")
sessEnd = input.int(18, "Session End Hour (UTC)")
tolerance = input.float(3.0, "Tolerance (pts)")
stopPts = input.float(15.0, "Stop Loss (pts)")
targetR = input.float(2.5, "Target R-multiple")
killHour = input.int(20, "Kill Hour (UTC)")
fridayCutoff= input.int(20, "Friday Cutoff Hour (UTC)")
// ═══════════════════════════════════════════════════════════════════
// PRIOR DAY LOW
// ═══════════════════════════════════════════════════════════════════
pdLow = request.security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on)
// ═══════════════════════════════════════════════════════════════════
// SESSION FILTER
// ═══════════════════════════════════════════════════════════════════
utcHour = hour(time, "UTC")
inSession = utcHour >= sessStart and utcHour < sessEnd
isFridayLate = dayofweek == dayofweek.friday and utcHour >= fridayCutoff
// ═══════════════════════════════════════════════════════════════════
// ENTRY: Price touches prior day low and bounces (bull only)
// ═══════════════════════════════════════════════════════════════════
nearPDLow = math.abs(low - pdLow) <= tolerance
bounce = close > pdLow + 1
longCondition = nearPDLow and bounce and inSession and not isFridayLate and strategy.position_size == 0
if longCondition
entryPrice = close
stopPrice = entryPrice - stopPts
targetPrice = entryPrice + (stopPts * targetR)
strategy.entry("PDL_Long", strategy.long)
strategy.exit("PDL_Exit", "PDL_Long", stop=stopPrice, limit=targetPrice)
// ═══════════════════════════════════════════════════════════════════
// TIME EXIT: Kill hour
// ═══════════════════════════════════════════════════════════════════
if strategy.position_size > 0 and utcHour >= killHour
strategy.close("PDL_Long", comment="TimeExit")
// ═══════════════════════════════════════════════════════════════════
// VISUAL
// ═══════════════════════════════════════════════════════════════════
plot(pdLow, "Prior Day Low", color=color.new(color.orange, 30), linewidth=2, style=plot.style_stepline)
plotshape(longCondition, "Entry", shape.triangleup, location.belowbar, color.green, size=size.small)
Overview
Entries are allowed only inside a UTC session and are blocked after a Friday cutoff hour. It stays flat until the position closes. A stop is placed a fixed number of points below the entry close, and a limit sits at a chosen R multiple of that distance. Position size defaults to two percent of equity. It draws 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
Session Start Hour (UTC)
int
9
sessStart
Session End Hour (UTC)
int
18
sessEnd
Tolerance (pts)
float
3.0
tolerance
Stop Loss (pts)
float
15.0
stopPts
Target R-multiple
float
2.5
targetR
Kill Hour (UTC)
int
20
killHour
Friday Cutoff Hour (UTC)
int
20
fridayCutoff
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.
3C QFL Mean Reversal is a strategy based on the Quickfinger Luc (QFL) trading methodology. It identifies breakdown buying opportunities below established price base levels and enters mean-reversion trades. The strategy includes multi-safety order DCA scaling,
This strategy divides a fixed price range between an upper and a lower limit into equally spaced grid levels and plots them on the price chart. It marks a buy when price crosses down through a grid and a sell when price crosses up through a grid, using either
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 builds a spot grid between user-set high and low prices and draws it on the price chart. It splits that range into ten levels and places up to five long limit orders at the lower levels, sizing each from current equity. Orders already below price
This overlay strategy targets one-minute ATOM scalps. It tracks pivot highs and lows as resistance and support, compares a three-period EMA with a multi-stage smoothed close, and flags long or short when price crosses that curve in the matching direction. Dail
P404 Smoke is a price-chart strategy that sequences an optional higher-timeframe EMA bias, a liquidity range from recent pivots, a sweep of buy-side or sell-side liquidity, and a market structure shift within a set bar window. Comments state it then looks for