Swing Persistence Profile - Pivot Width SurvivalSwing Persistence Profile ranks every swing high and swing low on the chart by the widest pivot
window it survives. It is also explicit about the exact bar on which that rank becomes knowable,
and it shades the region where it is not knowable yet.
THE IDEA
A pivot is not a property of a bar on its own. It is a property of a bar together with the width
of the window it was compared against. The same high is a swing high when you look two bars either
side, and is not a swing high when you look thirteen. Tools that ask you to pick one width and
then draw the result bury that choice inside a single number.
This script evaluates up to five widths at once - 2, 3, 5, 8 and 13 bars each side by default -
and records, for every bar, the widest width at which that bar is still the extreme of its window.
That number is the bar's persistence depth.
Because widening a window can only add constraints, the widths are strictly nested: a bar that is
the highest of its 13-bar neighbourhood is necessarily also the highest of its 8, 5, 3 and 2-bar
neighbourhoods. Depth is therefore a single ordered rank rather than five separate opinions that
have to be reconciled. A depth-13 swing is a depth-3 swing that kept going.
TIMING
A pivot of width w cannot be identified until w bars have closed after it. That is arithmetic, not
an implementation detail, and it means a bar's persistence depth is not final until the deepest
active width has passed.
There is one further subtlety that most pivot scripts leave in place. The w-th bar after the
candidate is itself still forming while it is the live bar, and its own high or low can still
invalidate the pivot. A script that reads the verdict during that bar will show a marker that
changes, or vanishes, before the bar closes.
This one waits one bar longer. Every verdict it reads comes from a bar that has already closed, so
the confirmation lag is the deepest active width plus one bar. A marker is created once, on the
bar it describes, and is then left alone: it is not moved, recoloured or deleted on later bars,
and it does not flicker intrabar either.
The bars still inside that delay are shaded, so the region where the answer can still change is
visible on the chart instead of being left to inference. Nothing inside the shaded region has been
ranked yet, so an empty shaded region means "not decided," not "no swings here."
WHAT IS DRAWN
A marker on each qualifying swing, placed on the bar that made the extreme, coloured and sized by
depth, optionally printing the depth as a number.
An optional structure line joining swings at or above one chosen depth, alternating between highs
and lows. The most recent segment extends if a later bar sets a more extreme value in the same
direction; once a swing in the opposite direction closes a segment, that segment is fixed.
An optional higher-timeframe reference: the price of the most recent confirmed swing high and
swing low measured on a higher timeframe, drawn as a stepped level. The requested expression is
offset by one bar and the request uses lookahead, which is the pair the Pine Script documentation
specifies for confirmed higher-timeframe values, so historical and realtime bars receive the same
series. The level therefore lags by the reference width plus one bar of the reference timeframe,
and that lag is the point rather than a defect.
Optional alerts on a swing reaching a chosen depth. The alert fires as many bars after the swing
as the deepest active width plus one; the swing itself is on the earlier bar. Because every
verdict is read from a closed bar, "Once Per Bar" and "Once Per Bar Close" fire on the same bar.
THE TABLE
"Swings" counts how many swings reached at least that depth across loaded history, highs and lows
together. "Kept" is the share of the previous row's swings that survived into this row. "Bars ea"
is the average number of bars per swing at that depth. The footer reports the confirmation lag in
bars and how many bars have been rated.
The survival ratios describe the instrument and timeframe you are looking at, not any particular
trade. If most depth-2 swings die at depth 3, the chart is producing many local extremes that do
not extend. If they survive, the same series is producing fewer and longer swings. Comparing that
profile across timeframes or across symbols is a way of choosing a swing width that matches how a
market actually moves, rather than choosing 5 because 5 is a common default.
Counts cover every bar of history the chart has loaded, so they are comparable between symbols
only when the loaded history is comparable.
SETTINGS
Depths in use activates between two and five of the width slots. Reducing it also shortens the
undecided region at the right edge, because that region is as long as the deepest active width
plus one settling bar.
Every depth threshold in the script - minimum depth to mark, minimum depth for the structure line,
and the alert depth - is stated in BARS EACH SIDE, not as a slot number. With the default widths,
"minimum depth 3" means the second of the five slots. A threshold set above the deepest active
width produces nothing, by design.
Enter the widths in ascending order. The ranking itself does not require it, but the table only
reads as a survival sequence when they ascend, and "Kept" can exceed 100% if they do not.
The higher-timeframe reference width is counted in bars of that timeframe: a width of 5 on a daily
reference means five daily bars each side.
WHO IT IS FOR
Anyone who uses swing points as an input to something else - reading structure, choosing the
lookback for a range or a channel, deciding how far back a level should be considered relevant -
and would rather see how sensitive those points are to window width than settle it by habit. It is
also usable as a calibration step before fixing a pivot length in another tool.
WHAT IT DOES NOT DO
It produces no entries, exits, targets, direction or bias, and nothing in it should be read as
one. It measures the geometry of the price series and stops there. Persistence depth describes
what has already happened; a deep swing is not evidence about what happens next.
NOTES
Highs and lows come from the chart series. On non-standard chart types - Heikin Ashi, Renko, Kagi,
Point and Figure, Range - those values are synthetic, and the depths will describe the synthetic
series rather than the market. The script declares alert conditions, so it should be used and
presented on a standard chart type.
PulseWire permits 500 labels and 500 lines per script. On long histories the platform drops the
oldest drawings as newer ones are created, so the left edge of a deep history may be bare. This
does not affect the table, which counts every rated bar.
Persistence depth for highs and lows, and the bar index each verdict refers to, are available in
the Data Window. Those values describe the bar named by "Swing bar index," not the bar the cursor
is on.
One data request is made for the higher-timeframe reference whether or not it is displayed, so
enabling it costs nothing extra.
ORIGINALITY
The built-in ta.pivothigh() and ta.pivotlow() functions are used as the primitive, as they are in
a great many scripts. Everything above them is written for this script: running several widths in
parallel, aligning their verdicts onto a common bar so that they can be compared, reducing them to
one nested rank, deferring every drawing until that rank is final on closed data, marking the
region where it is not yet final, and reporting the survival ratios between widths.
Open source under the Mozilla Public License 2.0. The logic is described above in enough detail to
be checked line by line against the source. Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Troy H v1Troy H is a companion pane for the Troy accumulation model. It plots the internal readings that drive Troy's entries and exits, so you can see why a signal fired instead of only that it fired.
It must be run alongside the Troy overlay. Troy places its markers on price; Troy H shows the state underneath them. Neither is complete on its own — the overlay tells you what happened, this pane tells you what the model was reading at the time. This is why the published chart carries both.
What the pane shows
The histogram — volume-weighted spread. This is the distance between price and its own smoothed anchor, weighted by the volume that moved it. Amber columns above zero mean price is stretched above the anchor on real participation. Teal below zero means stretched below. Darker patches mark bars where the move happened on thin volume, which the model treats as less trustworthy than the same distance on heavy volume.
The point of weighting by volume is that a two percent move on quiet tape and a two percent move on heavy tape are not the same event, but a plain spread reading scores them identically.
The magenta line — the smoothed signal. A short moving average of the spread. Crossings between the histogram and this line are what the model reads as a turn in the stretch, rather than a fixed level being touched.
The horizontal levels. These are the model's current arming thresholds, drawn live. They are not fixed numbers. They are learned from this symbol's own recent distribution of spread readings, so the same code arms at different absolute values on a quiet stock and a volatile one. Watching them move is the clearest way to see the model recalibrating to the instrument.
The zero line is the anchor. Above it price is extended, below it price is discounted, relative to the model's own reference rather than to a fixed average.
The vertical bands mark bars where the model's gates were open. Teal for the accumulation side, magenta for the harvest side.
The triangles mirror the overlay's entries and exits, on the same bars, so you can line a marker up against the reading that produced it. They come from a shadow position tracker inside this pane that reproduces the overlay's position rules exactly. If a triangle here does not land on the same bar as the overlay, the two are out of sync and neither should be trusted until that is resolved.
The readings table
Regime — whether the model currently classifies the tape as trending up, trending down, or neither. Entries are only permitted outside an established uptrend.
Spread — the current volume-weighted distance from the anchor, in the same units as the histogram.
PnL Z — how unusual the shadow position's current profit or loss is against its own history, in standard deviations. This is a measure of the position, not of price. It is what lets the model tell an ordinary drawdown from an exceptional one on the same instrument.
VFI — the volume flow reading and the size multiplier it is currently contributing.
DMFI — a directional money-flow reading, centred at zero, and its current multiplier. Oversold readings increase conviction. Overbought readings do not reduce it below the base — the multiplier only ever adds.
Buy$ — the size the model would commit on an entry right now, given all the multipliers above. This is a relative figure showing how conviction stacks, not a recommendation of how much anyone should trade.
Zone — which arming zone, if any, the spread currently sits in. A dash means no zone is active.
How to read it
Watch three things together: where the histogram sits against the learned thresholds, whether the regime permits action, and what the position reading is doing. An entry marker appearing while the spread is deeply negative, the regime is not up, and the position reading is stretched is the model's clearest case. A marker appearing with only one of those in place is a weaker one, and the pane is what lets you tell them apart.
The size row is the other reason to run this pane. Troy does not commit the same amount to every entry. Watching Buy$ move as the multipliers change shows you how much the model actually thinks of a given setup, which the overlay's marker alone cannot tell you.
Limitations, and what this will not do
This pane does not trade and does not issue advice. It is a display of one model's internal state.
The position readings come from a hypothetical book held inside the script, not from any real account. It assumes fills at the close of the signal bar, with no slippage, spread, or commission. Real results will differ, and on thin instruments they will differ substantially.
The learned thresholds need history to settle. On a chart with few bars loaded, or immediately after adding the script, the levels will move around before stabilising. Give it a full data set before reading anything into them.
The volume-weighted components require meaningful volume data. On instruments where volume is synthetic, aggregated across venues, or simply absent, those readings degrade and the multipliers they feed will be less informative.
Nothing here is a forecast. The readings describe what has already happened. Past behaviour of any model, including this one, does not indicate what it will do next.
This is a decision-support display, not a system to follow. Use it to understand what a model is reading, and make your own decisions. Indicator

Troy v1Troy is a long-only accumulation model. It buys in parts as price falls into structure, and sells in parts as price recovers out of it. The size of each buy and the size of each sell are both scaled by how far price sits from that structure — the further from it, the larger the commitment.
Most reversion tools answer one question: is it time to act. Troy answers two, because a signal at the edge of a move and a signal deep past it are not the same event and should not be treated as one. The second question — how much — is what this model is built around.
The structure it reads
Entries and exits are anchored to a pair of adaptive bands rather than fixed levels or a fixed average.
The bands start from the recent price envelope, then learn. The model keeps a running memory of how far price has historically pushed through that envelope on this specific instrument, and sets the working band a proportion of that distance beyond it. A stock whose wicks routinely overshoot gets a wider band. One that respects its envelope gets a tighter one. The same code produces different bands on different instruments without anyone tuning it, and the band keeps moving as the instrument's behaviour changes.
This matters because a fixed threshold is really a hidden volatility assumption. Two percent from an average means something different on a utility and on a small-cap miner, and a level set for one will be either noise or unreachable on the other.
How it buys
A buy is considered when price reaches down to the lower band. It is only permitted when the model does not classify the tape as an established uptrend, and only after that classification has held for a minimum period, so a single flickering bar cannot open the gate.
Buys are also spaced. A second buy requires price to have moved a meaningful distance below the first, measured in the instrument's own recent range rather than in percent. The effect is that Troy refuses an entry at a given level and takes one lower down instead — the shares still arrive, at a better price.
A separate deep-displacement condition can admit a buy past the ordinary gates when price is far enough beyond its normal range that the model treats the move as capitulation rather than drift.
There is a cap on how many buys one accumulation cycle may take. The buy that closes a cycle is exempt from it, so the model cannot lock itself out at the cap and stall.
How it sells — the part that makes this its own model
Sells are not a fixed percentage.
The slice Troy takes is the base percentage multiplied by how far above the upper band the bar reached, measured in the instrument's own range. A bar that just clears the band releases a small slice. A bar that clears it by a wide margin releases a much larger one, up to a ceiling.
The reasoning is that a fixed slice treats every recovery identically, which means it under-harvests the good ones and over-harvests the marginal ones. Scaling the slice to the quality of the price on offer keeps inventory back during ordinary bounces and releases it into genuine extension.
Sells are gated on holding something and on the tape not being in a decline, and are spaced by a rising-high requirement so consecutive sells cannot chase each other down.
Troy never sells short and never sells more than it holds. A sell reduces the position. It cannot take it negative.
How it sizes
Every buy is a base amount multiplied by two things.
Depth. How far below the lower band the entry sits, in the instrument's own range. Continuous, not stepped.
A conviction stack. Several independent readings, each contributing a multiplier that can only add to the base and never cut below it: a volume-flow reading, a directional money-flow reading centred at zero so that oversold conditions add and overbought ones simply do not, an ease-of-movement reading, and a divergence contribution. The stack is capped so no single reading can dominate.
Conviction only ever increases size. It never blocks a signal and never shrinks a buy below base. A weak setup still gets bought — it gets bought small.
The accounting
Troy tracks a hypothetical position in dollars, not in units.
Unsold shares carry forward at average entry. Profit is booked on the portion actually sold, against the cost of that portion — never marked to market. A cycle closes when a new buy fires after the position has been reduced, and the profit or loss of that cycle is recorded then.
The tables report profit factor from accumulated gross wins and gross losses, and drawdown from the peak-to-trough of total profit including open positions, not from closed trades alone. Closed-trade drawdown understates what actually happened to a position that was held through a fall.
On the chart
Adaptive bands above and below price, the smoothed reference between them, a regime-coloured ribbon, entry and exit markers on the bars where they fired, and a table of the running position and its results.
Limitations — read these
This is an accumulation model, not a trade signal. The markers are partial adds and partial reductions in an ongoing position, not entry and exit pairs. Counting them as round trips will produce a number that means nothing.
It is long only, and it buys into declines. In a sustained downtrend it will keep accumulating and the position will keep growing while the tape falls. That is what the design does, and the drawdown on the way down can be deep and can last a long time. Anyone using this needs to be honest with themselves about whether they can hold a growing position through that. The model has no stop.
Mean reversion assumes something to revert to. On instruments that trend persistently in one direction, the bands recalibrate around the trend and deep entries buy into continued weakness. It is least suited to exactly those instruments.
The reported results are hypothetical. They assume fills at the close of the signal bar with no commission, no slippage, and no spread. Real results will be worse, and on illiquid instruments considerably worse.
The bands need history. On a short chart, or right after adding the script, the learned distances have not settled and the bands will move around. Load a full data set before reading them.
The volume-based conviction readings need real volume. Where volume is synthetic, aggregated across venues, or missing, those multipliers degrade.
Signals evaluate on bar close. Intrabar the current bar's marker can appear and disappear until the bar completes.
Nothing here forecasts anything. Every reading describes what has already happened. No past behaviour of this or any model indicates what it will do next, and no setting has been chosen because it produced a good historical result.
This is a tool for making your own decisions, not a system to follow. Trading carries risk of loss. Indicator

Prior Range XL**Prior Range XL — Overview**
Prior Range XL plots the previous period's trading range directly on the chart and marks the key levels inside it. It answers a simple question at a glance: where did price trade last period, and where are the meaningful levels within that zone? The prior high and low from a higher timeframe (day, week, or month) often act as support, resistance, and targets in the current period, and this tool keeps them visible and updated without manual drawing.
**What it draws on the chart**
- **Range box** — a shaded rectangle spanning the prior period's high down to its low, giving an immediate visual sense of the zone price is working within.
- **Prior High line** — the top of the range, extended across the current period.
- **Prior Low line** — the bottom of the range, extended across the current period.
- **Midline** — the exact midpoint (50%) of the range, often treated as the "fair value" or equilibrium of the zone.
- **Two internal levels** — user-placed lines inside the range (defaults sit at 20% and 80%), useful for spotting partial retracements, entries, and profit zones between the extremes.
All lines and the box extend to the right and refresh as the current period develops. Range values are calculated from the regular trading session only, so overnight or extended-hours spikes don't distort the prior high and low.
**The inputs, grouped**
*Structure*
- **Structure Timeframe** — the heart of the tool. Choose Daily, Weekly, or Monthly to decide which prior period defines the range. Daily uses yesterday's range, Weekly uses last week's, Monthly uses last month's. This should be set at or above the chart's timeframe for correct behavior.
*Internal Levels*
- **Show Internal Level 1 / Level 2** — toggles each of the two inner lines on or off.
- **Level 1 Value / Level 2 Value** — sets where each inner line sits within the range on a 0-to-1 scale. Zero is the range low, one is the range high, and 0.5 is the midpoint. Setting a level to exactly 0.5 hides it, since the dedicated midline already covers that spot.
*Colors*
- **Box Fill Color** — the shade and transparency of the range rectangle.
- **Box Border Color** — the outline of the box.
- **Prior High Line Color** — color of the top line (labeled PDH).
- **Prior Low Line Color** — color of the bottom line (labeled PDL).
- **Midline Color** — color of the 50% line.
- **Internal Level Color** — color applied to both inner levels.
*Lines & Styles*
- **Line Width** — thickness of the box border and every line.
- **Midline Style** — solid, dashed, or dotted for the midpoint line.
- **Internal Level Style** — solid, dashed, or dotted for the two inner levels.
**How to use it**
- **Frame the session** — set the Structure Timeframe to the period that matters for the trading approach. Intraday traders typically use Daily; swing traders lean toward Weekly or Monthly.
- **Read the edges** — the prior high and low act as natural decision points. Price approaching an edge often stalls, reverses, or breaks through with momentum, and either outcome is tradable information.
- **Use the midline as a pivot** — trading above the midline leans bullish within the range; below it leans bearish. It's a quick read on which half of the zone price favors.
- **Place the internal levels intentionally** — the defaults at 20% and 80% highlight the outer quarters of the range, a common area for reactions before price tests the extremes. Adjust them to match a preferred method, such as thirds or a specific retracement depth.
- **Style for clarity** — assign distinct colors so the high, low, midline, and internal levels are instantly distinguishable, and use dashed or dotted styles to keep the inner lines from competing visually with the range boundaries.
**One practical note**
Because the title is "Prior Range XL," the chart platform treats it as its own indicator. Any earlier version under a different name stays separate and should be removed manually to avoid overlapping boxes and lines.
*(This description is drawn entirely from the indicator's own settings and logic — no outside sources involved.)* Indicator

Traders Clock🌍 World Clock — Custom City
Keep track of the world's major financial centers without leaving your chart.
World Clock — Custom City displays live clocks for New York, London, Tokyo, and your own city, making it easy to know exactly which trading session is active.
Whether you trade Forex, Gold, Indices, or Crypto, staying aware of global market hours helps you prepare for volatility, session opens, and important economic events.
Features
🗽 Live New York clock
🇬🇧 Live London clock
🗼 Live Tokyo clock
🌍 Select your own city from the settings
✏️ Custom timezone support (IANA timezones)
⏱️ Optional seconds display
🎨 Fully customizable colors, text size, and panel position
🌞 Automatic daylight-saving time adjustment
Perfect for
Forex traders
Gold (XAU/USD) traders
US100 / NASDAQ traders
Futures traders
Crypto traders
Anyone trading multiple global sessions
Supported Custom Cities
Choose from built-in locations including:
Amsterdam
Dubai
Paris
Berlin
Madrid
Rome
Bucharest
Athens
Istanbul
Singapore
Hong Kong
Sydney
Chicago
Los Angeles
Toronto Indicator

Indicator

Indicator

Model FollowerThis indicator maps price structure using confirmed candle closes rather than wicks — a new high or low only registers once price actually closes beyond the prior range, filtering out spikes that don't follow through. Each new range is anchored to the true swing point: the last opposing candle (or any wick that pierced past it) before the break, giving a clean staircase view of how structure is actually developing.
From that structure, it plots two live target references:
Local Target (orange) — tracks the current extreme of whichever direction price is presently trending, on your chart's own timeframe. Pushing higher, it follows the developing high; the moment structure turns lower, it immediately switches to the developing low. This updates in real time and reflects what's happening on your timeframe right now — including during a countertrend pullback inside a larger trend.
HTF Target (blue) — the same structure logic, calculated independently on a higher timeframe pulled automatically based on your current chart's timeframe. This gives a read on where price is headed on a broader scale without needing to manually flip charts.
How to use it: when the local and HTF targets are pointing the same direction, the immediate move has higher-timeframe backing. When they diverge — say, local structure just turned bullish but the HTF target is still pointing down — that's often a sign you're looking at a countertrend bounce or a pullback rather than a fresh trend continuation, not a fully confirmed reversal yet.
Note: this tool intentionally doesn't auto-label market phases (accumulation/distribution) or draw supply/demand zones — reading trend context and zone validity is left to the trader, since that involves judgment a mechanical rule can't fully capture. This indicator is built to support that reading, not replace it. Indicator

AMD FVG Trade//@version=6
// ============================================================================
// AMD FVG Trade (v4 · auto-scaling) — Accumulation → Manipulation →
// Distribution + FVG. The base detector is now ATR-based, so it adapts to
// ANY instrument automatically (no per-symbol % tuning). Sessions default OFF
// so setups draw across the whole chart; enable a session to filter by time.
// • Accumulation = tight consolidation base (gray)
// • Manipulation = false-breakout sweep of the base (red bear / green bull)
// • Distribution = reversal FVG in the opposite direction + "AMD" label
// • Trade levels = Entry / Stop (ATR × mult) / Target (R:R) zones
// ============================================================================
indicator("AMD FVG Trade", overlay = true, max_boxes_count = 500, max_labels_count = 200, max_lines_count = 500)
// ══════════════════════════════ AMD LOGIC ════════════════════════════════
gL = "AMD Logic"
accLength = input.int (20, "Accumulation Length", minval = 3, group = gL, tooltip = "Bars used to measure the consolidation (accumulation) range.")
accRangeATR = input.float(2.0, "Accumulation Range Max (× ATR)", minval = 0.2, step = 0.1, group = gL, tooltip = "Max size of the accumulation range in ATR units. This auto-scales to any symbol. Lower = tighter base required; raise if no boxes appear.")
maxSearch = input.int (12, "Max Search Window", minval = 1, group = gL, tooltip = "Bars allowed to find the manipulation sweep, then the distribution FVG, after accumulation.")
minFvgGap = input.float(0.1, "Min FVG Gap (ATR Multiplier)", minval = 0.0, step = 0.05, group = gL, tooltip = "Minimum size of the distribution FVG, measured in ATR multiples. 0 = any gap.")
// ═══════════════════════════════ TRADE SETTINGS ══════════════════════════
gT = "Trade Settings"
atrLength = input.int (14, "ATR Length", minval = 1, group = gT)
atrSLMult = input.float(2.0, "ATR SL Multiplier", minval = 0.1, step = 0.1, group = gT, tooltip = "Stop-loss distance = ATR × this multiplier.")
rrRatio = input.float(2.0, "Reward-to-Risk Ratio", minval = 0.1, step = 0.1, group = gT, tooltip = "Target distance = stop distance × this ratio.")
showTrade = input.bool (true, "Show trade levels (Entry / SL / TP)", group = gT)
// ═══════════════════════════ SESSIONS (EST · America/New_York) ═══════════
// All OFF by default -> the detector runs on the whole chart.
// Enable one or more sessions to only look for setups during those hours.
gS = "Sessions"
useSydney = input.bool(false, "Sydney Session (17:00-02:00 EST)", group = gS)
useTokyo = input.bool(false, "Tokyo Session (19:00-04:00 EST)", group = gS)
useLondon = input.bool(false, "London Session (03:00-12:00 EST)", group = gS)
useNY = input.bool(false, "New York Session (08:00-17:00 EST)", group = gS)
hiliteSess = input.bool(true, "Highlight Active Session Time", group = gS)
// ══════════════════════════════════ COLORS ══════════════════════════════
gC = "Colors"
colAcc = input.color(color.new(color.gray, 70), "Accumulation", group = gC)
colManBear = input.color(color.new(color.red, 65), "Manipulation (Bear)", group = gC)
colManBull = input.color(color.new(color.green, 65), "Manipulation (Bull)", group = gC)
colDisBear = input.color(color.new(color.red, 55), "Distribution (Bear)", group = gC)
colDisBull = input.color(color.new(color.green, 55), "Distribution (Bull)", group = gC)
atr = ta.atr(atrLength)
// ───────────────────────────── SESSION FILTER ────────────────────────────
tz = "America/New_York"
inSyd = useSydney and not na(time(timeframe.period, "1700-0200", tz))
inTok = useTokyo and not na(time(timeframe.period, "1900-0400", tz))
inLon = useLondon and not na(time(timeframe.period, "0300-1200", tz))
inNY = useNY and not na(time(timeframe.period, "0800-1700", tz))
activeSession = inSyd or inTok or inLon or inNY
anySessOn = useSydney or useTokyo or useLondon or useNY
sessOK = anySessOn ? activeSession : true
bgcolor(hiliteSess and anySessOn and activeSession ? color.new(color.blue, 92) : na, title = "Active Session")
// ───────────────────────────── FVG (3-candle) ────────────────────────────
bullFVG = low > high and (low - high ) >= minFvgGap * atr
bearFVG = high < low and (low - high) >= minFvgGap * atr
// ───────────────────────────── AMD STATE MACHINE ─────────────────────────
// 0 = find accumulation base | 1 = wait manipulation breakout | 2 = wait distribution FVG
accHi = ta.highest(high, accLength)
accLo = ta.lowest(low, accLength)
isBase = (accHi - accLo) <= accRangeATR * atr
var int state = 0
var float lockHi = na
var float lockLo = na
var box accBox = na
var box manBox = na
var int dir = 0
var float manExt = na
var int t0 = na
// STATE 0 — lock a tight base (during an active session if any are enabled)
if state == 0 and isBase and sessOK
lockHi := accHi
lockLo := accLo
accBox := box.new(bar_index - accLength + 1, lockHi, bar_index, lockLo, border_color = color.new(color.gray, 30), bgcolor = colAcc, border_width = 1)
t0 := bar_index
state := 1
// STATE 1 — extend base, wait for the manipulation breakout
if state == 1
if not na(accBox)
box.set_right(accBox, bar_index)
if close > lockHi
dir := -1
manBox := box.new(bar_index, high, bar_index, lockHi, border_color = color.new(color.red, 30), bgcolor = colManBear, border_width = 1)
manExt := high
t0 := bar_index
state := 2
else if close < lockLo
dir := 1
manBox := box.new(bar_index, lockLo, bar_index, low, border_color = color.new(color.green, 30), bgcolor = colManBull, border_width = 1)
manExt := low
t0 := bar_index
state := 2
else if bar_index - t0 > maxSearch
state := 0
accBox := na
// STATE 2 — manipulation runs, wait for the reversal (distribution) FVG
if state == 2
if not na(manBox)
box.set_right(manBox, bar_index)
if dir == -1
manExt := math.max(manExt, high)
if not na(manBox)
box.set_top(manBox, manExt)
if bearFVG
box.new(bar_index - 2, low , bar_index + maxSearch, high, border_color = color.new(color.red, 0), bgcolor = colDisBear, border_width = 2)
label.new(bar_index, manExt, "AMD Bearish", style = label.style_label_down, color = color.new(color.red, 10), textcolor = color.white, size = size.normal)
if showTrade
entry = low
sl = entry + atr * atrSLMult
tp = entry - atr * atrSLMult * rrRatio
rgt = bar_index + maxSearch
box.new(bar_index, sl, rgt, entry, border_color = color.new(color.red, 100), bgcolor = color.new(color.red, 82), border_width = 0)
box.new(bar_index, entry, rgt, tp, border_color = color.new(color.green, 100), bgcolor = color.new(color.green, 82), border_width = 0)
line.new(bar_index, entry, rgt, entry, color = color.white, style = line.style_dashed, width = 1)
state := 0
accBox := na
else if bar_index - t0 > maxSearch
state := 0
accBox := na
else if dir == 1
manExt := math.min(manExt, low)
if not na(manBox)
box.set_bottom(manBox, manExt)
if bullFVG
box.new(bar_index - 2, low, bar_index + maxSearch, high , border_color = color.new(color.green, 0), bgcolor = colDisBull, border_width = 2)
label.new(bar_index, manExt, "AMD Bullish", style = label.style_label_up, color = color.new(color.green, 10), textcolor = color.white, size = size.normal)
if showTrade
entry = high
sl = entry - atr * atrSLMult
tp = entry + atr * atrSLMult * rrRatio
rgt = bar_index + maxSearch
box.new(bar_index, entry, rgt, sl, border_color = color.new(color.red, 100), bgcolor = color.new(color.red, 82), border_width = 0)
box.new(bar_index, tp, rgt, entry, border_color = color.new(color.green, 100), bgcolor = color.new(color.green, 82), border_width = 0)
line.new(bar_index, entry, rgt, entry, color = color.white, style = line.style_dashed, width = 1)
state := 0
accBox := na
else if bar_index - t0 > maxSearch
state := 0
accBox := na
// ───────────────────────────── ALERTS ─────────────────────────────────────
alertcondition(bullFVG, "Bullish FVG", "Bullish FVG")
alertcondition(bearFVG, "Bearish FVG", "Bearish FVG")
Indicator

HH/LL Trendlines [twr]Automatically detects swing structure (HH/HL/LH/LL) using pivot highs/lows, labels each swing point, and — the key feature — draws trendlines connecting same-type consecutive pivots: LH→LH on the high side, HL→HL on the low side. This visualizes the two "structure lines" traders watch for trend continuation and potential breaks.
How it works
Pivot detection & classification
Uses ta.pivothigh()/ta.pivotlow() with a user-defined Swing Length (fractal-style, symmetric lookback/lookforward)
Each new swing high is compared to the prior swing high: higher → labeled HH (bullish, green), lower → labeled LH (bearish, red)
Each new swing low is compared to the prior swing low: lower → labeled LL (bearish, red), higher → labeled HL (bullish, green)
First pivot on each side gets a neutral "x" label since there's nothing to compare against yet
Trendline logic
Only connects pivots of the same classification — so a LH connects to the previous LH (skipping over any HH in between), and a HL connects to the previous HL. This produces clean descending-resistance / ascending-support structure lines rather than zigzagging between every pivot.
Lines are capped per side (Max Trend Lines Shown) using an array-based pool with oldest-first trimming, so the chart doesn't get cluttered over time
Live projection
If Project Lines Forward is enabled, each line's slope is recalculated every bar and extended to the current bar (getProjectedY()), so the structure line behaves like a live trend channel boundary rather than a static segment frozen at the two pivot points
Optional Remove Line Once Price Crosses It will auto-delete a line when price closes (or wicks, depending on Cross Source) through the projected level — useful for treating the line as an invalidated trendline break
Inputs summary
Structure: swing length, label toggle
Trend Lines: enable high/low connections independently, line width/style, max lines per side
Projection: forward extension toggle, cross-removal toggle, cross source (Close vs High/Low)
Colors: bullish/bearish color customization
Indicator

Indicator

Indicator

Bitcoin Halving Compass**Bitcoin Halving Compass** is a clean, timeframe-independent indicator designed to visualize Bitcoin’s recurring halving cycle.
The script marks three key points around each halving:
* **BUY marker** — placed a configurable number of calendar days before the halving
* **HALVING marker** — identifies the historical or estimated halving date
* **SELL marker** — placed the same number of calendar days after the halving
The default setting uses a **500-day offset**, but users can adjust this value from the indicator settings.
### Key Features
* Includes all confirmed Bitcoin halvings from 2012, 2016, 2020, and 2024
* Projects future halving cycles
* Uses calendar timestamps, allowing consistent alignment across intraday, daily, weekly, and monthly charts
* Separates historical halvings from estimated future halvings using different line styles and colours
* Allows users to update the estimated next halving date
* Supports configurable colours, line widths, labels, and visibility settings
* Does not repaint historical event dates
* Does not execute trades or place orders
### How It Works
Bitcoin halvings occur every 210,000 blocks. Historical halving timestamps are stored directly in the script.
Future dates are estimated using an average block interval of approximately 10 minutes. Since actual block production varies, projected future dates may shift over time. Users can update the next estimated halving date through the indicator settings, and all subsequent projections will adjust automatically.
### Suggested Use
This indicator can be used to:
* Study Bitcoin’s long-term market cycles
* Compare price behaviour before and after previous halvings
* Identify recurring accumulation and distribution windows
* Support broader macro and cycle-based analysis
* Create a consistent visual reference across multiple timeframes
### Important Note
The BUY and SELL labels are cycle markers only. They are not guaranteed trading signals, financial advice, or recommendations to enter or exit a position.
Future halving dates are estimates and should be updated as blockchain-based projections change.
Indicator

Hype Check - Swing: Big Move. Or just HYPE?Is this move actually unusual?
Big candle. Big volume. Everyone suddenly has a thesis.
Cool.
A 4% move in PLTR and a 4% move in KO are not the same event. Over the
last two years PLTR did that once every 4 sessions. KO, once every 125.
Your screener paints both the same shade of green.
something special? NAH.
████░░░░░░ HOLDING THE LOWS
-7.3% from the peak
normal? yes · a normal stretch for QQQ
who's winning nobody · both sides matched
the crowd growing into the fall
next floor 658.20 · 3.4% below, tested twice
above you nothing until 712.40 · 4.6% up
but it closed well off the lows
YEAH . Something unusual is happening.
KINDA . Worth watching. Not enough for a decision.
NAH . Looks dramatic. Statistically, it isn't.
Then it names what the chart is actually doing: BREAKING DOWN, SNAPPING
BACK, HOLDING THE LOWS, COILING, GRINDING UP, RANGE BOUND, and a few more.
THREE THINGS IT DOES DIFFERENTLY
It measures the move, not the calendar. A three day collapse doesn't get
averaged away inside a 20 day window, and a bounce off the low doesn't
erase the fall that came before it.
It sizes levels in the stock's own daily range. Early versions put a
"level" 0.6% away on a stock that routinely moves 8% in a day. Useless.
Now a level only counts if price would have to work to reach it, and the
ones price has turned at more than once are drawn solid.
It will tell you nothing is happening . Most days that is the honest
answer, and most tools won't say it.
YEAH does not mean buy. It means pay attention. A rare move can continue,
reverse or stall, and a great looking setup can still be a bad trade.
No predictions. No magic arrows. No fake certainty.
Rare is not the same as actionable.
Daily swing charts. Free and open source.
Not financial advice.
Indicator

Previous Week High/Low CandlePrevious Week High/Low Candle — with Quadrants
Marks the two candles that defined the previous week's trading range and turns each into a reference zone for the current week.
What it plots
High-candle box (red): the exact candle that printed last week's highest high. The box spans that candle's full range — wick to wick.
Low-candle box (green): the candle that printed last week's lowest low, drawn the same way.
Both boxes extend to the right, so they sit as live support/resistance across the current week.
Quadrants
Each box is divided at 25 %, 50 % and 75 % of its range. The 50 % midline is the primary reference — price often reacts there before committing to the full box. The 25/75 lines mark the shallow and deep halves for finer entries. All three are drawn in dark tones so they stay readable against the pale fill.
Why the candle, not the whole week
A weekly high/low is created by a single candle — that candle's body and wick are where the actual rejection happened. Marking just that candle gives a tight, tradeable zone instead of a week-wide band.
Behaviour
Only the last completed week is shown; the levels roll forward automatically at each weekly open.
Built for the 1H chart, works on any intraday timeframe.
Fully configurable: colours, fill and border transparency, quadrant visibility and line style, right-extension, and labels with prices.
Indicator

Indicator

Session Range Completion ClockThis indicator measures WHEN, inside a chosen intraday session, that session's range is actually
built. It answers a question that session tools normally skip: by a given time of day, how much of
the day's eventual range is typically already spent, and has the extreme that will define the day
usually already printed?
It draws no levels, marks nothing on price, and produces no signals. It is a measurement
instrument that reports descriptive statistics over the sessions in your loaded history.
THE UNDERLYING PRINCIPLE
A session's range is not built at a constant rate, and how it is built differs by symbol, by
session and by contract. The script assumes nothing about the shape - it measures it on whatever
instrument and window you point it at.
"How much range is left" and "is the extreme already in" are two different statistics, and the
script keeps them separate. For every completed session in the loaded history it records the
running high and low at the end of each time bucket, then waits for the session to close so the
FINAL range is known. It then attributes, for each bucket:
- the fraction of the final range that had been traversed by the end of that bucket;
- whether the session's high had already been made at or before that bucket;
- whether the session's low had already been made;
- whether both were already in place, meaning the range was finished and everything afterwards
happened inside it;
- the traversed range expressed in units of daily ATR or of the previous day's range, which makes
the figure comparable across volatility regimes.
These are accumulated across sessions and reported as means and frequencies.
HOW TO READ THE TABLE
The table is drawn once, on the last bar of the chart. Each row is a point in time, labelled with
the clock time at the end of that bucket.
"n" is the number of sessions contributing to that row. "Range built" is the mean percentage of
the session's final range already traversed. "High set" and "Low set" are the percentage of
sessions in which that extreme was already established. "Both set" is the percentage of sessions
in which the entire range was already complete; that column is shaded by value. "Range/unit" is
the mean range so far in the normalization unit selected in the inputs, which is named in the
bottom-right cell.
If the session contains more buckets than the row limit, buckets are sampled at an even stride so
the table still ends on the session's final bucket.
The pane also plots two lines during a live session: the current session's range so far, and the
mean range so far of all prior qualifying sessions at the same point in the session, both in the
same unit. That is a like-for-like comparison at equal elapsed session time. It is not a
projection and the script does not extend either line forward.
On a daily or higher chart the table prints a message instead of statistics: the whole measurement
is defined on intraday bars and there is nothing to compute.
WHAT IT DOES NOT DO
It does not predict where price will go, does not identify breakouts, and does not mark levels. A
high "Both set" figure at a given time means only that historically, on this symbol and this
session, the range was usually already complete by then. It is a frequency over past sessions, not
a statement about today, and nothing in the script says whether acting on it would be a good idea.
METHOD, AND WHY IT DOES NOT REPAINT
A session is folded into the statistics only after it has closed, so the session in progress never
contributes to its own statistics.
Historical values are never recalculated. The statistics accumulate forward in time, which means
the historical-mean line on early bars was computed from a smaller sample than the same line on
recent bars. That is deliberate; the alternative would be a curve that silently rewrites its own
past.
The daily normalization unit comes from a single bundled request on the daily timeframe. The
requested expression is offset by one bar and the request uses lookahead, which is the pair the
Pine Script documentation specifies for confirmed higher-timeframe values: the offset discards the
daily bar that is still forming and returns the one before it, which was already final. Historical
and realtime bars therefore receive the same value. This matters more here than it looks, because
the unit is latched once at session start and then used for that whole session - a unit that
differed between live and reloaded charts would give a session two different "Range/unit" figures
depending on when you looked at it.
Time buckets are anchored to the declared session start time rather than to the first bar
observed. This keeps the time-of-day axis stable on illiquid symbols, on sessions that run through
midnight, and on continuous 24-hour sessions where there is no gap between sessions to detect. A
session string containing more than one range, such as 0900-1130,1230-1500, is treated as a single
window running from the first start to the last end; buckets falling inside the break carry the
pre-break state forward, which is what you want, because the range does not reset over lunch. An
optional day mask such as 0930-1600:23456 is respected.
SETTINGS
Session and Session time zone define the window. Use the exchange's own time zone so buckets stay
aligned across daylight-saving changes.
Bucket size should be a multiple of the chart timeframe. A bucket narrower than the chart
timeframe contains no bars of its own and simply carries the previous bucket's state forward.
Minimum session completeness excludes half-days, early closes and partially loaded history, which
would otherwise depress the late-session figures. Lower it if a market you are studying
legitimately has short sessions.
Normalise range by chooses between daily ATR and the previous day's range. ATR is smoother; the
previous day's range reacts faster.
ORIGINALITY
The session and time-of-day category on this platform is overwhelmingly made of level-drawing
tools: opening-range boxes, session high/low lines, session shading. Those draw where. Very little
published measures when, and the two are different objects - this script plots nothing on price at
all.
There is a small existing family of scripts that chart the distribution of the hour at which the
daily high or low prints, and the "High set" and "Low set" columns overlap with that idea. This is
not a reskin of any of them: the accumulator here is cumulative by elapsed session time rather
than a histogram of one timestamp, it is folded only on session close, it is keyed to a
user-supplied session string with mid-session-break handling and a day mask, and it is combined
with final-range-fraction and volatility normalization. No code is borrowed from any published
script.
LIMITATIONS
Requires an intraday chart timeframe.
The sample is whatever history the chart has loaded, which on lower timeframes may be only a few
hundred sessions - check "n" before reading anything into a row.
Results are sensitive to the chart timeframe, because the exact bar on which an extreme prints is
resolution-dependent. Coarser timeframes will place extremes in later buckets than they truly
occurred.
The "Range/unit" column can be based on a smaller sample than the percentage columns, because the
earliest sessions in the loaded history have no completed daily bar to normalize against and are
skipped for that column only.
Sessions spanning a daylight-saving transition can be misattributed by one hour for a single day.
On non-standard chart types - Heikin Ashi, Renko, Kagi, Point and Figure, Range - the highs and
lows are synthetic, so the statistics describe the synthetic series rather than traded prices.
The statistics describe the loaded history only and carry no assumption that the distribution is
stable over time.
Source is open and commented. Indicator
