OPEN-SOURCE SCRIPT
Aggiornato

5m Wick Test

1 049
5M WICK TEST SETUP
A 3-candle liquidity-sweep and reversal pattern detector with automatic entry, stop, and target levels.

WHAT IT DOES
This indicator scans for a specific 3-candle price action pattern often referred to as a "wick test" or liquidity sweep setup — where price sweeps a recent high or low with a wicked candle, gets engulfed by a strong reversal candle, and then retests that swept level before continuing in the new direction.
When the full pattern confirms, the script automatically plots:
Entry — Bar 1's wick extreme (the level Bar 3 must retest)
Stop Loss — Bar 2's opposite extreme
Breakeven — a reference line at your chosen distance from entry
Target 1 — a 1:1 risk-to-reward level
Target 2 — a fixed point distance from entry (fully adjustable, so it works across different instruments and volatility)
Target 2R — a 1:2 risk-to-reward level

HOW THE PATTERN WORKS
Bar 1 (Setup Bar): Closes in the direction opposite the anticipated move (red for a bullish setup, green for a bearish setup) and has a wick on both sides — signaling a rejection at that level.
Bar 2 (Engulfing Bar): A strong reversal candle that engulfs Bar 1's body and closes beyond Bar 1's wick, confirming a shift in momentum.
Bar 3 (Execution Bar): Must be the bar immediately following Bar 2, and must retest back into Bar 1's wick level. If the very next candle doesn't retest, the setup is invalidated — no late or delayed "retests" get marked.
Both bullish and bearish setups are detected independently and can overlap — including cases where the same candle serves as Bar 3 of one setup and Bar 1 of the opposite setup.
Features
Configurable strictness — toggle whether Bar 1 needs a directional close, whether Bar 2 must close beyond Bar 1's full wick, and whether Bar 2's open must fully engulf Bar 1's close (the textbook engulfing-candle definition), so you can dial the pattern between a loose and a strict interpretation.
Optional swing-point filter — require Bar 1 or Bar 2 to represent a genuine local swing high/low, filtering out reversals that occur randomly mid-trend.
Individually toggleable levels — show or hide each of the six lines independently, with full color, width, and style customization.
Rolling chart history — keeps your last several confirmed setups visible on the chart (configurable count), automatically removing the oldest as new ones confirm, so your chart stays readable without manual cleanup.
Built-in alerts — separate alert conditions for setup confirmation and valid Bar 3 retests, for both directions.

HOW TO USE
Add the indicator to a 5-minute chart (or any timeframe — the logic is timeframe-agnostic). When a BUY or SELL label appears on Bar 2, watch the very next candle for a retest of the marked entry level. If price retests, the full level set draws automatically. If it doesn't, the setup silently invalidates and no levels are drawn.
Use the Pattern Rules settings to match the strictness of the pattern to your own trading style, and the Visuals settings to customize the look to fit your chart.

DISCLAIMER
This script is for educational and informational purposes only. It does not constitute financial advice, and past pattern behavior is not indicative of future results. Always use proper risk management and backtest thoroughly before trading any strategy live.
Note di rilascio
Made the lines populate after candle 2 engulfs candle 1 instead of it waiting for candle 3 to retest. This will show the possible trade prior to it happening and then if candle 3 does not retest candle 1 wick it will disappear.
Note di rilascio
Updating the picture only - just want chart to show the 5m Wick Test indicator.
Note di rilascio
Fixed: Setup levels could incorrectly disappear the moment Bar 3 opened, even when price went on to retest properly later in that same candle. Levels now correctly wait for the full candle to close before being invalidated, so a valid retest anywhere within Bar 3 will always draw properly.
Note di rilascio
Here's a concise update note for this release:

Update Notes:
Adjusted default settings for a cleaner out-of-the-box look:

Level price labels now hidden by default (toggle back on in Visuals if you want exact prices displayed)
Breakeven line now hidden by default
Bar 2 "full engulf" rule relaxed by default (still available as a strict toggle in Pattern Rules)
New default color scheme: black Entry line, blue Target 1, gold Target 2, purple Target 2R
Chart history increased from 4 to 10 setups kept per direction

All of the above remain fully configurable in the indicator settings — these are just refreshed defaults.
Note di rilascio
Previous update included stats coding that I did not mean to include as they are not intended to be in this version
Note di rilascio
Here's a concise, public-facing update note:

Update Notes:

Added Position Sizing — calculates contracts to risk based on either a dollar amount or % of account, using the real Entry-to-Stop distance. Choose to display it inside the BUY/SELL flag, on the Entry line, the Stop Loss line, or both. Off by default — enable it in settings if you want it.
Refreshed default colors and hidden price labels/breakeven line for a cleaner look on load.
Chart history bumped to 10 setups kept per direction.
Minor fixes to real-time behavior around Bar 3 confirmation.

All new features are fully optional and configurable in the indicator settings.
Note di rilascio
Update Notes:

Position sizing now rounds to 1 decimal place (e.g. "3.5 contracts") instead of a whole-number floor, giving more precise sizing guidance.
Added a "Position Sizing Contract" dropdown — choose whether the risk calculation uses your current chart symbol, an automatic Micro Equivalent (÷10, correct for standard CME pairs like NQ→MNQ, ES→MES, YM→MYM, RTY→M2K, CL→MCL, GC→MGC), or a Custom Point Value you enter manually. Useful if you're watching one instrument but plan to execute on its micro contract.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.