Market Effort Response ProfileMarket Effort Response Profile is a behavioral price-profile indicator designed to examine how market effort and realized price response have interacted across different occupied price regions.
Rather than treating every price level equally, the indicator organizes recent market behavior into adaptive price regions and evaluates the relative activity and effort-response balance observed within each region.
The purpose is not to predict where price will move next. The profile provides a spatial view of how price has behaved across the analyzed sample.
How It Works
The indicator evaluates market behavior through two related components:
Effort represents the relative intensity of market movement and activity observed during the analysis window.
Response measures how effectively that effort translated into realized price movement.
These components are normalized so that their relationship can be compared across changing volatility conditions.
The resulting information is then mapped into an adaptive price profile.
Adaptive Occupied-Price Profile
Instead of dividing the entire chart range into fixed price intervals, the indicator builds its profile from price regions that were actually occupied during the analysis window.
Observed prices are organized into adaptive quantile-based regions.
For each region, the indicator aggregates behavioral activity and the relationship between effort and response.
The horizontal width of each profile strip represents the region's relative behavioral activity within the current sample.
Wider regions therefore represent greater observed activity relative to other regions in the same profile.
Profile Colors
The profile uses restrained behavioral coloring:
Teal regions indicate comparatively response-led behavior.
Muted red regions indicate comparatively effort-led behavior.
Neutral regions indicate a more balanced relationship between the two components.
These classifications are relative descriptions of historical behavior within the current analysis window. They are not bullish or bearish trade signals.
Profile Peak
The Profile Peak identifies the adaptive price region containing the highest smoothed behavioral activity in the current profile sample.
It provides a reference for where the strongest concentration of measured activity occurred.
The Profile Peak is descriptive only. It is not a price target, reversal probability, expected return, or guarantee that price will react there again.
Structural References
The indicator also tracks confirmed structural references derived from price behavior.
To keep the chart readable, only the nearest relevant support and resistance references around current price are displayed.
Each reference label contains the structural price and a normalized relative activity reading associated with the nearest profile region.
These references provide additional context for interpreting the effort-response profile; they should not be treated as guaranteed support or resistance.
Dashboard
The compact Effort Profile dashboard summarizes the current behavioral state:
EFFORT — normalized market effort.
RESPONSE — normalized realized price response.
EFFICIENCY — the relationship between response and observed effort.
BALANCE — identifies whether the current measurement is comparatively effort-led, response-led, or balanced.
PROFILE PEAK — price associated with the highest-activity profile region.
These measurements describe current and historical market behavior. They do not represent probabilities or trading recommendations.
Originality and Intended Use
Market Effort Response Profile is built around the relationship between behavioral effort, realized response, and spatial price occupancy.
Its profile is not constructed from traditional volume-at-price data or reversal-frequency probabilities.
The adaptive occupied-price geometry allows the profile to adjust to the actual distribution of observed prices instead of forcing the sample into a fixed full-range grid.
The indicator is intended for traders studying market behavior, structural interaction, movement efficiency, and the distribution of activity across price.
It can be used as analytical context alongside an independent trading methodology.
Calculation Timing
The profile is recalculated from the available analysis sample as new market data becomes available.
Confirmed structural references are used for the displayed support and resistance context.
Because the active analysis window changes over time, profile geometry, Profile Peak, behavioral classifications, and displayed structural references can also change as new observations enter the sample.
Limitations
The indicator analyzes historical and current price behavior. It does not know future market direction.
High historical activity at a price region does not imply that price will revisit or react from that region.
Effort-response relationships can change when volatility, liquidity, market structure, or broader market conditions change.
The Profile Peak is not equivalent to a conventional volume point of control.
Support and resistance references can fail.
Normalized readings are comparative analytical measurements and should not be interpreted as probabilities, expected returns, or historical win rates.
The indicator does not generate Buy or Sell signals and should not be used as a standalone trading system. Penunjuk

Gecko ORB Small Range Breakout Strategy v1.4**ORB Small Range Breakout Strategy**
This strategy trades breakouts of the opening range, but only when that range is small or medium relative to price — the idea being that a tight, low-volatility opening range has more room left to run than one that has already made a large move.
**How it works**
1. **Opening Range (ORB):** The script builds a high/low range over a configurable start and end time (default 08:00–08:25, exchange-local time). This window is fully configurable, so the script works on any market/session — LSE, JSE, or otherwise — without modification.
2. **Classification:** Once the opening range closes, its size is measured as a percentage of the opening price and classified as SMALL, MEDIUM, or LARGE based on two adjustable thresholds. Only SMALL and MEDIUM ranges are considered tradeable; LARGE ranges are skipped for that session.
3. **Entry:** Within a configurable entry window after the opening range closes (default cutoff 11:00), a long is triggered on a close above the range high, and a short on a close below the range low — one trade per session, first breakout only.
4. **Stop/Target:** The stop is placed at the opposite side of the opening range. Take-profit can be set to a fixed R-multiple, a projection of the opening range's size, or disabled entirely (stop-only).
5. **Session close:** Optionally, any open position is force-closed at a configurable time of day.
**Inputs**
- Opening Range start/end time
- Entry cutoff time
- SMALL/LARGE classification thresholds (%)
- Take-profit mode (R-multiple, ORB projection, or none) and multiplier
- Optional end-of-session exit time
**Notes**
- The opening range and entry window are drawn on the chart (box + lines) each session so you can visually verify what the strategy is reacting to.
- This script does not use repainting logic — all decisions are based on confirmed price action within the defined windows.
- Backtest results shown in the Strategy Tester do not account for slippage or commissions unless configured in the strategy properties; please set these to match your broker before drawing conclusions from the equity curve.
- This script is provided for educational and informational purposes only. Past performance, whether real or simulated, is not indicative of future results. Nothing here constitutes financial advice — always test thoroughly and understand the logic before using any strategy with real capital. Strategi

Clock_Live and Replay AwareClock — Live / Replay Aware
A simple on-chart clock that always tells you the truth about what time it's showing — whether you're trading live or running Bar Replay.
Why this exists
Most clock indicators only show your real-world time, which becomes misleading (or useless) the moment you activate TradingView's Bar Replay feature — you end up staring at a clock that has nothing to do with the price action on screen. This indicator detects which mode you're in and adapts automatically.
Features
LIVE mode (green): Displays your actual real-time clock, synced to live incoming ticks.
REPLAY mode (orange): Displays the timestamp of the bar currently being replayed, so the clock always matches what you're watching, not your wall clock.
CHART mode (gray): Shown when you're simply scrolled through history with no live feed active.
Countdown timer: Shows time remaining until the next bar closes — exact in live mode, and estimated in replay mode using a rolling average of how long recent replayed bars have taken to form (adapts automatically if you change replay speed).
Configurable timezone, 12h/24h format, date display, table position, and colors.
How replay detection works
Pine Script has no official flag for "is Bar Replay active." This script uses a reliable heuristic instead: on a genuine live (still-forming) bar, its scheduled close time is always in the future relative to the current time. During replay, the bar being replayed is historical, so its close time has already passed. Comparing the two lets the script tell live and replay bars apart with no false positives in normal use.
Notes
The replay countdown is an estimate, not exact — replay speed isn't exposed to Pine Script, so it's inferred from recent bar timing and may lag by a bar or two after you change speeds.
Clock updates are tick-driven (a Pine Script constraint), so on very quiet symbols the seconds display may not tick with perfect real-time smoothness. Penunjuk

ES Clean Major Market Structure - HH HL LH LLES Clean Major Market Structure – HH HL LH LL
This indicator is designed to provide a clean visual representation of market structure by identifying meaningful swing highs and swing lows while filtering out smaller price movements.
The script classifies confirmed swing points as:
HH – Higher High: A swing high above the previous swing high.
HL – Higher Low: A swing low above the previous swing low.
LH – Lower High: A swing high below the previous swing high.
LL – Lower Low: A swing low below the previous swing low.
The goal is to make it easier to identify developing bullish and bearish market structure without filling the chart with signals from every small price fluctuation.
Market Structure
The indicator maintains a directional structure bias:
Bullish Structure
Higher Highs (HH)
Higher Lows (HL)
Dashboard displays: BULLISH
Watch for continued HL → HH development
Bearish Structure
Lower Lows (LL)
Lower Highs (LH)
Dashboard displays: BEARISH
Watch for continued LH → LL development
The structure dashboard is intended as a quick visual reference and should not be interpreted as an automatic trade signal.
Swing Strength
Swing Strength determines how many bars on each side of a potential swing are required before that swing can be confirmed.
For example, with Swing Strength set to 2, a pivot requires two bars on the left and two bars on the right.
Because right-side bars are required, HH/HL/LH/LL labels are confirmed after the actual pivot occurs and are plotted back on the pivot bar. They should not be interpreted as signals that were available at the exact moment of the labeled candle.
Minimum Swing Move
Minimum Swing Move filters smaller changes between swing points.
Increasing this value produces fewer, more significant structure labels. Decreasing it makes the indicator more sensitive to smaller price movements.
For ES, the default settings are:
Swing Strength: 2
Minimum Swing Move: 1.50 points
These settings can be adjusted depending on timeframe and trading style.
Additional Chart References
The indicator also displays:
EMA 14 – Short-term price momentum reference
SMA 20 – Trend reference
Session Open – Daily/session opening level
50% Session Midpoint – Midpoint between the developing session high and session low
Intended Use
This indicator is designed primarily as a market-structure visualization tool, not an automated entry system.
One possible way to interpret the structure is:
Bullish: HH → HL → HH
Bearish: LL → LH → LL
Traders may use the structure labels together with their own price-action, support/resistance, liquidity, risk-management, and higher-timeframe analysis.
The indicator can be used on different intraday timeframes. Lower timeframes generally produce more structure changes, while higher timeframes naturally filter more market noise.
Disclaimer: This script is provided for educational and informational purposes only. It does not provide financial advice or guarantee future market performance. Users are responsible for their own trading decisions and risk management. Penunjuk

Impulse Retention Map [MQLSoftware]OVERVIEW
Impulse Retention Map shows how much of a sharp price move remains after it forms. It automatically fixes the move's origin, halfway level and closing endpoint, then follows subsequent closes to distinguish a partial retracement, a full unwind and a recovery after a deep retracement.
The question is simple: has price kept the move, given half of it back, or returned all the way to its origin? No manual anchors, external signal source or volume feed are required.
DETECTION AND ORIGINAL CONTRIBUTION
The script measures a short close-to-close displacement. With the default settings, a qualifying impulse must satisfy all of these conditions:
1. The absolute change from the close three bars earlier to the current close is at least 2.0 times ATR, with a minimum size of two price ticks. The 20-bar ATR reading is taken at the origin bar, before the three subsequent price changes being measured. The move therefore does not increase its own volatility benchmark.
2. Path efficiency is at least 0.75: the absolute net change divided by the sum of the three absolute close-to-close changes. A reading of 1 means no closing-price retracement inside the window.
3. The final close is in the directional outer 30% of the impulse window's high-low range: near the high for an upward move or near the low for a downward move.
ATR scaling, path efficiency and halfway retracements are established concepts. The contribution here is their use in one automatic, frozen displacement episode: detection uses a pre-window volatility reference, the resulting map has fixed price boundaries, and the subsequent close-based events follow an explicit lifecycle. It measures a short move's retention rather than constructing pivot-based trend waves, projecting reversal targets or evaluating signals supplied by another indicator.
A map is admitted on the first qualifying bar of a fresh directional burst, subject to spacing of at least one impulse window since the previous admission. Consecutive qualifying bars in the same direction do not create repeated maps. A burst blocked by the spacing rule is not queued for later admission. A newly admitted map replaces any still-active previous map; replacement is not treated as a successful outcome.
READING THE MAP
The three fixed references are:
100% — the close at which the impulse was detected.
50% — halfway between that close and the origin.
0% — the closing price at the beginning of the measured move.
Move retained (%) = 100 x (evaluated close - origin) / (impulse close - origin).
The same formula works for upward and downward impulses. For an upward move from 100 to 110, a later close at 107 retains 70%; a close at 112 retains 120%. Values above 100% describe extension beyond the original move. Values below 0% mean price closed beyond the origin in the opposite direction. These percentages are price-distance measurements, not success rates or probabilities.
Teal identifies upward impulses and rose identifies downward impulses. The half between the impulse close and midpoint uses the direction colour; the half between midpoint and origin uses a quieter amber tint. These are measurement areas, not prescribed entry, stop or target zones.
The UP/DOWN label reports the initial move in units of its pre-impulse ATR. The status panel shows retained movement, the lowest retained reading observed on a confirmed close since detection, the original price distance, the initial ATR multiple and the number of bars tracked. When an episode finishes, the panel shows a final snapshot until a new map is admitted.
EVENTS AND LIFECYCLE
Subsequent evaluation starts on the bar after detection. The impulse's own formation bars cannot supply a later outcome.
HALF BACK — the first subsequent close retains 50% or less, but remains above 0%.
UNWOUND — a close retains 0% or less. Tracking ends. A direct jump through the origin is recorded as UNWOUND without inventing an earlier HALF BACK event.
RECOVERED — after a HALF BACK event, a later close reaches or exceeds 100% retention. Tracking ends. This does not mean the entire intervening path held above the halfway line.
EXPIRED — the tracking limit is reached without an earlier terminal outcome; 60 bars by default. An unwind or recovery on the final allowed bar takes precedence over expiry.
REPLACED — a fresh qualifying impulse is admitted while the earlier map is still active. The earlier map stops at that bar. Its final status is available in the original impulse label's tooltip and as an event in the Data Window. Expiry also has a Data Window event; neither creates a separate outcome label on the chart.
Between events, the panel can show NEW IMPULSE, HOLDING, EXTENDED, DEEP RETRACE or REBUILDING. REBUILDING means a map that previously returned at least half has moved back above 50% but has not yet recovered the full original move.
The old episode is evaluated before a new one is admitted. Consequently, an outcome for the old map and a new impulse can occur on the same closed bar.
CONFIRMED BARS AND DISPLAY CHANGES
Detection, retained readings, outcome flags and alerts update only on confirmed chart bars. The script uses no higher-timeframe requests, future-bar data, pivots or backward-shifted event markers. A map starts at the detection bar, although its origin price comes from the earlier close. It is not drawn across the formation window as if it had been known then.
The display does evolve: an active map extends to each newly confirmed bar; finishing a map dims its existing drawings and updates its tooltip; older maps and their outcome labels are removed as the retention limits are reached. The latest reference labels move with the chart's right edge. These presentation changes do not move the recorded event bars or change a map's fixed price boundaries. They also mean the final historical appearance is not a literal recording of how bright each zone looked at every earlier moment.
Changing inputs, symbol, timeframe, feed or available history recalculates the script. Provider corrections and price adjustments can change past input data. Closed-bar processing does not prevent those external changes.
SETTINGS AND ALERTS
Detection controls the impulse window, minimum ATR-scaled move, minimum path efficiency, ATR baseline length and tracking duration. Defaults are 3 bars, 2.0 ATR, 0.75 efficiency, 20-bar ATR and a 60-bar tracking limit. The directional closing-location filter stays fixed at 70%.
Display controls how many maps remain visible (six by default), outcome labels, the status panel and its position, latest-map reference labels, and colours. Display settings do not alter detection or outcomes. The panel distinguishes initial warmup, unavailable price data, a flat price range and waiting for a qualifying move when no map has yet been created.
Five alert conditions are available: new up impulse, new down impulse, half of impulse returned, impulse fully unwound, and impulse recovered. Create the desired TradingView alert and select Once Per Bar Close. Alerts must be configured by the user; adding the indicator does not create them automatically.
USE AND LIMITATIONS
Add the indicator to a standard candlestick chart and read the latest fixed references alongside the panel. Higher movement or efficiency thresholds generally select fewer impulses. The parameters are heuristic filters, not optimized probabilities. The tool can use price data across crypto, forex, indices and stocks; it does not require traded or tick volume.
Only closes resolve the tracked outcomes. A wick through halfway or origin that closes back beyond it does not establish the corresponding close-based event. Session gaps are included in close-to-close displacement and can qualify as impulses. The script does not reconstruct intrabar order, identify participants, estimate order flow or distinguish a session gap from continuously traded movement.
Only one episode is active at a time. New impulses can replace unresolved ones, so the displayed map history is not a complete sample of every possible retracement. No aggregate win rate, trading expectancy, order fills, fees, slippage or profitability backtest is calculated. Synthetic chart types produce measurements of synthetic prices and should not be interpreted as execution-price evidence.
This is a descriptive chart-analysis tool, not a prediction of recovery or a recommendation to enter or exit a position. Penunjuk

Penunjuk

Structure-Anchored VWAP [WillyAlgoTrader]📐 Structure-Anchored VWAP is an overlay indicator that anchors a true volume-weighted average price to market structure and re-anchors it automatically at every confirmed swing pivot, structure break, fast extreme, or one manual date — combining a pivot-based structure engine, an O(1) prefix-sum VWAP core, volume-weighted sigma bands, a retest entry model with ATR risk management, and a sectioned dashboard with session statistics.
The core insight: a VWAP anchored to the start of the current structural leg tells you the average price at which volume actually changed hands since this move began. That is the level participants in this leg are collectively break-even at. Session VWAP resets at midnight and ignores structure. Manual anchored VWAP requires you to drag it and re-drag it. This indicator keeps the anchor synchronised with the structure itself, and measures how stretched price is from that anchor in the leg's own volume-weighted standard deviations rather than in generic ATR units.
It works on any market and any timeframe. On instruments with no volume feed it falls back to time weighting automatically and says so in the dashboard.
🧩 WHY THESE COMPONENTS WORK TOGETHER
A VWAP alone has no memory of structure — it does not know whether the market is making higher highs or lower lows, so it cannot know when its own anchor has gone stale. A structure detector alone tells you HH / HL / LH / LL but gives you no price level to trade against. Deviation bands built on ATR describe candle size, not participation, so they say nothing about where volume was actually transacted. And an entry signal without a fixed stop and target is not a trade, it is an opinion.
This indicator connects all four into one chain:
Pivot structure engine → anchor selection → prefix-sum anchored VWAP → volume-weighted sigma bands → retest detection → ATR risk model → session statistics
The structure engine finds confirmed swing highs and lows, filters them by ATR amplitude and enforces strict high/low alternation, so every anchor is a real structural turn rather than a passing wick. Anchor selection decides which of those turns starts a new leg, with four different policies for four trading styles. The prefix-sum core then computes the anchored VWAP for that leg — and because it also accumulates the sum of squared prices, the same pass produces the leg's own volume-weighted standard deviation, so the bands are derived from the same data as the line instead of being bolted on. The retest engine watches the distance between price and that line, requires price to leave and come back, and only then produces an entry. The risk model turns the entry into a fixed stop and three targets, and the statistics layer records what happened to each of them.
Remove any link and the chain stops working. Without structure anchoring, the VWAP measures a leg that ended days ago. Without the ATR amplitude filter, every minor wick creates a new anchor and the line resets constantly. Without the sigma bands, "far from VWAP" has no unit. Without the retest rule, every touch of the line is a signal, including the fifty touches that happen while price is glued to it. Without the risk layer, you know where to enter but not where you are wrong.
🔍 WHAT MAKES IT ORIGINAL
1️⃣ Prefix-sum VWAP core — any anchor evaluated in O(1), including a decayed one.
Three running totals are maintained on every bar, where p is the price source and w is the bar weight:
— S_w(t) = lam × S_w(t−1) + w(t)
— S_pw(t) = lam × S_pw(t−1) + p(t) × w(t)
— S_p2(t) = lam × S_p2(t−1) + p(t)² × w(t)
The sum over any leg is then recovered without looping:
— sum = S(t) − lam^(t−a+1) × S(a−1)
With lam = 1 this is an exact cumulative anchored VWAP — every bar of the leg keeps its full weight, the same quantity the built-in Anchored VWAP tool computes. With lam < 1 the same identity still holds, which is what makes the optional Half-life mode possible without a second engine.
Why this matters: re-anchoring becomes cheap. Moving the anchor does not require replaying the whole leg bar by bar, so the indicator can afford four anchor modes and legs up to 4000 bars long without a performance penalty.
2️⃣ Volume-weighted sigma bands — dispersion of the leg, not size of the candle.
Because the squared-price sum is already accumulated, the leg's variance comes out of the same pass:
— VWAP = sum_pw / sum_w
— sigma = sqrt( max( sum_p2 / sum_w − VWAP², 0 ) )
Bands are drawn at VWAP ± multiplier × sigma. Band 1 defaults to 0.5 sigma (the value-area edge of this leg), Band 2 to 2.0 sigma and is off by default.
Why this matters: an ATR band tells you how big recent candles were. A volume-weighted sigma band tells you how widely the volume of this specific leg was distributed around its own average price. Two markets with identical ATR but different participation profiles get different bands, and the "Premium / Fair value / Discount" classification in the dashboard becomes comparable across instruments.
3️⃣ Four anchor modes — one engine, four trading styles.
— Swing (default): a new leg starts at every confirmed pivot. The anchor is the opposite extreme, so a bullish leg is anchored at the swing low that preceded it.
— Structure break : a new leg starts only when price closes beyond the previous swing. The anchor is then the extreme that preceded the break, found by scanning back from that swing. Fewer legs, each tied to an actual break of structure.
— Fast : no confirmation delay. The bar printing the highest high or lowest low of the last N bars (default 30) is treated as a new extreme, and the leg flips the moment an extreme opposite to the previous one appears. When a bar prints both a new high and a new low, the candle direction decides which one is taken.
— Manual : a single leg from a chosen date and time, which reproduces the behaviour of the built-in Anchored VWAP tool inside the same framework — useful for comparing against a manual anchor or pinning a level.
4️⃣ Structure engine with ATR amplitude filter and strict alternation.
Pivots come from equal left/right lookback (default 55/55). A new pivot of the opposite type is only accepted when it clears an ATR-scaled amplitude:
— accept a new high when: pivotHigh − lastSwingLow ≥ minSwing × ATR(atrLen)
— accept a new low when: lastSwingHigh − pivotLow ≥ minSwing × ATR(atrLen)
Default minSwing 1.5, ATR length 13. A pivot of the same type as the last one does not create a new structural point — it only supersedes the previous extreme if it is more extreme. This enforces a clean alternating high-low-high-low sequence instead of clusters of adjacent highs.
Classification against the previous extreme of the same type, with an equality tolerance (default 0.1 × ATR):
— |current − previous| ≤ eqTol × ATR → EQH or EQL
— current > previous → HH or HL
— current < previous → LH or LL
5️⃣ Retest entry model — price must leave before it can come back.
Every bar the engine measures the relationship between the bar range and the anchored VWAP:
— tol = sigma × touchTolerance (default 0.25), or ATR × 0.1 while sigma is still zero
— touch = low ≤ VWAP + tol and high ≥ VWAP − tol
— outside = bullish leg ? low > VWAP + tol : high < VWAP − tol
An "away" counter increments on every outside bar and resets to zero on every touch. A retest fires only when a touch happens while the committed away counter has already reached the threshold (default 5 bars).
Why this matters: a raw "price touched VWAP" condition fires continuously in the chop that surrounds every mean. Requiring a genuine departure first converts an omnipresent condition into a discrete, countable event.
6️⃣ Volume balance — who controlled this leg.
While the leg accumulates, every bar's weight is assigned to one of two buckets by where it closed relative to the VWAP at that moment:
— close ≥ VWAP → volUp += w
— close < VWAP → volDn += w
— balance = volUp / (volUp + volDn) × 100
The dashboard shows this as a percentage with a bar gauge, and relabels it "Bars above VWAP" automatically when the instrument has no volume data. Above 50 % means most of the leg's participation happened above its own average price.
7️⃣ Signal strength — a transparent 0-100 context score.
Four independent components, published in full so the number is auditable rather than a black box:
— 40 pts × (volume balance aligned with leg direction, 0..1). For a bearish leg the balance is inverted before scoring.
— 25 pts if price sits on the leg's own side of the VWAP.
— 20 pts if price is not stretched beyond Band 2, i.e. |distance in sigma| ≤ band 2 multiplier.
— 15 pts if the leg has already produced at least one retest.
The score is clamped to 100 and shown with a gauge. This is a context filter, not a proven edge — it says how coherent the current leg is, nothing more.
8️⃣ VWAP memory levels — dead legs leave a level behind.
When a leg ends on a genuine direction flip, its final VWAP value is written to the chart as a dashed horizontal line. That line extends forward until price trades through it, then it is either removed or faded to dotted, depending on a setting. Up to four such levels are kept (configurable), and the newest push out the oldest.
When a level is created, the bars between the anchor and the current bar are scanned first, so a level that was already traded through is never shown as untouched.
9️⃣ Single-position trade model with break-even and outcome tracking.
A retest signal opens a trade only while flat — signals never stack. On entry, the levels are fixed once and never recalculated:
— slDistance = ATR(riskAtrLen) × slMultiplier
— long: SL = entry − slDistance, TP(n) = entry + slDistance × tpMult(n)
— short: SL = entry + slDistance, TP(n) = entry − slDistance × tpMult(n)
Presets set all four multipliers at once — Conservative 2.5 / 1R / 2R / 4R, Balanced 1.5 / 1R / 2R / 3R, Aggressive 1.0 / 1.5R / 2.5R / 4R, Scalping 0.8 / 0.8R / 1.5R / 2R, or Custom.
Break-even is optional and on by default: the first touch of TP1 moves the stop to the entry price, the entry label changes to show it now acts as the stop, and the stop line dims. TP1 still counts as a win. Hit checks begin only on the bar after entry and only on confirmed bars, so the entry bar's own range cannot close the trade it just opened.
🔟 Persistent trade forensics — the chart keeps the last result.
SL and TP lines are not deleted when the trade closes. They stay until the next entry, so the last trade remains readable on the chart: any target that was reached is redrawn as a solid teal line and its label gets a check mark, while untouched targets keep their original dashed style. Labels can show the distance from entry in percent, for example "SL 78120.5 (-0.36%)".
1️⃣1️⃣ Realtime correctness — ring buffers and a commit/undo pattern.
Functions that only run on some bars cannot use the history operator safely, because the history they see is sparse and does not correspond to chart bars. All per-bar values this indicator needs later are therefore written to explicit ring buffers on every single bar, and read back by index.
On top of that, the live leg uses a commit/undo pattern: statistics are always recomputed from the last confirmed state, and the provisional point for the forming bar is popped before a new one is pushed. A bar being formed can therefore never be counted twice, no matter how many ticks arrive.
1️⃣2️⃣ Continuous curve across anchor changes.
When a new anchor appears, the previous leg is not erased — it is cut exactly at the new anchor bar and frozen. The curve therefore has no gaps at handover points, including the case where a stronger extreme of the same type supersedes the previous one.
⚙️ HOW IT WORKS — CALCULATION FLOW
Step 1 — Structure: On each confirmed bar the engine evaluates pivot highs and lows with equal left/right lookback, applies the ATR amplitude filter, enforces high/low alternation and classifies the result as HH, HL, LH, LL, EQH or EQL.
Step 2 — Weighting: The bar weight is volume, or 1.0 when the instrument has no volume. If spike clamping is on, the weight is capped at N × the 50-bar median volume so a single print cannot dominate the average.
Step 3 — Accumulation: The three running totals of weight, price × weight and price² × weight are advanced, decayed by lam if Half-life weighting is selected.
Step 4 — Buffering: The totals plus high, low, close and ATR are appended to ring buffers, one entry per bar, with the current bar's provisional entry overwritten rather than duplicated on repeat ticks.
Step 5 — Anchor decision: The active anchor mode decides whether this bar starts a new leg and where that leg's anchor sits.
Step 6 — Leg build: On a new anchor the previous leg is trimmed to the anchor bar, frozen and archived, a memory level is created if the direction actually flipped, and the new leg is replayed once from the anchor to the current bar. On every other bar the live leg simply advances by one point.
Step 7 — Readouts: VWAP, sigma, distance in sigma and percent, zone, volume balance, leg age and the strength score are computed for the current bar.
Step 8 — Signal: The retest rule is evaluated. A qualifying retest, on a confirmed and warmed-up bar, while flat, becomes an entry.
Step 9 — Risk: On entry the stop and three targets are fixed. On later confirmed bars they are tested for hits, break-even is applied after TP1, and the trade is closed by stop or final target.
Step 10 — Reporting: Lines, labels, markers, the dashboard and alerts are updated. Closed trades update the win/loss counters and the form strip.
📖 HOW TO USE
🎯 Quick start:
1. Add the indicator. Defaults are tuned for 15m to 4H swing structure.
2. Watch the coloured curve — it is the anchored VWAP of the leg the market is currently in.
3. Wait for a Long ▲ or Short ▼ marker. That is a retest of the VWAP in the direction of the leg.
4. Read the Trade section of the dashboard for the stop, the three targets and the R:R.
5. If signals are too frequent, raise "Bars away before a retest counts". If legs are too frequent, raise pivot strength or the minimum swing size.
👁️ Reading the chart:
— 🟢 Green curve = bullish leg, anchored at the swing low that started it.
— 🔴 Red curve = bearish leg, anchored at the swing high that started it.
— Shaded band around the curve = ± sigma of this leg. Price inside it is at fair value for the leg.
— 🟢 Long ▲ / 🔴 Short ▼ marker = a retest entry was taken on that bar.
— Dotted blue line = entry. Solid red line = stop. Dashed green lines = TP1, TP2, TP3.
— A target that turns solid teal with a ✓ in its label was reached.
— An orange entry label reading "→ SL (BE)" means the stop has been moved to break-even.
— Dashed horizontal level far from the curve = a memory level, the final VWAP of a finished leg.
— HH / HL / LH / LL / EQH / EQL tags mark every confirmed pivot.
📊 Dashboard fields:
— Trend : direction of the current leg.
— Signal : LONG, SHORT or Wait. A new trade can only open while flat.
— Strength : the 0-100 context score with a gauge.
— Last event : the most recent new leg or retest.
— Timeframe : the chart resolution.
— Mode : active anchor mode and weighting, plus a note when the symbol has no volume.
— Anchor : structure tag and price of the bar the leg is anchored to.
— Leg age : bars since the anchor and the price move from it.
— VWAP : the anchored VWAP on the current bar.
— Price vs VWAP : distance in sigma and in percent.
— Zone : Premium above Band 2, Discount below it, Fair value in between.
— Vol above VWAP : share of the leg's weight transacted above the VWAP, with a gauge.
— SL / TP1 / TP2 / TP3 : the fixed levels of the open trade. A ✓ marks a reached target, "BE @" marks a stop moved to entry.
— R:R (TP1) and SL Dist % : reward-to-risk at the first target and the stop distance as a percentage of entry.
— Trades / W / L / Win rate / Form : closed trades in the loaded history, the win-loss split, the win rate with a gauge and the last ten outcomes as ▰ and ▱.
🔧 Tuning guide:
— Too many legs, the line resets constantly: raise pivot strength (55/55 → 80/80) or the minimum swing size (1.5 → 3.0).
— Legs appear too late: lower pivot strength, or switch the anchor mode to Fast for immediate flips.
— Too many entries: raise "Bars away before a retest counts" and lower the touch tolerance.
— The line drifts too far from price on long legs: switch Weighting to Half-life. This is no longer a textbook VWAP, and the dashboard says so.
— Comparing against the built-in Anchored VWAP tool: set the mode to Manual with the same anchor time, price source to hl2, weighting to Cumulative, and turn volume clamping off.
— Stops feel too tight or too wide: change the Risk Preset before touching individual multipliers.
⚙️ KEY SETTINGS
⚙️ Main Settings:
— Pivot strength left / right (default 55 / 55): bars required on each side of a swing. Right is the confirmation delay.
— Minimum swing size (default 1.5 × ATR): amplitude filter for new pivots. 0 disables it.
— ATR Length (default 13): ATR used by the swing filter and the equality tolerance.
— Re-anchor on (default Swing): Swing, Structure break, Fast or Manual.
— Fast mode: extreme lookback (default 30): lookback for the Fast mode only.
— Equal high/low tolerance (default 0.1 × ATR): threshold for EQH and EQL tags.
— Manual anchor : date and time for the Manual mode, shown in the chart's timezone.
📐 Anchored VWAP:
— Price source (default hl2): hl2 matches the built-in tool, hlc3 weights closes more, close is the most reactive.
— Weighting (default Cumulative): Cumulative is a true VWAP, Half-life fades older bars.
— Half-life (default 21 bars): only used by Half-life weighting.
— Clamp volume spikes (default on, 4 × median): caps outlier volume bars.
— Max leg length (default 4000 bars): keeps very old anchors bounded.
📏 Deviation Bands:
— Band 1 (default on, 0.5 sigma): inner band.
— Band 2 (default off, 2.0 sigma): outer band, also defines the Premium and Discount zones.
— Fill transparency (default 90).
🎯 Signals & Levels:
— Bars away before a retest counts (default 5).
— Touch tolerance (default 0.25 sigma).
— VWAP memory levels (default on, max 4, crossed levels removed).
🛡️ Risk Management:
— Risk Preset (default Balanced): Conservative, Balanced, Aggressive, Scalping or Custom.
— ATR Length (SL) (default 13).
— SL ×ATR / TP1 / TP2 / TP3 ×Risk (defaults 1.5 / 1.0 / 2.0 / 3.0): used by the Custom preset.
— Break-Even After TP1 (default on).
— Show SL/TP Lines, Labels, % Distance (all on by default).
— Entry / SL / TP Line Style (defaults Dotted / Solid / Dashed).
🎨 Visual:
— Theme (default Auto): Auto detects the chart background, Dark and Light force it.
— Show Buy/Sell Signals, HH/HL/LH/LL, Leg Background, Watermark .
— SL/TP Label Font Size (default Small).
— Finished legs kept on chart (default 30).
📊 Dashboard:
— Position (default Top Right) and four independent section switches: Market, VWAP, Trade, Stats.
🔔 ALERTS
— 🟢 LONG — VWAP retest entry, with price, VWAP, SL, TP1, TP2, TP3 and R:R
— 🔴 SHORT — same payload, short side
— 🛑 SL HIT — entry and stop price. Reported as 🛡️ BE STOP-OUT when the stop had already been moved to break-even
— 🛡️ BREAK-EVEN — stop moved to entry after TP1 (optional)
— 🎯 TP1 HIT, 🎯🎯 TP2 HIT, 🏆 TP3 HIT — first touch of each target (optional)
— 🟢 New bullish leg / 🔴 New bearish leg — a new anchor was set (optional)
— 🔵 Close above VWAP / 🔵 Close below VWAP — the close crossed the anchored VWAP (optional)
Entry alerts support both plain text and a JSON webhook payload. All alerts fire on bar close.
⚠️ IMPORTANT NOTES
— 🚫 No repainting of confirmed values. Every structure event, entry, stop, target and alert is evaluated only when barstate.isconfirmed is true. Pivots use equal left and right lookback, so the swing point is in the past by the "right" value at the moment it becomes known — that is delayed confirmation, not a look into the future. Stop and target hits are tested only from the bar after entry. Alerts fire once per bar close.
— 📐 What does update intrabar. The VWAP value of the leg currently in progress moves while the bar is forming, because that is what an anchored average does. Values on closed bars never change. A commit/undo pattern makes sure a forming bar is never counted twice in the statistics.
— 📐 The unfinished leg can be shortened. When a stronger extreme of the same type is confirmed, the current leg is cut at that point and a new leg starts there. Legs that have already been archived are never modified.
— 📊 The statistics are not a backtest. Trades, win rate and the form strip are counted over the history currently loaded on the chart and reset when the chart reloads or a setting changes. They describe how this rule set behaved on the visible data. Past performance does not guarantee future results.
— 🧮 The strength score is a context filter. Its four components and weights are published above precisely so it can be judged on its merits. It measures the internal coherence of the current leg, not the probability of any outcome.
— ⚖️ Half-life weighting is not a VWAP. When that mode is selected the line is an exponentially weighted average, useful on instruments without volume, but it is no longer the textbook volume-weighted average price. The dashboard states the active mode at all times.
— 🌐 Universal compatibility. Works on stocks, futures, forex, crypto and indices, on every timeframe. Where no volume data exists the weighting falls back to time and the dashboard relabels the volume-balance row accordingly.
— 🛠️ Decision support, not automation. This is an anchored VWAP and structure analysis tool with a risk framework attached. It marks anchors, measures distance in the leg's own units, detects retests and lays out stops and targets — trade decisions remain yours. Penunjuk

FrenchFinance_Funding v0.1Shows the perpetual funding rate of the charted coin, averaged across Binance, Bybit and OKX USDT perpetuals, as coloured columns. It is a display tool: it tells you who is paying to hold a position and how unusual that is. It gives no buy or sell signal.
HOW IT WORKS
• The coin is detected from the chart's base currency (BTC, ETH…). The funding rate of its USDT perpetual is requested on each selected venue through TradingView's crypto derivatives data (the same "Funding Rate" metric as TradingView's built-in indicators) and averaged with equal weights; venues without that perpetual are skipped. On a stock, index or forex chart nothing is shown, unless you set a coin manually.
• Column height: z-score of the funding over the last 100 bars (default), or the raw funding in %.
• Colour: green when longs pay, red when shorts pay. The further the value is from its recent norm, the brighter the colour.
• Label on the last bar: current funding in %, or "Funding not available on this pair".
SETTINGS
• Extremes: z-score threshold (default 1.5 over 100 bars) or absolute thresholds in %.
• Venues can be switched on and off. Bar height, clipping, data scale and colours are adjustable.
ALERTS
Two alerts: funding extremely positive (longs pay) and funding extremely negative (shorts pay). They report a state, not a trade.
NOTES
• The last bar shows the predicted funding, which keeps updating until settlement; closed bars do not change.
• Built with the open-source TradingView "Request" library (cryptoDerivativeMetric). Funding is information about positioning, not a forecast. Penunjuk

OSOK Opening TimesOSOK Opening Times marks the opening times of active trading periods with vertical lines. It automatically adjusts the periods shown to match your chart timeframe, using solid lines for the larger period and dotted lines for the smaller active period.
Each boundary pair marks the current period's opening and the next period's opening . This creates a clear time reference for the active day, week, month or quarter.
Timeframe visibility
The breakdown below shows the default line styles when all visibility settings are enabled.
Intraday below 1D, including 15m, 1H and 4H
Solid: current week opening to next week opening.
Dotted: active day opening to next day opening.
Daily - 1D
Solid: current month opening to next month opening.
Dotted: active week opening to next week opening.
Weekly - 1W
Solid: current quarter opening to next quarter opening.
Dotted: active month opening to next month opening.
Monthly - 1M
Solid: none.
Dotted: current quarter opening to next quarter opening.
Other intervals above 1D, such as 2D, 2W and 3M
No lines are displayed.
A quarter is a three-month period. Quarterly boundaries appear on the 1W and 1M charts; the 3M chart itself displays no lines.
Active periods and shared boundaries
Only the active periods are displayed. As new periods begin, their boundaries replace the previous markers. On intraday charts, daily dotted lines bracket only the active daily candle.
When two displayed boundaries coincide, the larger period's line takes precedence. The first daily candle of the week uses the weekly opening line as its starting boundary, avoiding a duplicate daily line.
Appearance and customization
Solid lines: black at 30% opacity by default.
Dotted lines: black at 100% opacity by default.
Line width: 1 by default.
Visibility, color, opacity, style and width can be adjusted in the indicator's settings. Separate style settings are available for the different chart contexts.
Opening times and chart support
The indicator follows the symbol's TradingView candle sessions. Changing the chart's display timezone does not redefine those openings.
Upcoming boundaries use projected opening times. The active periods are determined by the latest chart bar, including when using Bar Replay.
The indicator supports standard time-based charts and Heikin Ashi. Tick, Renko, Range, Kagi, Line Break and Point & Figure charts are excluded.
Penunjuk

ORB 15 Break + Retest ConfirmationThis indicator is designed for use on a 5-minute chart and identifies a specific Opening Range Breakout setup using the first 15 minutes of the regular trading session.
It automatically calculates the ORB 15 High (15H) and ORB 15 Low (15L) from the 9:30 AM to 9:45 AM New York session. Once those levels are established, the script waits for a valid breakout.
A bullish setup begins only when a completed 5-minute candle closes above ORB 15H. After the breakout, the indicator waits for price to return and retest the 15H level. If price touches or slightly penetrates the level and the 5-minute candle closes back above it, the script generates a LONG confirmation.
A bearish setup works the same way in reverse. A completed 5-minute candle must first close below ORB 15L. The script then waits for price to retest the 15L level from below. If price touches or slightly crosses the level and the candle closes back below it, the script generates a SHORT confirmation.
The script uses a sequential state-based approach, so a retest signal cannot occur unless a valid breakout happened first. Wick-only breakouts are ignored, and signals are evaluated only on completed 5-minute candles.
The indicator also includes a configurable retest tolerance and a maximum number of bars allowed for the retest to occur. If the breakout fails or the retest does not happen within the defined window, the setup is reset.
This tool is intended to help identify structured breakout → retest → confirmation setups around the 15-minute opening range.
Disclaimer: This indicator is provided for educational and informational purposes only and does not constitute financial or investment advice. Signals may be inaccurate, delayed, or fail under certain market conditions. Always perform your own analysis, use appropriate risk management, and trade at your own risk. The author is not responsible for any losses resulting from the use of this script. Penunjuk

Session Breakout ContextMulti-Market Session Breakout Context
Description
Multi-Market Session Breakout Context is a rule-based intraday indicator designed to help traders organize session structure across gold, forex pairs, and selected index instruments. It was originally developed for XAUUSD and can also be applied to other markets whose session behavior, liquidity, and data quality are suitable for this type of analysis.
The indicator tracks the Asia, London, and New York session ranges using the America/Chicago timezone. It displays session highs, lows, and midpoint reference levels, then classifies selected price movements as directional breakouts or sweep/fade conditions. The chart markers and dashboard are intended to support discretionary analysis and trade planning. They do not place orders, manage positions, or guarantee a market outcome.
The main session conditions are:
•London breakout: price moves beyond the completed Asia session range.
•London fade: price sweeps an Asia range boundary and satisfies the rule-based reversal filters.
•New York breakout: price moves beyond the completed London session range.
•New York fade: price sweeps a London range boundary and satisfies the rule-based reversal filters.
•Asia breakout: price moves beyond the completed New York session range.
The indicator also provides additional market context through pivot-based directional readings, RSI divergence conditions, volatility measurements, volume-derived pressure and spread classifications, prior-day levels, previous-week levels, daily range references, weekly open, four-hour swing references, and a fixed time blackout window. These components are contextual filters. They are not independent guarantees of direction, probability, or profitability.
The optional dashboard summarizes the current session state, rule-based directional alignment, reference levels, entry and stop planning zones, target reference levels, and hypothetical point movement. Any displayed score is a rule-based alignment score, not a statistically validated probability or accuracy rate. Any displayed point movement is hypothetical and does not represent broker P&L, account performance, or a Strategy Tester result.
How to use the indicator
1.Apply the indicator to a standard candlestick chart.
2.Begin with XAUUSD and a lower intraday timeframe such as 5 minutes or 15 minutes.
3.Confirm that the chart symbol, exchange or broker feed, timezone, and session schedule are appropriate for your market.
4.Allow the relevant session range to form before interpreting its breakout or fade conditions.
5.Use the plotted levels as analytical references rather than guaranteed entry or exit prices.
6.Independently evaluate market structure, spread, volatility, scheduled events, liquidity, and position risk before making any trading decision.
7.Test the indicator on historical data and in a simulated environment before considering live use.
The displayed session schedule is based on fixed Chicago-time windows. The indicator should therefore be checked after daylight-saving changes and on every symbol or data feed where it is used. Session behavior can differ between spot metals, forex pairs, CFDs, futures, and other instruments.
Signal interpretation
A green or red breakout marker identifies a rule-based directional breakout classification. A blue or orange fade marker identifies a rule-based sweep/fade classification. These classifications describe what the indicator detected; they are not instructions to buy or sell and do not predict how far price will move.
Signals may depend on the active chart bar and on confirmed pivot information. A condition can change before the realtime bar closes. Users should evaluate signals on confirmed bars when they require stable, repeatable readings and should not assume that every historical marker was available at the beginning of the bar where it appears.
The indicator is intended for standard time-based candles. Signal interpretation may be misleading on non-standard chart types such as Heikin Ashi, Renko, Kagi, Point & Figure, Line Break, or Range charts.
Example screenshots
The following screenshots show selected visual examples on XAUUSD. They demonstrate how the indicator labels different session conditions. They are illustrative examples only and are not a complete record of all signals.
1. Full XAUUSD overview
Full overview of the indicator on XAUUSD showing session ranges, reference levels, breakout and fade markers, and the rule-based dashboard.
2. London fade long
London fade-long example after price sweeps the lower boundary of the completed Asia range. The marker represents a rule-based condition, not a guaranteed reversal.
3. London fade short
London fade-short example after price sweeps the upper boundary of the completed Asia range. Traders should independently evaluate confirmation, stop placement, and market conditions.
4. London sell
London bearish breakout example showing a downside break of the Asia session range. The displayed level is an analytical reference and does not represent an executed order.
5. New York sell
New York bearish breakout example showing a downside break of the completed London session range. Results may vary according to symbol, data feed, spread, liquidity, and execution conditions.
6. New York fade long
New York fade-long example after price sweeps the lower boundary of the completed London range. This is a rule-based signal classification for discretionary analysis.
7. New York fade short
New York fade-short example after price sweeps the upper boundary of the completed London range. The indicator does not guarantee continuation or reversal.
The screenshots are visual examples of the indicator’s signal classifications and are not a performance record. They do not show every signal, guarantee future results, or account for spread, slippage, commissions, liquidity, or execution delay. Signal behavior may vary across instruments, brokers, data feeds, and timeframes.
Limitations
This indicator is a decision-support and chart-organization tool. It is not investment advice, an automated trading system, a broker connection, or a guarantee of profit. It does not determine position size, account risk, contract quantity, execution quality, or whether a trade is appropriate for a particular user.
The indicator does not use a broker-level order book or guarantee access to true exchange-level volume. Volume-derived calculations may behave differently on symbols with limited, synthetic, tick, or unavailable volume. Reference levels and classifications can also vary according to the selected symbol, historical data, chart timeframe, session template, and data provider.
Historical examples should not be interpreted as evidence of future performance. Any decision to trade remains the user’s responsibility. Always consider the possibility of loss and use risk controls appropriate to your own circumstances.
Release notes
Initial public release of the Multi-Market Session Breakout Context indicator. This version provides Asia, London, and New York session levels, rule-based breakout and fade classifications, contextual reference levels, and an optional dashboard for discretionary chart analysis.
Penunjuk

FootprintKitAnalysis toolkit for the native footprint API introduced in Pine v6. It turns a `footprint` object into aggregated row statistics, price-interval measurements, low and high volume node runs, stacked imbalances, unfinished auction reads, absorption reads and multi-bar composite profiles.
It is written for script authors who build their own footprint tools and who would otherwise re-implement the same row loops in every script.
WHY THE LIBRARY NEVER CALLS request.footprint()
Pine allows only one unique footprint request per script. If the library issued that request internally it would consume the caller's single slot, and the importing script could no longer query the footprint on its own terms. So the caller makes the one allowed call and passes the resulting object into every function.
The consequence is that the library performs no requests, draws nothing and keeps no persistent state outside the Profile object you create yourself. There is nothing in it that can repaint.
WHAT IT COMPUTES THAT THE API DOES NOT EXPOSE
- Stacked imbalances. The API flags imbalance per row; the stack of consecutive flagged rows is what carries meaning in footprint reading, and it has to be assembled.
- Unfinished auction at the extremes of a bar, i.e. an extreme row that still shows trade on both sides.
- Volume traded inside an arbitrary price interval, with rows that only partly overlap the interval counted pro rata.
- Runs of thin rows, the price pockets a move passed through without trade, and runs of heavy rows, the shelves inside the bar.
- A composite profile across several bars with its own point of control and value area. request.footprint() returns one bar at a time; feeding successive bars into a Profile builds the multi-bar picture the single call cannot give.
- Distribution shape metrics that read the whole profile rather than only its peak.
FORMULAS
Aggressive volume per row and per interval is derived from total volume V and delta D as buy = (V + D) / 2 and sell = (V - D) / 2. This is exact by the definition of delta and avoids depending on optional per-row accessors.
slice() weights each row by the fraction of its height that falls inside the requested interval, k = overlap / rowHeight, clamped to 1. Counting a boundary row either whole or not at all is the usual source of error in hand-written versions.
concentration() is POC row volume divided by mean row volume. A value near 1 means volume was spread evenly, a high value means one price row absorbed most of the activity.
dispersion() is the Shannon entropy of the row volume distribution, normalised by ln(n) to the 0 to 1 range: H = -sum(p * ln p) / ln(n), where p is a row's share of bar volume. Zero means all volume sat in one row, one means a perfectly even spread. Unlike concentration it distinguishes a bar with two heavy rows from a bar with one.
deltaCentroid() returns the centre of mass of absolute delta as a fraction of the bar range from the low, showing where aggression concentrated regardless of which side was aggressive.
absorption() splits the bar range into thirds, measures each extreme third with slice(), and reports absorption when a third holds at least the requested share of bar volume while its delta points against the direction of the bar. Aggression that meets size and fails to move price is the signature of a passive participant taking the other side.
The composite value area grows outward from the point of control, repeatedly taking the heavier of the two neighbouring buckets until the requested share of total volume is enclosed.
USAGE
import Smart-Day-Trader/FootprintKit/1 as fpk
footprint fp = request.footprint(4, 70, 300)
fpk.RowStats s = fpk.stats(fp)
float conc = fpk.concentration(s)
float pos = fpk.pocPosition(s, high, low)
array voids = fpk.runs(fp, s, 0.4, 3, true)
= fpk.wicks(fp, open, high, low, close)
NOTES
A plan with footprint data access is required for the data itself; the library compiles on any plan because it makes no requests.
Choose ticks per row relative to the instrument's tick size rather than copying a default. On NASDAQ 100 E-mini futures the tick is 0.25 points, so 4 ticks per row equals one point and yields roughly 20 to 30 rows on a 5 minute bar. A value of 20 there would collapse the same bar into 4 rows, at which point concentration, entropy and row runs stop carrying information.
All functions accept a na footprint and return empty or na results rather than failing, so they are safe to call on bars without data.
REFERENCE
stats(fp)
Aggregates every row of a footprint in a single pass: totals, POC, delta,
imbalance counts and the price bounds actually covered by rows. Reading these values
one by one costs several loops over the same array; this does it once.
Parameters:
fp (footprint) : Footprint object returned by request.footprint(). Safe to pass na.
Returns: A RowStats object. When the footprint is na or empty, `n` is 0 and the
float fields are na.
concentration(s)
Concentration of the bar's volume: POC row volume divided by the mean row
volume. A value near 1 means volume was spread evenly across the bar; a high value
means a single price row absorbed most of the activity.
Parameters:
s (RowStats) : RowStats produced by stats().
Returns: The ratio, or na when statistics are empty.
dispersion(fp, s)
Normalised Shannon entropy of the volume distribution across rows, scaled to
0 to 1. Zero means all volume sat in one row, one means perfectly even spread. Unlike
concentration() this reads the whole shape rather than just the peak, so a bar with
two heavy rows is distinguished from a bar with one.
Parameters:
fp (footprint) : Footprint object.
s (RowStats) : RowStats produced by stats() for the same footprint.
Returns: Entropy in the 0 to 1 range, or na when fewer than two rows carry volume.
pocPosition(s, barHigh, barLow)
Where the POC sits inside the bar's range, as a fraction from the low.
0 places the heaviest row at the low of the bar, 1 at the high.
Parameters:
s (RowStats) : RowStats produced by stats().
barHigh (float) : High of the bar.
barLow (float) : Low of the bar.
Returns: Position clamped to 0 to 1, or na when the range is degenerate.
deltaCentroid(fp, barHigh, barLow)
Centre of mass of absolute delta inside the bar, as a fraction from the low.
Shows where aggression was concentrated regardless of which side was aggressive,
which often differs from where total volume sat.
Parameters:
fp (footprint) : Footprint object.
barHigh (float) : High of the bar.
barLow (float) : Low of the bar.
Returns: Position in the 0 to 1 range, or na when there is no delta to weight by.
slice(fp, priceA, priceB)
Volume traded inside an arbitrary price interval. Rows that only partly
overlap the interval are counted in proportion to the overlapped fraction of their
height, so the result is correct even when the interval boundaries fall mid-row.
This is the primitive behind wick, zone and level measurements.
Parameters:
fp (footprint) : Footprint object.
priceA (float) : One boundary of the interval. Order does not matter.
priceB (float) : The other boundary of the interval.
Returns: A Slice object. All fields are 0 and `share` is na when nothing overlaps.
wicks(fp, o, h, l, c)
Splits the bar's volume into upper wick, body and lower wick using slice(),
so partially overlapped rows are handled correctly. An empty upper wick slice on a
bar with a long upper shadow means price travelled there without trading size, which
reads very differently from a wick that carries volume.
Parameters:
fp (footprint) : Footprint object.
o (float) : Open of the bar.
h (float) : High of the bar.
l (float) : Low of the bar.
c (float) : Close of the bar.
Returns: A tuple of Slice objects.
runs(fp, s, ratio, minRun, below)
Finds every group of consecutive rows whose volume is below or above a
multiple of the bar's mean row volume, and returns them as price spans. With
below = true this locates thin rows, the price pockets a move passed through without
trade; with below = false it locates the heavy shelves inside the bar.
Parameters:
fp (footprint) : Footprint object.
s (RowStats) : RowStats produced by stats() for the same footprint.
ratio (float) : Multiplier applied to the mean row volume to form the threshold.
minRun (int) : Minimum number of consecutive rows required to report a span.
below (bool) : When true, keep rows at or below the threshold; when false, at or above.
Returns: An array of Span objects, ordered as the rows are ordered. Empty when nothing
qualifies.
stacks(fp, minRun, buySide)
Finds stacked imbalances: runs of consecutive rows all flagged on the same
side. The native API exposes the flag per row, but the stack is what carries meaning
in footprint reading, and stacks have to be assembled by hand.
Parameters:
fp (footprint) : Footprint object.
minRun (int) : Minimum number of consecutive flagged rows to report, commonly 3.
buySide (bool) : When true, collect buy imbalance stacks; when false, sell imbalance stacks.
Returns: An array of Span objects covering each stack. Empty when none reach minRun.
unfinished(fp, tol)
Tests the extreme rows for an unfinished auction: an extreme that still shows
trade on both sides, meaning the move stopped before either side was cleared out.
A finished extreme has one side at or near zero.
Parameters:
fp (footprint) : Footprint object.
tol (float) : Fraction of the extreme row's own volume below which a side counts as empty.
Use 0 for a strict test, or a small value such as 0.05 to tolerate noisy feeds.
Returns: A tuple of booleans. Both false when the footprint is empty.
absorption(fp, s, o, c, minShare)
Reads absorption at the extremes of the bar: one third of the bar's range
holding a large share of the volume with delta pointing against the bar's direction.
Aggression that meets size and fails to move price is the signature of a passive
participant taking the other side.
Parameters:
fp (footprint) : Footprint object.
s (RowStats) : RowStats produced by stats() for the same footprint.
o (float) : Open of the bar.
c (float) : Close of the bar.
minShare (float) : Minimum share of bar volume the third must hold, for example 0.4.
Returns: 1 when sellers were absorbed at the lows of an up bar, -1 when buyers were
absorbed at the highs of a down bar, 0 otherwise.
newProfile(step)
Creates an empty composite profile. request.footprint() delivers one bar at a
time; feeding successive bars into a profile builds the multi-bar picture the single
call cannot give on its own.
Parameters:
step (float) : Price bucket height. Use the row height from RowStats to keep the composite
at the same resolution as the footprint itself.
Returns: An empty Profile object.
method feed(p, fp)
Folds one bar's rows into the profile. Buckets are keyed by rounded row
midpoint and kept sorted, so repeated calls stay ordered and lookups stay cheap.
Call once per confirmed bar.
Namespace types: Profile
Parameters:
p (Profile) : Profile to update, modified in place.
fp (footprint) : Footprint object for the bar being added.
Returns: Nothing. The profile is mutated.
method sum(p)
Total volume held by the profile.
Namespace types: Profile
Parameters:
p (Profile) : Profile to read.
Returns: Sum of all bucket volumes, or 0 when the profile is empty.
method poc(p)
Point of control of the composite profile.
Namespace types: Profile
Parameters:
p (Profile) : Profile to read.
Returns: Centre price of the heaviest bucket, or na when the profile is empty.
method valueArea(p, pct)
Value area of the composite profile, grown outward from the point of control
by repeatedly taking the heavier neighbouring bucket until the requested share of
total volume is enclosed.
Namespace types: Profile
Parameters:
p (Profile) : Profile to read.
pct (float) : Share of total volume to enclose, expressed 0 to 1, for example 0.7.
Returns: A tuple of prices, both na when the profile is empty.
method reset(p)
Empties the profile while keeping its bucket size, ready for a new window.
Namespace types: Profile
Parameters:
p (Profile) : Profile to clear, modified in place.
Returns: Nothing. The profile is mutated.
RowStats
Aggregated statistics for every row of a single bar's footprint.
Fields:
n (series int) : Number of rows. Zero when the footprint holds no data.
total (series float) : Sum of row volume across the bar.
avg (series float) : Mean volume per row.
maxVol (series float) : Volume of the heaviest row, i.e. the POC row.
minVol (series float) : Volume of the lightest row.
pocVol (series float) : Same as maxVol, kept for readability at call sites.
pocTop (series float) : Upper price bound of the POC row.
pocBot (series float) : Lower price bound of the POC row.
pocMid (series float) : Midpoint of the POC row.
pocIdx (series int) : Index of the POC row inside the rows array, -1 when empty.
buy (series float) : Aggressive buy volume of the bar, derived as (total + delta) / 2.
sell (series float) : Aggressive sell volume of the bar, derived as (total - delta) / 2.
delta (series float) : Net delta of the bar summed across rows.
buyImb (series int) : Count of rows flagged as buy imbalances.
sellImb (series int) : Count of rows flagged as sell imbalances.
top (series float) : Highest price covered by any row.
bot (series float) : Lowest price covered by any row.
rowH (series float) : Height of one row in price units.
Span
A contiguous group of rows inside one bar, reported as a price span.
Fields:
top (series float) : Upper price bound of the span.
bot (series float) : Lower price bound of the span.
idxA (series int) : Index of the first row of the span.
idxB (series int) : Index of the last row of the span.
count (series int) : Number of rows in the span.
vol (series float) : Total volume inside the span.
delta (series float) : Net delta inside the span.
Slice
Volume measured over an arbitrary price interval, with partial rows counted pro rata.
Fields:
total (series float) : Volume inside the interval.
buy (series float) : Aggressive buy volume inside the interval.
sell (series float) : Aggressive sell volume inside the interval.
delta (series float) : Net delta inside the interval.
share (series float) : Interval volume divided by the bar's total volume, 0 to 1.
Profile
Composite volume profile accumulated from several bars' footprints.
Fields:
step (series float) : Price bucket size. Rows are folded into buckets of this height.
price (array) : Bucket centre prices, kept sorted ascending.
vol (array) : Volume per bucket, index-aligned with `price`.
dlt (array) : Delta per bucket, index-aligned with `price`.
Perpustakaan

Market Transition Pressure EngineMarket Transition Pressure Engine is a behavioral-state framework designed to evaluate whether current market behavior remains relatively stable or is developing internal pressure consistent with a potential state transition.
Rather than attempting to predict the direction of the next move, the framework measures changes occurring inside the current market environment and organizes that evidence into a confirmed lifecycle.
How It Works
The engine evaluates five normalized behavioral dimensions:
• Directional Efficiency Shift — measures how current directional efficiency differs from its behavioral baseline.
• Volatility Shift — evaluates changes in ATR-normalized volatility conditions.
• Structural Persistence Deterioration — measures whether recent directional persistence is weakening relative to its baseline.
• Directional Conflict — identifies disagreement between shorter-term directional behavior and the broader directional baseline.
• Range Shift — evaluates changes in local price-range behavior relative to its longer baseline.
These components are combined into a normalized Transition Pressure measure.
The pressure value represents the degree of behavioral instability detected by the framework. It is not a probability of reversal or continuation.
Pressure Lifecycle
The framework organizes transition pressure into five states:
STABLE — transition evidence remains comparatively limited.
BUILDING — internal behavioral changes are beginning to accumulate.
ELEVATED — multiple components are producing stronger transition-pressure evidence.
CRITICAL — transition pressure has reached a comparatively high state under the framework.
RELEASED — previously elevated pressure has subsequently contracted sufficiently to register a confirmed pressure release.
RELEASED is a temporary lifecycle state rather than a directional conclusion.
Confirmation and State Persistence
Lifecycle changes are evaluated using confirmed bars.
Both upgrades and downgrades require persistence before a replacement state is confirmed. This helps reduce one-bar state switching and distinguishes a developing candidate state from an established lifecycle state.
The information panel therefore separates:
STATE — current confirmed pressure state.
PRESSURE — confirmed normalized pressure measurement.
LIFECYCLE — whether the state is confirmed or a replacement is developing.
CANDIDATE — the developing replacement state when applicable.
TIMING — identifies the confirmed-bar basis of the displayed lifecycle information.
Adaptive Pressure Bands
The chart visualization uses an adaptive behavioral field around price.
Its width responds to ATR-normalized volatility and the engine's measured transition pressure. Lower-pressure environments generally produce a more subdued field, while increasing pressure changes the structure and visual emphasis of the bands.
Boundary proximity can also receive additional visual emphasis.
The bands are analytical context. They are not price targets, support/resistance guarantees, or projected future ranges.
Originality and Intended Use
Market Transition Pressure Engine is built around the interaction between behavioral baselines, normalized feature shifts, composite transition pressure, symmetric state confirmation, pressure-release detection and lifecycle persistence.
Its analytical focus is not conventional trend direction or entry generation.
The primary question is:
Is the current behavioral environment remaining stable, or is measurable internal pressure for a state change developing?
This distinction allows transition pressure to be studied separately from market direction.
Calculation Timing
Lifecycle decisions use confirmed-bar information.
The dashboard reports confirmed measurements so the displayed pressure value and confirmed lifecycle state are based on the same information set.
The adaptive visual field may continue developing during the current bar, while lifecycle confirmation intentionally waits for confirmed information.
This confirmation delay is part of the methodology.
Limitations
Transition-pressure states describe measured behavioral conditions; they do not represent reversal probabilities, continuation probabilities, expected returns, or guaranteed future outcomes.
A CRITICAL state does not necessarily mean that price will reverse.
A STABLE state does not imply that a significant move cannot occur.
Results depend on the selected market, timeframe, available history and settings. ATR normalization improves comparability across volatility environments but does not make different instruments behaviorally identical.
Historical state transitions do not imply that future transitions will develop in the same manner.
The indicator is intended as an analytical and research framework and should be interpreted alongside broader market context. Penunjuk

SpxSnipper - Intraday Candle vs Daily ATRIntraday Candle vs Daily ATR
This indicator is designed to identify significant intraday candles by comparing each intraday candle’s size against the Daily ATR.
It is useful for traders who want to quickly spot unusually large 5-minute, 15-minute, or 30-minute candles relative to the stock/index’s normal daily volatility.
How it works:
The indicator pulls Daily ATR data from the daily timeframe and applies it to the intraday chart. Each intraday candle is then measured as a percentage of the Daily ATR.
For example:
If the Daily ATR is 100 points and the selected threshold is 25%, the indicator will mark any intraday candle with a range or body greater than 25 points.
Main features:
- Uses Daily ATR on intraday charts
- Custom ATR length
- Custom percentage threshold
- Option to measure full candle range or real body
- Option to use previous completed Daily ATR or current developing Daily ATR
- Bullish and bearish candle signals
- Optional candle coloring
- Optional percentage labels
- Alert conditions included
Measurement modes:
- Full Candle Range: high minus low
- Real Body: absolute difference between close and open
Suggested use:
This tool can help identify important impulse candles, volatility expansion, breakout candles, rejection candles, and strong intraday moves.
It can be used on SPX, SPY, QQQ, individual stocks, futures, or other liquid instruments.
For 15-minute charts, a threshold around 20%–25% of Daily ATR can highlight only the more important candles. Lower values will generate more signals, while higher values will show only the strongest volatility candles.
This indicator is intended for discretionary trading analysis and should be used together with price action, trend, support/resistance, VWAP, volume, and proper risk management.
Not financial advice. Penunjuk

Amit## Strategy Overview
This strategy is a price-action-based intraday trading system designed to identify high-probability entries using **market structure, CHoCH (Change of Character), BOS (Break of Structure), liquidity sweeps, and multi-timeframe confirmation**.
The strategy focuses on letting the market establish its direction first rather than entering immediately on a breakout. Once structure confirms the move, the lower timeframe is used to identify a more precise entry.
### How It Works
The strategy primarily follows this sequence:
**1. Higher-Timeframe Structure**
* Identifies a Change of Character (CHoCH) to establish a potential directional bias.
* Looks for confirmation through a Break of Structure (BOS).
**2. Lower-Timeframe Confirmation**
* After higher-timeframe confirmation, the strategy moves to the lower timeframe.
* A corresponding CHoCH is identified in the same direction.
**3. Liquidity Sweep**
* The strategy waits for price to sweep the relevant structure/liquidity.
* The sweep helps avoid entering immediately into a false breakout.
**4. Entry**
* Once the required structure and liquidity conditions are satisfied, the strategy generates a long or short signal.
### Trading Philosophy
The core idea is:
**Structure → Confirmation → Liquidity Sweep → Entry**
Instead of chasing price after a breakout, the strategy waits for the market to confirm its intention and then looks for an entry after liquidity has been taken.
### Important Note
This is a systematic strategy designed for backtesting and research. Results can vary depending on market conditions, execution, slippage, commissions, and the instrument being traded.
Past backtest performance does not guarantee future results. Always test the strategy thoroughly before using it with real capital.
Strategi

Advanced kNN Dip Pattern [The Quant Science]Advanced kNN Dip Pattern is designed to identify significant price drops and evaluate their bounce probability using historical past patterns through our kNN Lorentzian Classification machine learning library.
To train the machine learning model, the script extracts and normalizes four fundamental geometric metrics of each candle using a fifty-period min-max scaling function.
🔹 The first feature is the candle body size , calculated as the absolute value between the close and the open.
🔹 The second feature is the total candle range , defined by the difference between the high price and the low price.
🔹 The third and fourth features measure the wicks instead, calculating respectively the space between the high and the highest point between the close and the open for the upper wick, and the distance between the lowest point between the close and the open and the low for the lower wick.
👉 About our kNN Lorentzian Classification Library:
🔷 What It Does
The script analyzes real-time candle structure and detects sudden downturns by comparing them against a dynamic historical database.
Detects the dip by monitoring the market for user-defined percentage drops relative to the recent high price.
Performs kNN classification by extracting four geometric candle features, namely body size, total range, upper wick, and lower wick, normalizing them, and comparing them with historical patterns through the algorithm.
Finally, applies a signal filter , generating an entry only when a significant drop occurs in conjunction with a positive prediction based on the most similar historical neighbors.
🔷 What It Is Used For
This indicator is a key tool for mean reversion and dip buying strategies.
Helps filter out false crashes by distinguishing healthy, high-probability bounce corrections from strongly bearish trends.
The automatically drawn boxes and lines also allow you to visually assess the extent of the movement and price reaction in historical tests.
Thanks to the percentage confidence, the trader also knows how closely the current pattern historically resembles winning setups.
🔷 Who Uses It
Quantitative and systematic traders who want to leverage statistical classification models without leaving the TradingView environment.
Swing traders looking for optimal entry points on volatile assets such as cryptocurrencies or growth stocks during market correction phases.
Algo-trading enthusiasts interested in understanding how to implement matrices, arrays, and external libraries in Pine Script v6.
🔷 How to Use It
Add the script to your chart , which requires importing the dedicated library.
Configure the main parameters in the settings panel by defining the analysis period in bars and the minimum percentage drawdown threshold required to trigger the analysis.
Monitor the chart , and when the signal turns on, the script colors the bar, draws a transparent box highlighting the magnitude of the drop from the peak to the low, and prints an HUD label with the statistical details.
🔷 User Interface Management
Configure the main parameters in the settings group by defining the Analysis Period expressed in bars, set to a default of 2, and the percentage Dip Threshold, set to a default of -5 percent.
Analysis Period indicates the number of bars the script considers to calculate the recent high price against which the drawdown is measured.
Dip Threshold represents the minimum percentage price drop threshold required for the system to recognize a movement as a valid dip and initiate the machine learning analysis.
Machine Learning Vs. Traditional Dip Patterns
Traditional patterns historically suffer from the severe flaw of triggering right in the middle of strong downward trends, catching what is jargon-wise called the falling knife and leading to massive losses. The integration of k Nearest Neighbors in this script brilliantly overcomes this limit by analyzing the geometric microstructure of the candle and comparing it with thousands of past events. The system does not merely observe how far the price has dropped, but evaluates whether that precise candle profile historically has a good probability of generating a bounce or if it instead anticipates a prolonged collapse, filtering out false signals and protecting capital.
Below you can find a quickly comparison analysis between a classic Dip and a kNN Dip.
To do that, we used our Dip & Rip Patterns indicator:
Penunjuk

DCA HelperDisciplines your DCA strategy by splitting your buy zone into N pre-calculated levels. Triggers buy signals only when price touches a level within the discount zone.
How it works:
The indicator automatically divides the discount zone (bottom 20% of a 50-bar range) into N equal parts. Each part is a potential DCA entry (L1, L2, ..., LN). Signals fire ONLY when price touches a specific level — never in "no man's land" between levels.
Entry filters (all must pass):
Price below both MA(50) AND MA(200) → double trend confirmation
RSI(14) below 35 → oversold filter
Price within bottom 20% of range (discount zone)
Price sustained in discount for 3 consecutive bars (anti-spike)
20-bar cooldown between signals
Within 0.5% of a level (no in-between triggers)
Chart visualization:
🟩 Light green box = discount zone (where levels operate)
🟦 Blue dashed box = full high/low range (context)
➕ White dotted line = 50% equilibrium level
🟧 Orange line = average DCA price
🔷 Green "DCA" diamond below bar = each executed level
🟢➖🟢 Horizontal green lines = the N levels, labeled L1 price (% vs current), L2 ..., etc.
Level color: more intense the deeper (better price)
Info table (top-right):
Now: current price
Avg: current average + # buys/N
Complete: average if ALL N levels fill (ideal position avg)
L1, L2, ..., LN: each level price + % vs current, colored by risk:
🟢 Green = close (entry ready)
🟠 Orange = medium
🔴 Red = far below (better discount but more waiting)
Configurable inputs:
DCA levels (1-10) — number of staggered buys
Trigger proximity to level (%) — max distance for level trigger
Filter MA length (fast/slow)
RSI buy level
Range lookback
Discount threshold
Sustained bars
Min bars between signals
How to use for real DCA:
1.
Check the "Complete" row in the table → that's your avg if you split position across N levels
2.
Decide total size (e.g., $10k) and divide into N parts
3.
Set alerts on "DCA" diamonds for each level
4.
Buy the corresponding part when each level triggers Penunjuk

Volume Footprints**Footprints (Volume Footprints) — Description**
Footprints breaks down each price bar to show where trading activity concentrated within it. Instead of a single volume number per bar, it splits a bar into horizontal price levels and reports how much volume traded at each level, along with an estimated buy/sell breakdown. Everything is presented in a compact, docked information box rather than drawn across the chart, keeping the price panel clean. The indicator's full name is "Volume Footprints," shown in the library and settings, while the chart legend displays the short name "Footprints."
**What it shows**
The indicator samples a finer timeframe inside each bar to reconstruct how volume was distributed across price. It then displays that distribution as a price ladder, with the highest price at the top. For each level it shows the volume attributed to buying, the volume attributed to selling, and the net difference between them (delta). A totals row at the bottom sums buying, selling, and net delta for the whole bar.
Two reference points are marked with colored dots in their own narrow columns: the Point of Control (P), which is the single price level where the most total volume traded, and the current price level (C), which shows where live price sits within the bar. A volume heatmap shades each row so that busier levels appear more saturated, making the most active prices easy to spot at a glance.
An optional candlestick column runs down the far-left side of the box, drawn to scale against the same price ladder so it mirrors the inspected bar's candle on the chart — a solid body between the open and close, thin wicks to the high and low, and colored green when the bar closed up or red when it closed down. Because it is drawn from table cells, its smoothness depends on how many rows the ladder has; a coarse ladder produces a blockier candle.
The information box also carries a title row showing the indicator name, which bar is being examined, the timeframe settings in use, and a live countdown to the close of the forming bar.
**Buy/sell estimation**
The buy and sell figures are estimated from price direction within the sampled sub-bars rather than from actual bid/ask transaction data. Rising sub-bars are counted as buying and falling sub-bars as selling. As a result, the buy, sell, and delta values are an approximation of activity, not a measurement of true order flow.
**Timeframe guidance and warnings**
For the indicator to work, the chart timeframe must sit between the two timeframe settings: the cell granularity must be below the chart timeframe, and the footprint bar timeframe must be at or above it. If the chart is on a higher timeframe than the footprint setting, the box displays a warning in place of the ladder. If the cell granularity is not below the chart timeframe, the box reports that as well. The footprint timeframe may also be left as "Chart" to match the chart's own timeframe, in which case no timeframe warning is shown.
**User Inputs**
- **Footprint bar timeframe** — Sets which bar the box analyzes, such as one hour. This should be at or above the chart's timeframe. Volume from finer sub-bars is accumulated across chart bars until this bar completes, then organized into price levels.
- **Cell granularity** — Sets the finer timeframe used to build the price levels inside each bar. This must be below the chart's timeframe; otherwise no data is returned and the box reports this.
- **Stable cells (closed sub-bars only)** — Affects the forming bar only. When on, buy/sell figures count only sub-bars that have fully closed, so numbers accumulate steadily instead of shifting between buy and sell as price moves; this introduces a slight lag at the live level. When off, the still-forming sub-bar is included for maximum responsiveness, at the cost of the current level's figures fluctuating.
- **Row bucketing mode** — Chooses how price levels are formed. Fixed price step builds a continuous ladder on a fixed price grid, giving every level from the bar's low to high a permanent row that does not shift as the bar develops. Range slices instead divides the bar's high-to-low range into a set number of equal parts, which rescales as the bar's range grows.
- **Price step (ticks)** — Used in Fixed price step mode. Sets the height of each row in ticks. Smaller values create more, finer rows; larger values create fewer, coarser rows. If a bar spans more levels than the display can hold, the highest levels are truncated, which is resolved by raising this value.
- **Price rows (Range slices mode)** — Used in Range slices mode. Sets the number of equal divisions of the bar's range. It has no effect in Fixed price step mode, which sizes the ladder automatically.
- **Footprint bar to inspect** — Selects which bar the box displays, counting back from the newest. Zero is the bar currently forming, one is the last completed bar, and so on.
- **Info box position** — Anchors the information box to a chosen area of the chart, such as a corner or middle edge, so it can be moved clear of price.
- **Info box text size** — Sets the font size inside the box, from tiny to large.
- **Show candlestick column** — Toggles the far-left candlestick column. When off, the column is removed entirely and the box narrows.
- **Show chart marker** — Toggles an on-chart arrow that points to the most recent candle of the bar being analyzed.
- **Marker color** — Sets the color of that on-chart arrow.
- **Buy color** — Sets the color used for net-buying delta figures.
- **Sell color** — Sets the color used for net-selling delta figures.
- **Candle up color** — Sets the candlestick column's color when the bar closed at or above its open. Defaults to a standard chart green.
- **Candle down color** — Sets the candlestick column's color when the bar closed below its open. Defaults to a standard chart red.
- **Heat (volume) tint** — Sets the hue of the volume heatmap that shades each row by activity, with the busiest level appearing brightest.
- **Info box background** — Sets the solid background color of the box, over which the heatmap tint blends.
- **Text** — Sets the color of the text inside the box.
- **Title text color** — Sets the color of the title-row text.
- **Title background** — Sets the background color of the title row.
- **POC dot color** — Sets the color of the dot marking the Point of Control.
- **Current price dot color** — Sets the color of the dot marking the row where live price currently sits. Penunjuk

Winchester 10X1T Cipher - Zone-Gated WaveTrend DotsWHAT THIS IS
A single-pane momentum panel that marks the exact bar on which a WaveTrend cycle turns while price sits in an extreme zone. It is a confluence display: WaveTrend for the cycle turn, an RSI+MFI pressure band for money-flow context, RSI for the trend regime, and a Stochastic RSI pair for the short-term swing. All four sit in one pane, so a trader does not have to read four windows to answer one question: is this turn happening in a place where a turn matters?
HOW IT IS CALCULATED
WaveTrend follows the classic construction published by LazyBear: an EMA of the source (HLC3, channel length 9), an EMA of the absolute distance to it, a channel index scaled by 0.015, then an EMA of that index (length 12) as the fast line and a 3-period SMA of the fast line as the signal line. The area between both lines is filled so the cycle body is visible at a glance.
The pressure band uses the RSI+MFI area concept popularised by VuManChu's Cipher B: the average of (close-open)/(high-low) over 60 bars, scaled and drawn as a band at the bottom of the pane - white above zero, gold below.
RSI (14) is plotted in three states: white at or below 30, gold at or above 60, purple in between.
Stochastic RSI (14/14, K and D smoothed by 3) is plotted on a log-transformed source.
THE DOTS
A dot is printed only when the WaveTrend fast line crosses its signal line AND the signal line is already inside an extreme zone. Two sizes are used on each side, so the quality of the location is visible without reading numbers:
- Small dot: the cross happens between the first and the second zone (53 to 60 above, -53 to -60 below).
- Large dot: the cross happens beyond the second zone (60 and above, -60 and below).
Top dots are sky blue; bottom dots are white with a gold core. Each of the four dot types has its own alert condition.
WHY THE COMBINATION
WaveTrend on its own crosses constantly in the middle of the range, which is where most of its false signals live. Gating the cross on the zone removes those. The RSI colour states and the pressure band then answer the second question - whether the turn is a counter-trend stab or a continuation in the direction of the dominant flow. RSI at 60+ (gold) with a top dot is a different situation from RSI at 30 (white) with a bottom dot, and the panel shows both facts on the same bar without adding a second indicator.
HOW TO USE IT
Add it to any symbol and any timeframe. Nothing repaints once a bar has closed, so wait for the bar to close before acting on a dot. Treat the large dots as the primary event and the small dots as early warnings. All lengths, zone levels and visibility switches are inputs, so the zones can be tightened or widened per market. The four alert conditions can be wired to TradingView alerts.
CREDITS
The WaveTrend oscillator is the open-source work of LazyBear; the RSI+MFI area concept comes from VuManChu's open-source Cipher B. This script re-implements both in Pine v6 and adds the zone-gated two-size dot logic, the RSI regime colouring, the combined pane layout and the alert set. It is published open source so that anyone can read exactly what it does. Penunjuk

Balanced Price Range (M1D)Balanced Price Range
Marks one thing and refuses to mark anything else: the band of untraded price left where two opposing fair value gaps overlap, when price displaced straight back through the first gap without ever testing it. If the gap was tested first, no zone is drawn — that is an inversion, and it is a different event.
Most tools that draw a balanced price range take any bullish gap and any bearish gap, intersect them, and paint the overlap. That also fires on inversions, because an inverted gap and a fresh opposing gap produce the same geometry. This one starts from what happened at the first gap and works forward, so the two are never confused.
What separates a BPR from an inversion
A fair value gap is read over three candles and has to clear a minimum size in ticks to be watched at all. Once it is being watched, the first candle to reach its consequent encroachment decides everything, and there are only three outcomes.
The candle reaches the midpoint and closes on the respecting side of it, or closes inside the gap: the gap has been tested. It held, or price accepted inside it, and either way something happened there. It is dropped from this tool for good and can never produce a zone.
The candle reaches the midpoint and, on that same candle, closes its body clean past the far edge: no test. Nothing ever held inside it. The gap was transited in one move, and it stays in play.
The candle trades into the gap but never reaches the midpoint, then closes back outside: a probe. Nothing was proven at the midpoint, so the gap stays in play — but the wick counts, and the section on the drawn zone explains what it does.
That first distinction is the whole indicator. A tested gap that later fails is an inversion; an untested gap that is displaced straight through is what this draws.
The pivot is the window
Two opposing gaps that merely overlap are not a balanced price range. The formation is a tight swing — an inverted V or U for a bearish zone, a V or U for a bullish one — and the displacement back begins as the swing completes.
So a pivot has to sit between the gap forming and the gap being broken, and the break has to follow that pivot closely. Both are settings: the pivot length, where three candles give the sharp V and five the rounded U, and the number of bars the close-through may lag the pivot. A gap that drifts sideways for a dozen bars before finally reversing has a pivot in it somewhere too, and it is not this formation.
There is no separate shape filter, and that is deliberate rather than an omission. A fair value gap is by definition a leg that moved faster than two-sided trade could occur, so two opposing gaps with a pivot between them and no test in between already describe the V. Adding a shape test on top of that would reject valid formations without catching anything the existing conditions miss.
The same fact explains the tool's behaviour: these are uncommon on high timeframes and get more frequent as you drop down, because the speed requirement is harder to satisfy the more time a candle covers.
The zone is the untraded air, not the intersection
The overlap of the two gaps is only the candidate band. What gets drawn is the part of it with no wick lying in it.
If a wick from the bars between the two gaps reaches into the candidate band, that part has been traded and is removed, and the wick's own extreme becomes the edge of the zone. A wick taking a third of the band leaves two thirds drawn. A wick clean through it leaves nothing, and no zone appears.
Only the bars strictly between the first gap completing and the candle that broke it can trim. The breaking candle transits the whole band by definition and the second gap's own candles are the displacement, so counting either would erase every zone.
The box still starts at the candle that formed the first gap, so it stays attached to its origin rather than floating in mid-chart at the wick that trimmed it, and it runs to the live candle the way a breaker or an inversion does. A minimum size in ticks applies after the trim, so a band cut down to almost nothing does not paint.
Polarity follows the newer gap. The most recent displacement is the one describing how the market is currently delivering, so a bullish gap broken downward produces a bearish zone, and the reverse for a bullish one.
Midpoint and labels
Each zone can carry its consequent encroachment — the midpoint of the drawn band, taken after the trim rather than from the raw overlap. A range has an equilibrium; a price delivery array has a consequent encroachment, and they are not the same object.
Names sit beside the box on its centre line, just past the right edge, so a name stays readable when its zone is only a few pixels tall and never crosses the midpoint line.
The two parent gaps can be shown faintly behind the zone. It is off by default: the trimmed band is the point of the tool, and drawing both parents puts back the clutter it exists to remove.
Invalidation
A zone is spent when a candle body closes clean beyond its far edge against its direction. On the default setting it is removed, the same rule this stack applies to any spent inventory. It can instead be faded and kept, which holds the record of where delivery already happened.
Live zones are capped per side, oldest removed first, so a long session cannot fill the chart.
The console
A small table, verdict first: whether there is support, resistance, both or nothing live. Under it, the count on each side, and a respected count.
Respected means price returned into the zone and has not closed through it. It is counted only across what is currently drawn, so the number always describes the boxes in front of you rather than a hidden history, and an invalidated zone leaves the count together with its box. A watching row shows how many untested gaps are still able to become a zone.
Every row carries its rule in the cell tooltip.
Alerts
Four. Bullish zone formed, bearish zone formed, and first touch on each side. The formation alerts fire on the close that completes the second gap; the touch alerts fire the first time price returns into a drawn zone.
Method and repainting
Everything is read from the chart timeframe. There are no higher-timeframe requests anywhere in the script, so there is no lookahead to configure wrongly and no future data to leak.
Every detection is gated to a confirmed bar close. The test call, the break, the second gap and the invalidation are all judged on closed candles, so nothing appears mid-bar and then withdraws.
One characteristic is inherent to pivots and worth stating plainly rather than leaving to be discovered: a swing is only confirmed once the bars to its right have printed. On the three-candle setting that is one bar, on five it is two. A zone therefore confirms a bar or two after the move that created it. That is lag, not repainting — nothing moves once drawn.
Zones and midpoint lines extend rightward to the current bar while they are live. That is the box tracking the present, not its history changing.
What it will not do
It places no entries, exits, stops or targets, and it does not size a position. It draws no bias, no trend and no projection.
It does not read structure beyond the pivots it uses, and it does not label market phases. Whether a drawn zone is worth trading is a judgement about context this script does not have — the session, the higher-timeframe draw, and what the day has already done.
A gap that gets tested draws nothing. Two opposing gaps overlapping without a pivot between them draw nothing. A candidate band that a wick has already run through draws nothing. Only the finished sequence produces a zone, so an empty chart through a slow session is the tool working rather than failing.
Settings
Pivot length; minimum parent gap in ticks; minimum zone size after the wick trim; maximum bars from the pivot to the close-through; maximum bars from the break to the opposing gap; the per-side cap on live zones; behaviour on invalidation, remove or fade and keep; the consequent encroachment midline; the parent gaps behind the zone; how far right the drawings extend past the live candle; the console; and label text size.
Disclaimer
This is a decision-support tool for discretionary ICT trading. It is not financial advice, and no market's past behaviour is indicative of future results. Penunjuk

Stock Breakout Momentum StrategyDescription
A breakout entry alone isn't a system, it's the first third of one. What happens after the breakout fires is what usually decides whether the equity curve goes up or down: does every close beyond a lookback high get traded, or only the ones with real trend and participation behind them? Does a winning trade get room to develop, or does it get cut off by an exit window built for a losing trade? This strategy answers both questions directly: breakout entries are screened by a trend filter and a volume filter before they're taken, and once in a trade, a fixed ATR profit target works alongside a trailing stop and a materially longer time-based exit — instead of the time exit doing double duty as the only thing standing between a trade and an open-ended hold.
The Breakout Trigger, Now Screened by Trend and Volume
The core signal is unchanged from a classic breakout: a long triggers when a bar closes above the highest high of a lookback window (20 bars by default); a short triggers on a close below the lowest low. The signal only evaluates on barstate.isconfirmed, so it reacts to a bar's final, settled value rather than an intrabar tick, a non-repainting design where the order is submitted on the confirmed signal bar and fills at the next bar's open. What's new is what has to be true alongside that close: an optional trend filter requires price to be above a 50-period SMA for longs (below it for shorts), and an optional volume filter requires the breakout bar's volume to exceed 1.2× its 20-period average. Both are on by default and both can be switched off independently: turning them off reproduces the original unfiltered breakout-only version, which is a useful baseline to compare against.
Why Two Confirmation Filters Instead of One
A breakout on a stock trading below its own trend line, or on below-average volume, is a weaker signal than a breakout with the reverse conditions, a common cause of a low win rate is a system taking every technically-valid breakout regardless of context. The trend filter keeps the strategy from fighting its own directional bias; the volume filter is a basic conviction check against thin, low-participation moves that are more likely to be noise than the start of a real trend.
A Trailing Stop That Only Moves in Your Favor
Once in a position, the stop is recalculated every bar as entry ATR × a multiplier (2.0 by default) behind price, but it only ever ratchets in the trade's favor, a long's stop can rise as price rises but can't be pulled back down on a pullback, and a short's stop mirrors that in reverse.
An Explicit Profit Target, Not Just a Trailing Stop
Earlier versions of this approach relied on the trailing stop as the only way to close a trade in profit, which meant a short exit window could cut a winning trade off before the stop had room to ratchet up. This version adds a fixed ATR profit target (3.0× ATR by default, set once at entry and left in place; it doesn't trail the way the stop does) placed alongside the stop as a bracket order. Paired with the default 2.0× ATR stop, that's a built-in 1.5:1 reward-to-risk skew: the strategy doesn't need a high win rate to be net positive, it needs winners to average meaningfully more than losers, which is what the target is there to enforce. This can be turned off entirely if you'd rather rely on the trailing stop alone.
A Longer Time-Based Exit
Trades that haven't been stopped out or hit target within a set number of bars are closed as a housekeeping measure, a fixed exit window is there to purge trades that have stopped developing rather than to signal a directional call. That window is now 20 bars by default rather than a handful, giving the trailing stop and profit target actual room to do their jobs before the clock forces a decision. Whichever of the three exit conditions: stop, target, or time is met first is what closes the trade.
Position Sizing Tied to Equity, Not a Fixed Share Count
Instead of trading a static number of shares, the strategy calculates how many shares fit within a configurable percentage of current account equity (100% by default) divided by the current share price, floored to a whole share count with a floor of one. Sizing compounds with account equity rather than staying fixed at the starting balance. A dedicated "Allow Short Entries" toggle exists because not every account can short every stock; turn it off to backtest and trade long-only.
A Note on Shorting and Margin
Short positions on equities require margin, and margin requirements for shorting are not the same as the cash-equivalent share count this script computes for sizing; real brokers generally require posting more buying power to hold a short than to hold an equivalent long. Sizing at 100% of equity while shorting is enabled can produce trades a real margin account would reject or forcibly liquidate before the strategy's own exit logic gets to close them on its own terms. If you intend to trade this live with shorting on, size conservatively (well under 100%) and confirm your broker's actual margin requirements rather than relying on this script's sizing as a margin calculation.
Backtest Realism Settings
The strategy ships with commission modeled at 0.05% and 2 ticks of slippage baked into every fill, pyramiding disabled, and no same-bar order fills: defaults chosen so Strategy Tester numbers reflect something closer to live execution rather than an idealized fill.
Timeframes and Instruments
Built for equities, and tested across multiple timeframes and symbols with meaningfully different results depending on the instrument's underlying trend regime during the test window — a stock that trended cleanly produced a very different outcome than one that chopped sideways over the same period, even with identical settings. Because the exit logic is bar-count based, results will also vary by timeframe: retest breakoutLength, trendLength, atrMultiplier, profitTargetATRMult, and barsInTrade together whenever you change timeframe rather than assuming the defaults transfer.
What to Examine in Backtesting
Because of the built-in 1.5:1 reward-to-risk skew, a win rate meaningfully below 50% can still be net profitable: check the Strategy Tester's average win versus average loss alongside the raw win rate rather than judging on hit rate alone.
Watch trade count relative to your test window: a strategy that only fires a handful of times over several months (which the trend and volume filters will produce, by design) needs a longer test period or a broader set of symbols before a positive or negative result says much about a real edge versus a lucky or unlucky stretch. Also check the Margin Usage tab specifically if shorting is enabled, and compare max drawdown against total return, a strategy that gives back most of an open gain before ending marginally positive is a different risk profile than one that climbs more steadily, even if the final number looks the same.
Shared for educational purposes. This is not investment advice. Backtest results, including any shown in this listing's chart or comments, reflect a specific historical period and instrument and are not a representation of future performance. Trading involves substantial risk of loss and is not suitable for all investors. Strategi

Market Structure Flow Map [BOSWaves]Market Structure Flow Map - Strength-Scored Curved Ribbon Visualization of Break of Structure and Change of Character Events
Overview
Market Structure Flow Map is a market structure event visualization system that renders each Break of Structure and Change of Character as a curved three-layer ribbon connecting the broken swing pivot to the bar where the break occurred, where ribbon thickness, glow intensity, and arc curvature are driven by a composite strength score derived from the displacement beyond the broken level and the relative volume at the break bar rather than applying uniform visual treatment regardless of the conviction behind each structural event.
Instead of marking BOS and CHoCH events with simple horizontal lines or static labels, this system renders each structural break as a curved polyline ribbon that physically connects the origin swing point to the breakout bar, with the ribbon's visual weight scaling continuously from the configured minimum to maximum width based on how far price moved beyond the broken level and how significantly above average volume was at the moment of the break. Wider, brighter ribbons represent high-conviction structural breaks with strong displacement and volume evidence. Thinner, more subtle ribbons represent marginal breaks that barely cleared the structural level with below-average participation.
This creates a market structure visualization where the visual record of structural history is encoded with conviction information rather than presenting all breaks as visually equivalent events. The curved arc geometry provides an immediate spatial reading of the distance between the origin swing and the break bar, with longer arcs indicating structural breaks that developed over more bars. The three-layer glow, body, and core rendering gives each ribbon depth and visual prominence scaled to its structural significance. And the circular node markers at each broken swing pivot anchor the ribbon origins to the precise structural prices that were violated.
Price structure is therefore presented not just as a sequence of labeled events but as a visually weighted conviction map where the strongest structural breaks are immediately identifiable by their visual dominance over weaker ones.
Conceptual Framework
Market Structure Flow Map is founded on the principle that not all structural breaks carry equal significance, and that a visualization system which presents every BOS and CHoCH with identical visual weight fails to communicate the most important information available at the moment of each break: how convincingly price moved through the structural level and whether that move was supported by meaningful participation.
Traditional market structure tools mark every qualifying break with the same line, label, or zone regardless of whether the break was a decisive high-volume displacement or a marginal low-volume close that barely cleared the level. This framework replaces uniform visual treatment with strength-scaled ribbon geometry where every visual property of the ribbon reflects the composite conviction of the underlying structural event, creating a chart where the structural history reads as a visual conviction hierarchy rather than a flat sequence of identical events.
Three core principles guide the design:
Each structural break should be rendered as a physical curved connection between its origin swing and its break bar, preserving the spatial and temporal relationship between the structural level that was violated and the moment of violation rather than abstracting the event to a horizontal line.
Ribbon visual weight should scale continuously with a composite strength score that combines displacement magnitude and volume significance, ensuring that the chart's visual hierarchy reflects the structural conviction hierarchy rather than being independent of it.
BOS and CHoCH events should be visually distinguished not only through color but through the arc geometry, with the ribbon curvature and length encoding the temporal distance between the swing origin and the break completion.
This shifts market structure visualization from event marking into conviction-weighted structural flow mapping where the cumulative visual record encodes the relative significance of every structural event in the chart history.
Theoretical Foundation
The indicator combines pivot high and low detection for swing origin identification, configurable close or wick break confirmation for structural break detection, displacement-based and volume-ratio-based strength scoring with configurable weighting, structural state tracking for BOS versus CHoCH classification, three-layer curved polyline ribbon construction with strength-scaled width and distance-adaptive arc height, and circular node markers at broken swing pivot prices.
Displacement strength is calculated as the distance from the broken level to the break bar's source price, normalized against an ATR multiple and capped at the configured maximum. Volume strength is calculated as the excess of the break bar's volume above average relative to the configured maximum ratio, with below-average volume bars receiving zero volume strength. These two components are combined using the configured dispWeight and volWeight parameters, normalized by their sum so the total always produces a 0-1 strength score regardless of the weight distribution chosen. The arc height scales with both ATR and the temporal distance between the swing origin and break bar, so ribbons connecting distant origin-break pairs curve more dramatically than ribbons connecting adjacent ones.
Four internal systems operate in tandem:
Swing Detection and State Engine : Identifies confirmed pivot highs and lows using the configurable lookback, tracks the most recent unbroken high and low with their bar indices and prices, classifies each qualifying break as BOS or CHoCH based on the current structural state, and updates the structural state on each confirmed break.
Strength Scoring System : Calculates displacement from the broken level normalized against ATR, calculates volume ratio normalized against the configured maximum, combines both components with configurable weights, and maps the result to a 0-1 composite strength score that drives all ribbon visual properties.
Curved Ribbon Rendering Engine : Constructs three-point curved polyline paths from origin to arc midpoint to break bar for each of the three ribbon layers, applying strength-derived width to the body layer, additive width to the glow layer, and subtractive width to the core layer, with arc height scaling by both ATR and temporal distance.
Label and Node System : Places circular node markers at each broken pivot price to anchor ribbon origins visually, places directional event labels at each break bar offset by a small ATR fraction, and enforces maximum event count limits across all object arrays independently.
This design ensures every structural event produces a visually complete conviction-weighted representation while the object management system maintains a clean configurable historical event window.
How It Works
Market Structure Flow Map evaluates price through a sequence of structure-aware and strength-scored processes:
Pivot Detection : Confirmed swing highs and lows are identified using the configured left-right bar symmetry requirement, updating the tracked last high and last low prices and bar indices on each new confirmation.
Break Source Selection : Depending on the break mode setting, either the close price or the bar's high and low extremes are used as the source for testing structural breaks, allowing either confirmed closing breaks or intrabar wick-based breaks to qualify.
Break Detection : On each bar, the bullish break source is tested against the last unbroken high and the bearish break source is tested against the last unbroken low. A qualifying break requires the current bar to have crossed the level while the previous bar had not, and the level must not have been broken previously since its last registration.
Structural State Classification : Bullish breaks during a bearish structural state classify as bullish CHoCH. Bullish breaks during a neutral or bullish state classify as bullish BOS. The same logic applies in reverse for bearish breaks, with structural state updating to the new direction on each confirmed event.
Displacement Strength Calculation : The absolute distance between the break source price and the broken level price is divided by the product of ATR and the configured maximum displacement multiplier, clamped to a 0-1 range.
Volume Strength Calculation : The excess volume above average is normalized by the configured maximum ratio minus one, clamped to a 0-1 range. Bars with below-average volume receive a volume strength of zero.
Composite Strength Derivation : Displacement and volume strengths are combined using the configured weights normalized by their sum, producing a 0-1 composite score that drives all ribbon visual properties.
Ribbon Geometry Construction : Three chart points are derived at the origin swing bar, the temporal midpoint between origin and break, and the break bar. The midpoint arc height is calculated from ATR, the arc ATR multiplier, a distance factor derived from the bar span, and the composite strength. For bullish breaks the arc curves above both endpoints; for bearish breaks below.
Three-Layer Ribbon Drawing : The glow layer renders at the body width plus five with high transparency. The body layer renders at the strength-scaled width with low transparency. The core layer renders at the body width minus two with a near-white color at low transparency, providing depth and brightness.
Node and Label Placement : A circular node is placed at the origin swing price and bar. A directional event label is placed at the break bar offset by a small ATR fraction above for bullish breaks and below for bearish breaks.
Object Count Management : All five object arrays are independently trimmed to the maximum event count by removing the oldest entries, maintaining a clean rolling window of the most recent structural history.
Together, these elements form a continuously updating market structure visualization where every structural event is rendered as a spatially accurate, conviction-weighted curved ribbon that communicates both the structural significance and participation quality of each break.
Interpretation
Market Structure Flow Map should be interpreted as a conviction-weighted structural event history where ribbon visual weight communicates break significance:
Bullish BOS Ribbon (Cyan) : Curved ribbon arcing upward from a broken swing high to the break bar, indicating a continuation structural break in the direction of the prevailing bullish structural state. Ribbon width reflects break strength.
Bearish BOS Ribbon (Red) : Curved ribbon arcing downward from a broken swing low to the break bar, indicating a continuation structural break in the direction of the prevailing bearish structural state. Ribbon width reflects break strength.
Bullish CHoCH Ribbon (Green) : Curved ribbon arcing upward from a broken swing high during a bearish structural state, indicating a potential trend reversal where price has broken bullish structure against the prior downtrend.
Bearish CHoCH Ribbon (Amber) : Curved ribbon arcing downward from a broken swing low during a bullish structural state, indicating a potential trend reversal where price has broken bearish structure against the prior uptrend.
Ribbon Thickness : The primary strength indicator. Thick ribbons represent high composite strength with strong displacement and above-average volume. Thin ribbons represent weak breaks that barely cleared the structural level with low participation.
Ribbon Arc Height : Reflects both ATR-relative volatility and the temporal distance between the swing origin and break bar. Tall arcs indicate breaks that developed over many bars or occurred during high-volatility conditions. Flat arcs indicate quick breaks between adjacent swings.
Glow Layer : The wide transparent outer layer provides visual prominence that scales with ribbon width, making the strongest ribbons immediately identifiable across the full chart view.
Core Layer : The bright near-white inner layer provides a luminous center line that reinforces the direction and curvature of each ribbon while adding visual depth to the three-layer geometry.
Structure Nodes (Circles) : Circular markers at each ribbon origin anchor the structural event to its precise swing price, making it clear which pivot level was broken to produce each ribbon.
Event Labels : BOS and CHoCH text labels at each break bar identify the event type with color coding matching the ribbon, providing a text-based reference that complements the visual ribbon hierarchy.
Colored Candles : Optional bar coloring reflects the current structural state, coloring cyan during bullish structure and red during bearish structure regardless of individual bar direction.
Ribbon width hierarchy, arc geometry, color coding, and node placement collectively communicate more structural conviction information than text labels alone.
Signal Logic & Visual Cues
Market Structure Flow Map presents four distinct event types across two structural break categories:
Bullish BOS : Cyan ribbon connecting a broken swing high to the break bar during an established bullish structural state, confirming continuation of the prevailing upward structural sequence.
Bearish BOS : Red ribbon connecting a broken swing low to the break bar during an established bearish structural state, confirming continuation of the prevailing downward structural sequence.
Bullish CHoCH : Green ribbon connecting a broken swing high to the break bar during a bearish structural state, signaling a potential reversal of the prevailing downward structural sequence.
Bearish CHoCH : Amber ribbon connecting a broken swing low to the break bar during a bullish structural state, signaling a potential reversal of the prevailing upward structural sequence.
Both BOS and CHoCH events can be independently toggled, allowing the chart to focus exclusively on continuation signals, exclusively on reversal signals, or both simultaneously.
Alert generation covers bullish and bearish structural breaks for systematic structural monitoring workflows.
Strategy Integration
Market Structure Flow Map fits within momentum-validated market structure and conviction-weighted structural analysis approaches:
Ribbon Width Prioritization : Assign greater analytical weight to thick, wide ribbons representing high-strength breaks. Thin ribbons from marginal low-volume breaks carry reduced structural significance and warrant more caution before acting on the direction signal.
CHoCH Reversal Framework : Use green and amber CHoCH ribbons as primary reversal identification signals, treating their appearance as the first confirmation that structural direction may be shifting. Subsequent BOS ribbons in the new direction following a CHoCH provide continuation confirmation.
BOS Continuation Framework : Use cyan and red BOS ribbons as trend continuation evidence within established structural regimes, with wider BOS ribbons providing stronger confirmation of sustained directional momentum.
Arc Length Context : Monitor ribbon arc lengths as a temporal context indicator. Short low arcs between adjacent swings indicate rapid structural progression. Tall arcs spanning many bars indicate structural breaks that required extended time to develop, which may reflect different momentum characteristics than immediate breaks.
Ribbon Density Assessment : The density and direction consistency of recent ribbons provides a visual structural momentum reading. A sequence of uniformly wide same-direction ribbons indicates sustained structural conviction. A mix of widths and directions indicates contested structure without clear dominance.
Multi-Timeframe Structure Hierarchy : Apply higher-timeframe structural state as directional bias context, using lower-timeframe BOS ribbons to time continuation entries within the structural direction established on the higher timeframe.
Technical Implementation Details
Structure Detection : Pivot high and low confirmation with configurable lookback and close or wick break mode selection
Strength Scoring : ATR-normalized displacement combined with SMA-normalized volume excess using configurable weights summing to a 0-1 composite score
Ribbon Geometry : Three-point curved polyline construction with distance-adaptive arc height scaling and strength-proportional line width across three layers
Classification Logic : Structural state tracking for BOS versus CHoCH identification with independent visibility toggles per event type
Object Management : Five independent arrays with configurable maximum event count enforced by oldest-first removal
Candle Coloring : Structural state-driven bar color applied to body, wick, and border independently
Performance Profile : Real-time execution on each confirmed bar with polyline and label objects created at event time and managed through independent array trimming
Optimal Application Parameters
Timeframe Guidance:
1 - 5 min : Intraday structural flow mapping for scalping with shorter swing length for faster structural event detection on smaller swings
15 - 60 min : Session-level structural analysis with balanced swing length and moderate displacement and volume thresholds for meaningful event density across typical session structure
4H - Daily : Swing-level market structure visualization with longer swing detection for broader structural events that reflect significant trend-level breaks
Suggested Baseline Configuration:
Swing Length : 8
Break Confirmation : Close
Volume Average : 20
Displacement Weight : 0.6
Volume Weight : 0.4
Ribbon Arc (ATR×) : 0.7
Maximum Events : 35
Show BOS : Enabled
Show CHoCH : Enabled
Show Structure Nodes : Enabled
Color Candles : Disabled
These suggested parameters should be used as a baseline; their effectiveness depends on the instrument's swing frequency, typical displacement characteristics, and preferred structural event density, so fine-tuning is expected for optimal performance.
Parameter Calibration Notes
Use the following adjustments to refine behavior without altering the core logic:
Too many structural events firing : Increase Swing Length to demand more structurally significant pivot confirmation, reducing the frequency of detected breaks, or switch Break Confirmation to Close to filter out wick-based marginal breaks.
Structural events too infrequent : Decrease Swing Length toward 2 for more sensitive pivot detection, or switch to Wick mode to capture structural breaks that close below the level but print a wick through it.
All ribbons appearing similar width : Adjust Max Displacement ATR and Max Volume Ratio to calibrate the scoring thresholds to the instrument's typical break characteristics. If most breaks exceed the maximum thresholds the scoring range collapses and all ribbons appear near maximum width.
Volume scoring not contributing : Decrease Max Volume Ratio to make above-average volume easier to achieve on the scoring scale, or increase Volume Weight to give volume a larger proportion of the composite score.
Ribbons too flat or too curved : Adjust Ribbon Arc ATR to scale the arc height. Lower values produce flatter, more linear ribbons. Higher values produce more pronounced curves, particularly on breaks that span many bars.
Too many ribbons cluttering the chart : Reduce Maximum Events to limit the historical ribbon count, or reduce Swing Length to produce more frequent events that each span shorter temporal distances, resulting in smaller arcs and less visual overlap.
Adjustments should be incremental and evaluated across multiple session types rather than isolated market conditions.
Performance Characteristics
High Effectiveness:
Trending markets with clear directional structural sequences where BOS ribbons accumulate in the trend direction and CHoCH ribbons mark definitive reversal points with distinct visual separation from the preceding BOS sequence
Instruments with consistent volume participation where the volume scoring component produces meaningful differentiation between high-conviction and low-conviction breaks rather than uniform low scores
Market structure-based trading approaches where the visual conviction hierarchy of ribbon widths provides immediate differentiation between structural breaks worth acting on and marginal breaks warranting caution
Multi-timeframe structural analysis where the ribbon history provides a visual structural narrative that communicates trend progression, reversal identification, and conviction levels simultaneously
Reduced Effectiveness:
Choppy, range-bound markets where frequent alternating BOS and CHoCH events in both directions produce a dense mixed-color ribbon cluster without a clear structural narrative
Low-liquidity instruments where volume is consistently below average, suppressing volume strength scores and causing most ribbons to render at or near minimum width regardless of structural significance
Markets with very large or small typical ATR ranges where the arc height calculations produce ribbons that are either too flat to read or that arc so dramatically they dominate the visible chart area
Extremely fast-moving markets where structural breaks occur on single large bars that span large price distances, producing short temporal ribbons that offer limited visual differentiation from one another
Consolidation environments where price oscillates between two nearby swing levels without establishing clear directional structural progression, generating frequent opposing CHoCH events without the sustained BOS sequences that define clear structural trends
Integration Guidelines
Confluence : Combine with BOSWaves volume flow tools, order flow analysis, or momentum indicators to validate high-strength CHoCH and BOS ribbons with broader analytical context before committing to structural direction trades
Width Hierarchy Respect : Build a ribbon width filter into your analysis workflow. Thin ribbons from marginal breaks should be treated as weak structural evidence requiring additional confirmation. Thick ribbons from high-displacement high-volume breaks warrant greater directional confidence.
CHoCH Sequencing : A single CHoCH ribbon is not sufficient confirmation of a structural reversal in isolation. Wait for a subsequent BOS ribbon in the new direction to confirm that structural momentum has genuinely shifted before treating the CHoCH as a completed reversal.
Arc Geometry Reading : Use ribbon arc height as a secondary strength indicator. Tall arcs on strong ribbons indicate breaks that developed over many bars with sustained momentum. Short arcs on strong ribbons indicate rapid decisive breaks that required minimal time to complete.
State Discipline : Maintain structural bias aligned with the current state established by the most recent CHoCH until a new CHoCH in the opposing direction confirms a structural shift. Individual BOS ribbons within an established trend do not alter the structural regime and should be interpreted as continuation rather than reversal evidence.
Disclaimer
Market Structure Flow Map is a professional-grade market structure visualization and conviction-weighted structural event analysis tool. It uses pivot-based break detection with composite displacement and volume strength scoring but does not predict future price movements. Results depend on market conditions, instrument structural characteristics, parameter selection, and disciplined execution. BOSWaves recommends deploying this indicator within a broader analytical framework that incorporates order flow context, volume analysis, and comprehensive risk management. Penunjuk

Trend Survival MatrixMost trend tools tell you which way the trend is going, but not how late you are in it. The Trend Survival Matrix answers that directly. It tracks the live trend across three timescales (short, medium, and long EMA regimes) and measures each one's age — the number of bars since it last flipped. Then, from every completed trend in the chart's history, it builds an empirical run-length distribution and estimates a conditional survival probability: the odds the current trend lasts at least 5, 10, or 20 more bars given how long it has already run. Crucially, those odds are conditioned on the volatility regime each historical run was born in (low / normal / high ATR-percentile buckets), so a long, calm trend isn't judged against runs that formed in chaotic conditions.
The panel reads left to right: direction, current age, the typical (median) run length for that regime, survival odds at each horizon, and a maturity state — FRESH, HEALTHY, MATURING, EXTENDED, or EXHAUSTION — driven by an overextension z-score (how many standard deviations the current age sits above the historical mean). On the chart, a ribbon between the primary EMA pair tints by direction and fades as survival decays, so a durable trend looks solid while a fragile, overextended one visibly thins out. Markers flag new trends, and a once-per-run label warns when survival drops below your threshold — useful for deciding whether to add, tighten stops, or prepare to fade.
Everything is empirical and inspectable — the survival figures come straight from the instrument's own history, not a black box or preset numbers. The engine is fully non-repainting (state advances only on confirmed bars, with no higher-timeframe requests), so the readings stay stable when you switch chart timeframes. Where there aren't enough historical samples to condition on, the panel honestly reports LOW DATA and a confidence flag rather than showing a made-up probability. Works on any symbol and timeframe; tune the EMA lengths, horizons, and volatility buckets to your market. Penunjuk
