Edo Breaker BlocksEdo Breaker Blocks — Draws Only the Order Blocks That Fail and Invert Their Role, Then Tracks Each Breaker as Active, Tested or Failed
When an important level fails, it does not disappear — it changes sides. A demand order block that is lost stops being support and starts acting as resistance; a supply order block that is taken out stops being a cap and starts acting as support. That inverted level is a breaker block, and it is one of the clearest reaction references in structure analysis: not a theoretical line, but one that has already failed in one direction and reacted in the other.
Edo Breaker Blocks maps them automatically, with one key difference from a plain order-block tool: it does not draw every order block. It keeps each candidate latent until price violates it and reacts from the opposite side; only then is the breaker zone drawn, with the inverted role. From there it tracks the zone's behavior — respected, tested or lost — all validated on closed bars so the indicator does not repaint. Everything it needs comes from the chart's own price action: the candidate zones, the violation that inverts them and the states that follow are all computed inside the indicator.
ORDER BLOCK, BREAK AND BREAKER
An order block is the last opposite candle before an impulse that breaks structure: the last bearish candle before a bullish break marks the demand zone, the last bullish candle before a bearish break marks the supply zone. The indicator stores that candidate but does not draw it. Only when price violates it — closes through it against its original role — is the polarity inversion confirmed and the breaker drawn. A demand order block lost becomes a bearish breaker (resistance); a supply order block taken out becomes a bullish breaker (support).
BULLISH AND BEARISH BREAKERS
A bullish breaker is a former resistance order block that price has taken out; it inverts into support, drawn in teal below price. A bearish breaker is a former support order block that price has lost; it inverts into resistance, drawn in red above price. Each breaker is a box over the range of the candle that originated it, extended to the right and labelled Bull Breaker or Bear Breaker, so the side and role read at a glance.
ACTIVE, TESTED AND FAILED
Each breaker lives in one of three states, evaluated on every closed bar. Active: freshly formed, thin-bordered, extending to the right. Tested: price has returned to the zone and respected it — it enters but closes on the correct side — and the border thickens while the zone stays alive. Failed: price has closed through the zone, which voids it — the box turns dashed and faded and stops extending. A bullish breaker is tested when price drops in and closes above its base, and fails when it closes below; a bearish breaker is tested when price rises in and closes below its top, and fails when it closes above. Only breakers that have not failed count in the panel, and only the most recent per side are kept, up to Max Breakers per side (6 by default).
STRUCTURE PROFILES AND IMPULSE LOOKBACK
The Structure Profile sets the swing sensitivity that defines a break: Scalper (5 bars each side) for short-term breakers on low timeframes, Swing (10 bars, the default) for the balanced 4H and daily read, and Long Term (21 bars) for the major breakers on weekly and higher horizons. The Impulse Lookback (20 by default) controls how many bars back the indicator searches for the candle that originated the impulse — how recent the order block has to be relative to the break.
INFORMATION PANEL
A compact panel under the indicator header shows the number of active bullish breakers (support), active bearish breakers (resistance) and the total of live zones, in the same teal/red color code. The count per side shows where the live references concentrate — more bull breakers mean support stacked below, more bear breakers resistance above. The panel sits in any of the four chart corners (Top Right by default), comes in three sizes (Tiny / Small / Normal) and two themes (Dark / Light), and can be hidden entirely. To keep the calculation light, it is drawn only on the last bar.
NO REPAINTING
Breakers are built on confirmed pivots and their transitions are validated on closed bars, so a zone never appears or disappears intrabar and a wick that pierces a breaker but closes back on the same side does not mark it as tested or failed. There are no higher-timeframe functions: all logic runs on the current chart timeframe. For a multi-timeframe read, apply it on several charts at once.
CONFIGURATION
The inputs are grouped by block. Structure sets the profile, the impulse lookback and the maximum breakers per side. Style exposes the bullish and bearish colors, the zone opacity, the label size and the Dark/Light theme. Panel controls panel visibility, position and size. The defaults are calibrated to work without adjustment on stocks, crypto, forex, indices and futures, on any timeframe — the inputs most users touch are the Structure Profile and the Impulse Lookback.
ALERTS
Four predefined alerts cover the life of a breaker: Bullish Breaker formed and Bearish Breaker formed fire when a new breaker is drawn; Breaker Tested fires when price returns to a zone and respects it; Breaker Failed fires when price closes through a zone and voids it. All alerts fire on bar close, consistent with the indicator's anti-repaint validation.
HOW TO READ IT
Use a breaker as a reaction zone: a bullish breaker below price is a probable support, a bearish breaker above a probable resistance, stronger than a plain level because it has already proven its inverted role. Watch the test — when price returns and respects the zone, the reaction confirms it is still alive, and a tested breaker that holds is a more solid reference than a freshly formed one. Read the failure too — a breaker closed through has lost its relevance, and recognizing it in time avoids leaning on a zone that no longer defends anything. Trade breakers in confluence with the broader structure, and combine them with order-block mapping, which marks the active blocks before they fail, and with a broader market-structure read that places everything in context.
OPEN SOURCE
Edo Breaker Blocks is published as a free open source indicator. The full Pine Script is publicly accessible on TradingView for study, adaptation and integration into any workflow. Part of the Edolab Markets free tools ecosystem available on TradingView.
This indicator is a technical analysis tool for educational and informational purposes only. It does not generate automatic buy or sell signals and should not be considered financial advice. Trading financial markets involves significant risk of capital loss. Past performance does not guarantee future results. Always use proper risk management.
אינדיקטור

Session High / Low Strength **Session High / Low Strength PRO** is a session-based market structure indicator designed to automatically track the High and Low of multiple trading sessions while also calculating how strong each level is.
The indicator can be fully customized for different markets, time zones, and trading styles. Each session can have its own name, trading hours, and color.
### Main Features
• Tracks the **Session High and Session Low** automatically
• Supports up to **4 fully customizable sessions**
• Custom **From / To session times**
• Adjustable **UTC / GMT timezone**
• Works with Asia, London, New York, custom sessions, or any other time window
• Automatically extends completed session levels
• Optional strength labels
• Live dashboard displaying session levels and strength
• Customizable line styles, colors, and widths
### High / Low Strength Score
Each Session High and Session Low receives a **Strength Score from 0 to 100**.
The score combines several different factors instead of relying on only one measurement.
**Level Touches**
The indicator tracks how often price interacts with the Session High or Low. Multiple reactions around the same price can indicate that the level is being respected by the market.
**Wick Rejection**
Long rejection wicks around the Session High or Low can indicate aggressive rejection of that price area.
**Relative Volume**
Volume around each level is compared with average market volume. Higher relative volume during a test can indicate stronger participation around the level.
**Close Away Strength**
The indicator measures how strongly price closes away from the Session High or Low after interacting with it. A stronger move away from the level can indicate stronger rejection.
### Strength Classification
The final score is classified as:
**0–24:** VERY WEAK
**25–39:** WEAK
**40–54:** MODERATE
**55–69:** STRONG
**70–84:** VERY STRONG
**85–100:** EXTREME
The weight of each strength component can be adjusted individually in the settings.
### Session Configuration
Every session can be configured independently.
Example:
**Asia Session**
00:00 – 08:00
**London Session**
07:00 – 16:00
**New York Session**
13:30 – 20:00
**Custom Session**
Any user-defined trading period
These are only example times. All session times can be changed directly in the indicator settings.
### Time Zone Support
The indicator supports customizable time zones, allowing the same session logic to be used regardless of the chart's exchange timezone.
Examples:
GMT+0
GMT+1
GMT+2
GMT-4
GMT-5
You can also use supported timezone names such as:
Europe/London
America/New_York
This makes the indicator useful for traders who work with specific session windows across different global markets.
### Extended Session Levels
When a session finishes, its High and Low can automatically extend to the right side of the chart.
This allows previous session levels to act as potential:
• Support
• Resistance
• Liquidity targets
• Breakout levels
• Reversal areas
• BOS / CHoCH confirmation zones
When the same session starts again, the previous session levels stop extending and the new session begins calculating its own High and Low.
### Dashboard
The built-in dashboard shows:
• Session name
• Session High
• High Strength Score
• Session Low
• Low Strength Score
• Strength classification
This makes it possible to quickly compare the most important session levels without manually checking every line on the chart.
### Trading Applications
The indicator can be used together with:
• BOS / CHoCH
• Market Structure Shift
• Liquidity Sweeps
• Breakout & Retest strategies
• Support and Resistance
• Volume Profile
• Session trading
• Reversal setups
• Trend continuation setups
For example, a Session High with a high strength score may represent a more significant liquidity or resistance area than a Session High that formed with very little volume and no meaningful rejection.
### Important
The Strength Score should not be interpreted as a prediction that a level will definitely hold.
A strong level can still break.
The score is designed to provide additional context about how the level was formed and how strongly the market previously reacted around that area.
It is best used together with price action, market structure, volume, and proper risk management.
אינדיקטור

TrendLock | Multi-Timeframe Supertrend Donchian BreakoutStrategy Explanation
TrendLock combines three independent confirmations before it will ever open a trade: a primary Supertrend for local trend direction, a higher-timeframe Supertrend that must agree before entries are allowed, and a Donchian channel breakout that times the actual entry once both trend layers align. A volume-spike filter adds a final check that real participation is behind the move, not just drift.
The idea is simple: most Supertrend scripts fire on every local flip and get chopped up in ranges. TrendLock only engages when the bigger picture and the immediate price action are both pointing the same way, and only pulls the trigger on a genuine breakout — not just a trend-line touch.
Exits are ATR-based (stop and target sized off current volatility, not fixed percentages), with an optional early exit if the primary Supertrend flips against the position.
Features
Dual-timeframe Supertrend agreement filter (toggle on/off)
Donchian channel breakout entry trigger, plotted with a shaded channel
Volume-spike confirmation filter
ATR-based stop loss and take profit
Optional trend-flip exit independent of the stop/target
Long-only, short-only, or both-direction modes
Background tint shows HTF/LTF agreement at a glance
Built-in alert conditions for long and short signals
Tips
Pick an HTF meaningfully above your trading timeframe (e.g. 15m chart → 4H filter, 1H chart → 1D filter). Too close and the filter does nothing; too far and setups become rare.
Test the HTF filter on and off separately — it should reduce trade count and whipsaws, not just trade count.
Donchian lookback and ATR lengths interact: a longer Donchian window means fewer, larger breakouts, so widen your ATR stop/target multipliers accordingly.
Try disabling the volume filter on lower-liquidity assets, where volume data can be noisy or unreliable.
Backtest across several unrelated symbols and timeframes using the same input values — if it only works on one chart, the settings are likely overfit rather than a real edge.
Warnings
This is a backtesting and research tool, not financial advice — past performance in the Strategy Tester does not predict future results.
request.security calls for the HTF Supertrend can behave differently between the visible chart and actual live execution; always forward-test on a paper account before risking real capital.
Breakout strategies are prone to false starts in choppy markets even with trend filters — expect a real losing-streak tail in the backtest, not just the equity curve's best stretch.
Commission, slippage, and order-fill assumptions in the Strategy Tester are approximations; verify against your actual broker/exchange fee schedule before sizing a live position.
The HTF filter and volume filter are optional and default to specific settings — review every input before deploying, don't assume the defaults suit your instrument or timeframe.
אסטרטגייה

Crypto Directional Score Oscillator [FibonacciFlux]A causal OHLCV direction score for crypto with a fixed-coefficient mode and two Bayesian-regime modes - published with measurements showing that the default mode ranks outcomes only weakly, that its percentages are not probabilities, and that the two Bayesian modes do not rank outcomes at all.
This plots an Up score and a Down score from 0 to 100 against a threshold. Neither is a chance of anything. It was saved as "Crypto Directional Probability Oscillator" and renamed before publishing, because the measurements below show the number is not a probability.
🔶 USAGE
In Fixed mode the oscillator blends five features of the current bar - trend, momentum, mean reversion, volume-weighted close location and path efficiency - into a logistic score from 0 to 100; the Bayesian modes add a volatility-regime input. Markers print where the score crosses a threshold. Read it as a compact summary of which features dominate right now. Do not read it as a forecast: its best measured ranking ability is an AUC of 0.55, before any trading cost, and its markers do not beat chance.
🔹 Reading the pane
Up score, teal, and Down score, red, are mirror images: the Down score is 100 minus the Up score. They are one number drawn twice.
The grey guides sit at the threshold, at 50, and at 100 minus the threshold.
A marker prints on a confirmed bar when either line crosses up through the threshold. Every marker sits on the upper guide, bearish ones included, because a bearish marker is the red Down score crossing up through it; nothing prints at the lower guide. C means efficiency is at or above the Trend Regime Threshold and trend agrees in sign; R is every other crossing.
The table, bottom right: the active mode; what the number is and its measured AUC range; in the Bayesian modes the dominant regime and its posterior; in Bayesian + Adaptive the number of scored samples each expert holds (weights apply from 12); and a warning when volume is missing or the timeframe is outside 1h-4h.
In the Bayesian modes the Data Window also lists the four regime posteriors (Bull, Bear, Range, Stress) in percent.
🔹 The modes have opposite signs
A HIGH Fixed reading means price below its fast EMA with negative momentum - a dip-buy read. A high reading in either Bayesian mode means an established uptrend above it - a continuation read. Across all four symbol-timeframe pairs, the Up score correlates +0.51 to +0.60 with mean reversion and -0.09 to +0.02 with trend in Fixed, against -0.46 to -0.41 and +0.78 to +0.81 in both Bayesian modes. Switching the dropdown reverses what a high number means.
🔹 Warm-up and repainting
Fixed needs 55 bars and the Bayesian modes 64 - about 2.3 and 2.7 days on 1h, 9 and 11 days on 4h. Adaptive weights go live after roughly 150-160 bars; the exact count depends on where the chart's history starts, because adaptation samples every eighth bar by timestamp. The lines move while a bar is open. The regime filter, the adaptation and every marker update on confirmed bars only, so historical markers do not repaint.
🔶 DETAILS
🔹 The mechanism
Fixed mode, every coefficient asserted rather than estimated:
logit = 1.6 * (eff * (0.55*trend + 0.30*momentum) + (1 - eff) * 0.65*meanRev + 0.25*flow)
pUp = 1 / (1 + exp(-logit))
The Bayesian modes run a four-state filter (Bull, Bear, Range, Stress) with Student-t likelihoods and gate four expert logits by the posterior. Two constants flip the sign, and only together: the gate gives mean reversion 0.05 of the weight under a Bull or Bear posterior (0.55 under Range), and a 0.90 * (pBull - pBear) term adds a directional-state signal driven mostly by trend. Changing either alone leaves the mean-reversion correlation at -0.21 to -0.29; changing both turns it to +0.44 to +0.49. None of the roughly 80 constants in the file was fitted to data.
🔹 Measured result
Binance BTCUSDT and ETHUSDT, 1h (21,567 bars per symbol) and 4h (5,392 per symbol), 2024-04-01 to 2026-09-16. The code attaches no forward horizon to the score, so outcomes were scored at 1, 8 and 24 bars: 12 cells per mode. Nulls are circular shifts of the outcome series, seeded, with the observed statistic pooled into the draws.
Fixed ranks outcomes, weakly. AUC 0.509 to 0.550, above 0.5 in 12 of 12 cells, significant in 8 (400 draws), family-wise p 0.027 - but the 12 cells are not independent: they share three overlapping horizons and two nested timeframes, and BTCUSDT and ETHUSDT log returns correlate 0.82. Uneven: 6 of 6 ETHUSDT cells, 2 of 3 BTCUSDT 1h, 0 of 3 BTCUSDT 4h (p 0.24-0.63).
Its percentages overstate that by roughly 4 to 24 times. At 8 bars the top Fixed decile (mean printed 63.0-63.7) rose 50.7-52.5% of the time; the bottom decile (36.9-37.5) rose 44.1-49.5%. A printed spread of about 26 points is a realized spread of 1.1 to 6.8, an overstatement of 3.9x, 4.5x, 9.7x and 23.8x in the four cells. Brier skill against always predicting the base rate is negative in 11 of 12 Fixed cells (-0.004 to -0.021; one cell +0.003).
The Bayesian modes do not rank outcomes. AUC 0.467 to 0.505 across 24 cells, none significant (smallest p 0.095), family-wise p 0.91, Brier skill -0.156 to -0.205. Their extreme tails lean the wrong way - the top decile rose less often than the bottom in 24 of 24 cells, mean -0.062 - but the ranking as a whole is not detectably inverted.
The markers do not separate from chance. 138 tests (144 marker-type x horizon x symbol x timeframe x mode combinations, less 6 with fewer than 5 events): 13 reach p <= 0.05 where 6.9 are expected, family-wise p 0.120. The two strongest are the same marker with opposite signs, both Bayesian + Adaptive one bar ahead: bearish continuation +54.89bp on BTCUSDT 4h, -72.52bp on ETHUSDT 4h.
🔹 Known limits
Between 28% and 42% of the threshold slider does nothing in Fixed mode. Neither Fixed line can exceed 85.32 (logit bound 1.760), and the larger of the two peaked at 75.5 to 80.5, so 14, 15, 10 and 12 of the 36 positions printed no marker in 2.4 years on BTCUSDT 1h, BTCUSDT 4h, ETHUSDT 1h and ETHUSDT 4h. Both Bayesian modes reach about 93. At 0.70 on BTCUSDT 1h: 97 markers in Fixed, 574 in Bayesian Regime, 619 in Bayesian + Adaptive.
The Stress state is almost unused: dominant on 0.1% to 0.3% of bars, median posterior 0.004. Moving Stress Sensitivity from 0.5 to 2.0 changes the Up score by 0.34 to 0.40 points on average.
Adaptation moves the Up score by 1.1 to 1.3 points on average and at most 19, and leaves the Bayesian tail pattern in place in 12 of 12 cells.
Two instruments, two timeframes, no transaction costs.
🔹 How the numbers were checked
The model was reimplemented outside Pine and compared with the chart's Data Window: 271 values over 14 bars - Fixed and Bayesian Regime on BTCUSDT 4h (2026-06-13 to 2026-08-19), Bayesian + Adaptive on BTCUSDT 1h (2026-09-10 to 2026-09-15). Fixed and Bayesian Regime agree to 4.9e-9. The largest adaptive difference, 0.004 points of the Up score on one bar, is volume: TradingView's BINANCE feed showed 349.12 where Binance's API reports 363.19, and flow is the only input that reads it.
Three reviews of the draft changed its conclusions, and the corrections are recorded because each wrong version looked finished. The draft said the score did not discriminate at all and that the Bayesian modes rank outcomes in reverse; a re-test found Fixed does rank weakly and the reversal is confined to the tails. The marker family-wise p was first 0.0010 (each null draw was compared against a set containing itself), then 0.0605 (observed and null p on different grids), and is 0.120 with the pooled estimator. The two estimator errors both made the markers look better than they are; the first-draft error ran the other way and understated Fixed.
🔶 SETTINGS
🔹 Model Mode
Model Mode - Fixed, Bayesian Regime, or Bayesian + Adaptive; the modes have opposite signs (default: Fixed)
🔹 Features and Signals - used by every mode
Fast EMA - trend and mean-reversion anchor (default: 21, range 5-80)
Slow EMA - trend reference (default: 55, range 20-200)
Momentum Horizon - bars in the normalized return (default: 8, range 2-30)
Normalization Length - return deviation and volume average (default: 20, range 10-100)
Efficiency Length - bars in the path-efficiency ratio (default: 20, range 5-100)
Signal Threshold - marker level; prints nothing in Fixed from 0.76-0.81 upward (default: 0.70, range 0.55-0.90)
Trend Regime Threshold - efficiency needed to label a crossing C rather than R (default: 0.35, range 0.10-0.80)
🔹 Bayesian Regime
Trend-State Persistence - probability a trend state carries to the next bar (default: 0.90, range 0.70-0.98)
Student-t Degrees of Freedom - tail weight of the likelihoods (default: 5, range 3-15)
Stress Sensitivity - Bayesian modes only; lowers the volatility level at which Stress engages; nearly inert (default: 1.0, range 0.5-2.0)
🔹 Optional Adaptation
Outcome Horizon - Bayesian + Adaptive only; bars before an expert's call is scored, and the sampling cadence (default: 8, range 2-24)
Matured Observations - Bayesian + Adaptive only; scored samples kept per expert; at least 12 before weights apply (default: 48, range 12-120)
Greediness - how sharply lower loss raises an expert's weight (default: 2.0, range 0.25-6.0)
Minimum Expert Weight - floor on an expert's raw score before the four weights are normalized, so the realized minimum weight is higher than this: 0.10 to 0.17 in the measured data (default: 0.05, range 0.01-0.20)
🔹 Two-Color Style
Up / Bullish - colour of the Up score line and the bullish markers (default: #14B8A6)
Down / Bearish - colour of the Down score line and the bearish markers (default: #F43F5E)
Line Width - width of both score lines (default: 2, range 1-4)
Open source under the Mozilla Public License 2.0. Nothing here is a forecast, a signal service, or a claim of profitability. אינדיקטור

אינדיקטור

JoulTrades - ICT PDH/PDL EighthsOVERVIEW
This indicator marks the previous day's high (PDH) and low (PDL) and grades the range between them in eighths, the way ICT (Inner Circle Trader) teaches traders to grade a range: quadrants, octants and a black equilibrium line. It is a level-marking tool for study and chart preparation. It does not generate signals, entries or bias.
WHAT IT DRAWS
- PDH and PDL, extended to the right with labels and price-axis tags.
- Seven graded levels between them: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75 and 0.875.
- The 0.5 level (equilibrium, also called consequent encroachment or CE) in black. Every other level uses one grey, so the midpoint stands out.
- Optional: the previous week's high and low as dashed lines.
HOW IT WORKS
- The range is always measured from the low to the high, whatever the trend. The levels do not move when the market turns.
- Each level is PDL + fraction x (PDH - PDL).
- No separate 0 and 1 lines are drawn, because PDH and PDL already sit there. A range's own edge is not drawn twice.
- The previous day is final once it has closed, so its levels do not repaint. The lines are redrawn on the latest bar only so they stay attached to the current price area and do not pile up on the chart.
- It works on every intraday timeframe and on the daily. Nothing is drawn on weekly or monthly charts.
WHAT COUNTS AS "PREVIOUS DAY"
Traders use two definitions, and they can give different prices:
- Full day (default): the daily candle. On CME futures that is 18:00 to 17:00 New York time, including the overnight session.
- RTH session only: the regular trading hours set in the settings (default 09:30-16:00 New York). The labels change to "RTH PDH" and "RTH PDL" so a screenshot always shows which one is in use.
On charts above 30 minutes, the RTH range is read from 30-minute data so the session edges are exact.
NUMBERING
- ICT ladder (default): 0 is the low and 1 is the high, so 0.875 is the highest octant, next to PDH.
- TradingView fib: matches the built-in fib retracement tool drawn from low to high, which puts 0 at the high.
The prices are identical in both modes. Only the numbers attached to them change. Pick the one that matches the way you read levels.
LABELS
Labels can show the number, the ICT name, or both:
0.875 highest octant, 0.75 upper quadrant, 0.625 second octant, 0.5 CE, 0.375 lower octant, 0.25 lower quadrant, 0.125 lowest octant.
Hover over any label for a short explanation of that level. This is meant to help newer traders learn the vocabulary while they look at the chart.
HOW TO READ IT
- Above 0.5, price is in the premium half of yesterday's range. Below 0.5, it is in the discount half.
- ICT treats quadrants and octants as reference levels that price can be drawn to, not as decoration.
- PDH and PDL are where resting liquidity is commonly assumed to sit until price trades through them.
- A level carries more information when it lines up with a level from a different range, for example an opening gap or a key open landing on the same price.
Use these levels as a map for your own analysis. They are not trade signals on their own.
SETTINGS
- Range: previous day definition, RTH session and timezone, eighths on or off.
- Labels: numbering, label text, price in labels, label size, label distance from price.
- Style: level colour, equilibrium colour, line widths. The defaults are grey #636363 levels, a black equilibrium, and thicker PDH/PDL lines.
- Previous week: high and low on or off, and their colour.
LIMITATIONS
- The default RTH session fits US index futures and US stocks. For other markets, set the session and timezone to match.
- Full day follows the chart's own daily session. On symbols that trade around the clock, "previous day" is whatever the exchange defines as the daily candle.
- RTH mode on the daily chart depends on the 30-minute history TradingView loads for your plan.
- These are reference levels. The indicator makes no claim about how often price reacts at any of them. Test them on your own market and timeframe before relying on them.
This script is open source and published for educational purposes. It is not financial advice.
אינדיקטור

אינדיקטור

Unmitigated Gaps by Midniteblade4H Unmitigated Gaps — Build Summary
A Pine Script indicator that finds and draws unmitigated Fair Value Gaps (FVGs) on the 4H timeframe, from any chart timeframe you're viewing.
What it does
An FVG is a three-candle imbalance — a move so fast that price left a gap no two-way auction filled. The script looks for two kinds:
Bullish FVG — candle 3's low is above candle 1's high (l3 > h1). Price skipped up; the gap sits below.
Bearish FVG — candle 3's high is below candle 1's low (h3 < l1). Price skipped down; the gap sits above.
Each gap is drawn as a box and stays on the chart until price trades back through it ("mitigated"). The info table reports live counts, the nearest gap above/below price, and the stored 4H period data.
The three bugs we hit — and why each mattered
1. max_bars_back rejected built-in series. The script needed deep history for dynamic indexing. Pine refused max_bars_back(volume, 5000) because volume, close, open, hlc3 are built-ins — the parameter needs a user-declared series. Fix: assign each to a variable first, then declare.
2. The history buffer was keyed to the wrong variable. This is the subtle one. We declared history on the new variables — but the loop still indexed volume , close directly. Pine sizes its buffer for the exact series you reference, so the declarations did nothing and the runtime error came back. Fix: swap every dynamic index in the loop to the declared variables.
Lesson: declaring max_bars_back on a variable only helps if that variable is what you actually index. The declaration follows the reference, not the value.
3. The live test compared a bar against itself. The ongoing check read candle 3 from the n-1 slot while also treating the live bar as a separate candle — but those were the same bar. It could never detect a new gap. Fix: compare the newest stored period against the two before it, so all three candles are genuinely distinct.
Lesson: when a test returns zero forever, check whether its inputs are actually independent before assuming the market is quiet. A debug row showing the raw stored values is what exposed this.
Debug technique worth stealing
We added a table row printing the last three stored htfH/htfL pairs — . That single row let us verify the array was storing sane values and cross-check them against the table's own "Cur/Prev period" rows. When the numbers matched, the storage was proven correct; when the live test still failed, the bug had to be in the comparison logic.
Print your raw inputs, not just your outputs. An output of 0 tells you nothing. The inputs tell you why.
Takeaway
Three separate bugs, each hidden behind the last. The first fix looked like it worked until the second surfaced; the second looked complete until the third appeared. Debugging in sequence — fix, re-run, read the new error — is what got there. Skipping verification after a fix would have left all three in place. אינדיקטור

HD Volatility EngineHeavy Diligence Volatility Engine — HDVE v1.0
HDVE is designed to help identify when momentum may be starting to change. It does not tell you to buy or sell. It gives you another layer of information so you know when something on the chart deserves more attention.
The easiest way to read it is by looking at the arrows. Pot Mom ↑ signals a potential upside momentum change, while Pot Mom ↓ signals a potential downside momentum change. When a second arrow appears — ↑↑ or ↓↓ — HDVE has also detected stronger recent volume participation. That’s all you need to know to start using it.
How to use HDVE
HDVE is not designed to make a trading decision by itself. It is meant to be another layer of information.
Here is how I would use the tool to help me make a decision:
If I am considering Calls and HDCE is showing multiple bullish signals pointing in the same direction, then HDVE produces a green Pot Mom, that supports the idea. If HDCE is showing bullish confluence but HDVE begins producing bearish Pot Moms, that conflict matters too. It may be enough to make me wait rather than force an entry.
The same applies once I am already in a trade. If I am in Calls and a red Pot Mom appears near resistance, that is not an automatic exit signal. It tells me to reassess the position. I may look at structure, VWAP, volume, HDCE, nearby support or resistance, and whether the original trade thesis is still intact.
Sometimes the most useful thing an indicator can tell you is not “take this trade.” Sometimes it is “not yet” or “something may be changing.”
How the Heavy Diligence tools work together
The tools are designed to answer different questions.
HDTL helps identify where important structural decision areas are.
HDCE helps evaluate whether enough signals are pointing in the same direction — directional confluence — to consider a trade.
HDVE helps identify whether momentum may be beginning to change.
In simple terms:
HDTL identifies the levels.
HDCE shows the combined directional signals.
HDVE points to potential changes in momentum.
That is where I believe the real value is. The tools are not meant to replace each other. They are designed to give you different types of information that can be viewed together.
Recent Volume Context
HDVE includes a Recent Volume Context feature because meaningful volume does not always appear on the exact candle where momentum changes.
Sometimes volume enters first, price consolidates, and the momentum shift appears later.
That is why the second arrow matters. It tells you the Pot Mom appeared with stronger recent participation behind it.
Conservative and Aggressive Modes
HDVE includes two modes.
Conservative is the recommended setting, especially for new users. It is designed to be more selective and produce fewer observations.
Aggressive allows earlier and more frequent observations. Before using Aggressive mode, I would strongly recommend going back through previous charts and reviewing how those additional signals behave.
HDVE v1.0 was designed and tested around the 3-minute chart using standard candlesticks.
Other timeframes and alternative candle types may behave differently and should not be assumed to produce the same results.
Final thought
The goal was never to build something that predicts the market.
The goal was:
Better information. Faster. Easier to understand.
Sometimes HDVE may help identify an opportunity. Sometimes it may help you avoid one. Sometimes it may tell you that an existing trade deserves another look.
The indicator provides information.
The trader still makes the decision. אינדיקטור

Round Number Levels - Response and ControlRound Number Levels - Response and Control
Round Number Levels - Response and Control draws a fixed round-number grid and examines what confirmed closes do after price contacts its levels. Two shifted reference grids provide a comparison, using contacts matched by time, approach direction and pre-contact market context.
Use it to keep price levels visible and investigate whether their observed response differs from nearby, equally spaced references. Negative differences, disagreement between the references and insufficient data are all possible results. The indicator does not assume that round numbers must act as support or resistance.
GETTING STARTED
Use a standard time-based chart and check the Interval value before interpreting any statistics. The default interval is 200 minimum ticks, not 200 pips and not a universal setting for every market. This equals 0.200 when the minimum tick is 0.001, or 0.00200 when the minimum tick is 0.00001. Manual price mode lets you specify the interval directly in price units, rounded to whole minimum ticks.
Keep the Compact panel for the main comparison. Standard adds coverage information; Research exposes the detailed sample, individual references and exact-level history. Hover over panel rows and badges for definitions and counts. A Low N or Partial status is information about the available sample, not an instruction to search for settings that produce a preferred result.
For a repeatable study, set the price interval, date window and observation rules before evaluating the displayed differences. Display-only settings, including badge sizes, colors, marker limits and panel detail, do not change the research.
THE FIXED PRICE GRID
ROUND levels are integer multiples of the chosen interval, measured from price zero. The levels are defined before their reactions are observed; the script does not move them toward historical pivots or keep only levels that previously worked.
By default, cyan marks ordinary levels, yellow emphasizes every fifth interval, green marks the enclosing lower level, and pink marks the enclosing upper level. The enclosing colors take priority when a level also qualifies as a major level. The panel shows the exact enclosing prices, tick distances and position within that interval. Optional half-interval guides appear only when the interval contains an even number of ticks. These subdivisions and visual emphasis do not create additional research cohorts.
The opaque price badges use compact, bold monospace digits: 13 points for ordinary round numbers and 14 points for major or enclosing levels. Their fill follows the level color, with automatically selected black or white text. An opaque dark background is also available. Font sizes remain independently adjustable. The default text contains the price only; L/U and major-level prefixes can be restored.
Badges retain the exact level in their text even when displaced for readability. Optional connectors join them to the corresponding horizontal line. The default position is to the left of the line segment, with an additional twelve-bar horizontal gap and a small vertical offset. Badge placement does not change the line price. Very tight spacing or strong chart compression can still cause visual overlap.
Two automatic preview modes choose a 1-2-5 interval once from the first usable prior range or price context. The panel explicitly identifies PREVIEW because the choice can change with the loaded starting history. Copy its displayed interval into Manual price to fix the interval for a repeatable study.
REFERENCE A AND REFERENCE B
Reference A is shifted by 37% of the interval by default, rounded to minimum ticks. Reference B uses the exact complementary tick offset, normally close to 63%. Both references have the same spacing as ROUND. Their lines are optional and hidden by default, but research continues while they are hidden.
All three contact bands must be separate. Overlapping bands pause the comparison rather than creating indistinguishable cohorts. Shifted prices can still be round numbers at a finer scale. These are observational reference grids, not randomized placebos.
CONTACTS AND CONFIRMED OUTCOMES
A contact occurs when a candle's high-low range intersects the band around one grid level. The default half-width is 4% of the interval, with a one-tick minimum. The preceding close must be outside that band by the required clearance; the default clearance is 12% of the interval, with a minimum of one tick beyond the band.
The same bar-quality exclusion applies to all grids. If the opening gap crosses an entire band in any grid, or the candle touches more than one level band in any grid, none of the three grids admits a new contact on that bar. Already active observations continue. This avoids assigning a precise new contact to ambiguous OHLC data.
Every eligible contact is tracked, including contacts that start while earlier ones are unresolved. There is no outcome-dependent busy state or cooldown. A contact is not discarded merely because an earlier observation is taking longer to resolve.
The response distance is fixed at contact. It can be a fraction of the grid interval or a multiple of the preceding finite mean true range. The default is 20% of the interval. The threshold is at least one tick beyond the contact band and does not move with subsequent volatility.
The contact candle is excluded from outcome testing. Subsequent confirmed closes determine the result:
R, Return: the configured number of consecutive closes is at or beyond the threshold on the side from which price approached.
T, Through: the configured number of consecutive closes is at or beyond the threshold on the opposite side.
U, Unresolved: neither condition has been confirmed by the end of the full observation horizon.
Each consecutive-close counter resets when its own condition is not satisfied. The first confirmed R or T result is fixed. A confirmation on the last allowed bar takes precedence over U. Defaults are two consecutive closes within twelve bars after contact; the effective horizon is never shorter than the confirmation count.
These outcomes are not intrabar first touches, executions or trade returns. No entry, stop, target, spread, fee or position-sizing model is applied.
HOW THE MATCHED COMPARISON IS BUILT
The panel does not compare three independently truncated latest-N lists. Its main sample consists of triplets containing one ROUND contact, one A contact and one B contact.
Time is divided into fixed elapsed-time blocks anchored to the Unix epoch. The default block is 128 chart periods, equivalent to 640 elapsed minutes on a five-minute chart. Blocks are not exchange sessions and do not count only traded bars. Loading more preceding history does not move their boundaries. Weekly and monthly chart periods use the platform's seconds conversion rather than calendar-aligned week or month boundaries.
Within a block, contacts are grouped by approach side and optional prior context. The default Side + range + trend mode uses three range groups and three trend groups, separately for approaches from above and below. Side only and Side + range are also available.
Range grouping uses the preceding finite mean true range divided by the fixed interval, with default boundaries of 0.25 and 0.75. Values below 0.25 enter the low group, values from 0.25 to below 0.75 enter the middle group, and values at or above 0.75 enter the high group.
Trend grouping uses the preceding close minus the close ten bars before it. The default neutral band is plus or minus 0.5 times the preceding mean range; values on either boundary remain neutral. All context inputs come from preceding bars, not subsequent outcomes.
Inside each block and context group, the first eligible ROUND, A and B contacts are assigned together, then the second contacts, and so on. The default matching cap is the first eight contacts per grid, context group and block. Later contacts are still observed and exported, but do not enter matching. Their exclusion is counted separately.
A complete triplet must satisfy a fixed maximum spread between its earliest and latest contact times, defaulting to half a block. Failed triplets are not reassigned to different partners. Neither matching nor this time filter consults R/T/U results or resolution speed.
EVERY CONTACT RECEIVES THE SAME HORIZON
Early confirmation does not produce early inclusion in the comparison. Every observation must receive the full configured horizon before contributing, including results already known after only a few bars.
Only complete time blocks whose contacts have all had that horizon enter the panel. Blocks cut by the study dates or the beginning of usable history are excluded. The default window contains the latest twenty-four mature elapsed-time blocks. The study start is inclusive and the study end is exclusive; already admitted contacts continue to receive their horizon after the end date.
Matching gives the three cohorts identical counts by time block, approach side and context group. It does not make their price paths identical. Context groups remain broad, contact horizons can overlap, and unmeasured conditions can differ. Standard and Research show how much of the full contact population the matched sample covers.
READING THE COMPACT PANEL
The default panel has fourteen rows. The MATCHED section uses the same triplets for every main-sample percentage and difference.
N each grid shows the actual denominator: ROUND on the left and A / B on the right. All three numbers are equal. They are neither storage capacities nor counts of visible markers.
Return, Through and Unresolved show the ROUND share and the arithmetic mean of the A and B shares. U stays in the denominator. Hover over a row to see the separate A and B values and underlying counts.
R delta A / B shows ROUND's return share minus A's on the left, and ROUND's return share minus B's on the right. Values are percentage points, not percentage changes or predicted probabilities.
Mean / A-B shows the arithmetic mean of those two differences and their sign relationship. Both + means both are positive; Both - means both are negative. SPLIT means they have opposite signs. Has zero means one or both differences is exactly zero. A positive mean never hides a SPLIT. These labels describe signs, not statistical significance or confidence.
Early / Late splits the retained clock window into two contiguous halves. Each half has its own smaller matched denominator, shown in the tooltip. This is a historical period comparison, not a held-out test.
Main differences require at least thirty matched triplets, five from each approach side and three contributing blocks by default. Half-window comparisons use their own smaller guards. Below the requirements, counts and outcome shares remain visible while the affected differences are withheld. The guards prevent very small comparisons from looking definitive; they are not significance tests.
Standard has twenty-two rows and adds all mature contacts, matched coverage, over-cap contacts, contributing blocks, time spread and window coverage. Research has thirty-two rows and adds matched history at the exact enclosing levels, side counts, separate A/B outcomes, shared exclusions and reproduction details.
MARKERS, LIVE CONTEXT AND ALERTS
R/T/U markers appear on the confirmed bar when an outcome becomes known. Their time is never moved back to the contact bar. Default placement is outside the outcome candle and two preceding candles, plus a range-based margin. The vertical location is for readability, not the studied price or an execution price.
Several outcomes can resolve on one bar. The displayed badge represents the oldest contact resolving there; a plus sign, such as R+, means additional outcomes exist. The tooltip lists the R/T/U counts for that bar. Marker thinning and the maximum marker count affect drawing only.
Markers describe eligible ROUND outcomes before matching. The panel describes matched, fully mature triplets. Counting the chart markers therefore cannot reproduce the panel denominator. Optional threshold lines show only the latest unresolved ROUND contact to limit clutter; other observations continue independently.
The live reference price, enclosing levels, distances and cell shading can update during an open candle. Observation results are updated only on confirmed bars. The panel's matched sample uses closed, fully mature clock blocks, so it does not necessarily change on every new candle.
Four alert conditions are available: a newly admitted ROUND contact, one or more confirmed Return outcomes, one or more confirmed Through outcomes, and one or more Unresolved outcomes. They describe observation events rather than trade instructions. More than one outcome type can occur on the same bar, independently of which representative marker is visible. Create the required alerts in the alert dialog. Recreate existing alerts after changing research settings so that they use the intended configuration.
REPRODUCIBILITY AND NUMERIC RECORDS
Research uses a finite simple mean of tick-quantized true range rather than recursively seeded Wilder ATR. With manual spacing, the same settings and sufficient identical preceding OHLC, extra earlier history does not shift the later context calculations or epoch-based block boundaries. Data revisions, sessions, price adjustments and missing bars can still change results.
Require full start-date context pauses research unless loaded history crosses the requested start with adequate preceding context. Otherwise, the initial partial block is excluded and incomplete coverage is reported. Fixed / full describes coverage of the displayed window; it does not certify the entire requested history or statistical validity.
The RN6_ Data Window outputs retain research protocol 6001. They expose the settings, reported clock window, actual matched N, A/B differences, their mean, sign status and a non-cryptographic OHLC checksum. Equivalent records are emitted for all three grids: contact time, level in ticks, approach side, fixed threshold, result, first confirmation age, context group and ordinal.
Each record is emitted exactly H bars after contact. This permits at most one complete record per grid per bar, even when several early outcomes resolve together. Unmatched and over-cap contacts are still recorded. A negative ordinal marks a partial or date-cut block excluded from panel statistics. Pending contacts are not presented as completed records.
For recomputation, preserve the source, settings and native OHLC export, including sufficient context before the window and the following horizon. The checksum helps identify differences in included data; it is not a cryptographic signature. The optional Pine Logs recipe is a convenience for personal editor copies, not a requirement for using the published indicator.
DESIGN PURPOSE AND LIMITATIONS
The research layer is designed to test a fixed price reference rather than select levels after seeing their reactions. Its contribution is the combination of concurrent observation, shared admission rules, prior-context ordinal matching, a time-spread limit, uniform maturity, identical displayed denominators, explicit disagreement between two references, and symmetrical records for independent recomputation.
This remains observational analysis. Repeated contacts are not independent trials; matching can retain only part of the full population; the first-K limit and context boundaries affect the subset being studied. Changing the interval, period or rules after inspecting results introduces selection risk. Small, negative or inconsistent differences are legitimate findings.
The indicator is free and open-source. It places no orders, fetches no external data and requires no external service. Research is limited to standard time-based charts. Non-standard and tick charts retain the price grid without the research comparison. Neither a positive difference nor a Both + status proves a causal round-number effect, forecasts a future reversal or establishes a profitable trading strategy. אינדיקטור

D.vis Swing Engine - RP + RVOL + Trend## English
**D.vis Swing Engine – Relative Performance + Relative Volume + Trend**
D.vis Swing Engine is a swing trading indicator designed to identify stocks that combine positive trend structure, relative strength versus the S&P 500, and above-average trading volume.
The indicator combines several technical components into a single visual framework:
**Relative Performance (RP)** compares the stock's performance with the S&P 500, using SPY as the default benchmark. A positive RP value means the stock has outperformed the benchmark during the selected lookback period. The indicator also measures whether Relative Performance is improving or deteriorating.
**Relative Volume (RVOL)** compares the current trading volume with the stock's average volume over a selected period. An RVOL above 1.0 indicates above-average volume, while values such as 1.5x or 2.0x indicate significantly increased market participation.
The indicator classifies high relative volume on bullish candles as **Money In** and high relative volume on bearish candles as **Money Out**. These readings should be interpreted as proxies for buying and selling pressure rather than literal capital inflows or outflows.
The trend component uses:
- EMA 9
- EMA 21
- SMA 50
- SMA 200
The primary bullish trend condition requires price to trade above EMA 9 while EMA 9 is above EMA 21. SMA 50, SMA 200, and EMA 21 slope filters can optionally be enabled for more restrictive setups.
The indicator also calculates a **Setup Score from 0 to 5** based on five conditions:
1. Price is above EMA 21.
2. EMA 9 is above EMA 21.
3. Relative Performance is positive.
4. Relative Performance is rising.
5. Relative Volume exceeds the selected threshold on a bullish candle.
The dashboard classifies the setup as:
**WAIT** – insufficient conditions are aligned.
**WATCH** – most conditions are aligned and the stock may be approaching a valid setup.
**BUY 5/5** – trend, Relative Performance, and Relative Volume conditions are fully aligned.
A BUY label is displayed only when the complete bullish setup becomes valid for the first time, helping reduce repeated signals during an already established trend.
The indicator also includes a **RISK** condition designed to highlight potential distribution. This occurs when price falls below EMA 21, Relative Performance becomes negative, and strong relative volume appears on a bearish candle.
### Suggested settings for swing trading
- Benchmark: SPY
- Relative Performance Timeframe: Daily
- RP Lookback: 63 trading days
- RP Momentum Period: 5 trading days
- RVOL Average Length: 20
- RVOL Threshold: 1.5x
- SMA 50 Filter: Optional
- SMA 200 Filter: Optional
This indicator is intended as a decision-support tool and should not be used as a standalone trading system. Market structure, support and resistance, earnings, fundamental factors, risk management, and broader market conditions should also be considered.
---
## Română
**D.vis Swing Engine – Performanță Relativă + Volum Relativ + Trend**
D.vis Swing Engine este un indicator pentru swing trading conceput pentru a identifica acțiunile care combină o structură tehnică pozitivă, performanță relativă superioară față de S&P 500 și volum de tranzacționare peste medie.
Indicatorul combină mai multe componente tehnice într-un singur sistem vizual:
**Relative Performance (RP)** compară performanța acțiunii cu S&P 500, folosind implicit SPY drept benchmark. O valoare RP pozitivă înseamnă că acțiunea a performat mai bine decât benchmark-ul în perioada selectată. Indicatorul măsoară și dacă performanța relativă se îmbunătățește sau se deteriorează.
**Relative Volume (RVOL)** compară volumul curent de tranzacționare cu volumul mediu al acțiunii din perioada selectată. Un RVOL peste 1,0 indică un volum peste medie, iar valori precum 1,5x sau 2,0x indică o creștere semnificativă a participării în piață.
Indicatorul clasifică volumul relativ ridicat pe lumânări bullish drept **Money In**, iar volumul relativ ridicat pe lumânări bearish drept **Money Out**. Aceste valori trebuie interpretate ca aproximări ale presiunii de cumpărare sau vânzare, nu ca intrări sau ieșiri literale de capital.
Componenta de trend utilizează:
- EMA 9
- EMA 21
- SMA 50
- SMA 200
Condiția bullish principală cere ca prețul să fie peste EMA 9, iar EMA 9 să fie peste EMA 21. Filtrele SMA 50, SMA 200 și panta EMA 21 pot fi activate opțional pentru setup-uri mai restrictive.
Indicatorul calculează și un **Setup Score de la 0 la 5**, bazat pe cinci condiții:
1. Prețul este peste EMA 21.
2. EMA 9 este peste EMA 21.
3. Relative Performance este pozitiv.
4. Relative Performance este în creștere.
5. Relative Volume depășește pragul selectat pe o lumânare bullish.
Dashboard-ul clasifică setup-ul astfel:
**WAIT** – nu sunt îndeplinite suficiente condiții.
**WATCH** – majoritatea condițiilor sunt îndeplinite, iar acțiunea se poate apropia de un setup valid.
**BUY 5/5** – condițiile de trend, Relative Performance și Relative Volume sunt complet aliniate.
Eticheta BUY este afișată doar în momentul în care setup-ul bullish complet devine valid pentru prima dată, reducând astfel semnalele repetate în timpul unui trend deja confirmat.
Indicatorul include și o condiție **RISK**, concepută pentru a evidenția posibile perioade de distribuție. Aceasta apare atunci când prețul scade sub EMA 21, Relative Performance devine negativ, iar pe o lumânare bearish apare un volum relativ ridicat.
### Setări recomandate pentru swing trading
- Benchmark: SPY
- Timeframe Relative Performance: Daily
- RP Lookback: 63 zile de tranzacționare
- RP Momentum Period: 5 zile
- Media pentru RVOL: 20 perioade
- Prag RVOL: 1,5x
- Filtru SMA 50: Opțional
- Filtru SMA 200: Opțional
Indicatorul este conceput ca instrument de suport pentru luarea deciziilor și nu trebuie utilizat ca sistem de tranzacționare independent. Structura pieței, suporturile și rezistențele, raportările financiare, factorii fundamentali, managementul riscului și condițiile generale ale pieței trebuie analizate separat. אינדיקטור

COT Net Positions - Commercials vs Large SpeculatorsOverview
This indicator plots the net positioning (Long minus Short) of Commercial Traders and Large Speculators from the CFTC Commitment of Traders (COT) report, side by side, so you can see how the two groups are positioned relative to each other on the same chart.
How It Works
For each group, net position is calculated as:
Net Position = Long Positions - Short Positions
This is calculated separately for Commercials and for Large Speculators (Non-Commercials). Optionally, either series can be displayed as a percentage of total Open Interest instead of raw contracts:
Net % of Open Interest = 100 * Net Position / Open Interest
This normalization makes readings easier to compare over time and across contract-size changes (e.g. after a rollover or a change in typical position sizes), since raw contract counts alone don't account for changes in overall market participation.
COT data is requested with lookahead disabled, so this indicator does not repaint. Values only change on the bar where new CFTC data is published, regardless of chart timeframe.
Default Settings
Show Commercials: on
Show Large Speculators: on
Display Mode: Contracts (switchable to % of Open Interest)
Info table: on, top right
All adjustable in the script's Settings.
Interpretation
Commercials (often producers, processors and hedgers) and Large Speculators (large funds and managed money) are typically positioned on opposite sides of the market. Watching both net lines together shows the balance between these two groups.
A rising Commercials Net line while Large Speculators Net falls (or vice versa) reflects a shift in who is taking on more directional exposure.
The info table also shows the week-over-week change for each group and the current Open Interest.
Typical Use Cases
Compare Commercial and Large Speculator positioning on one chart
Track how net positioning shifts week to week
Normalize positioning across markets or over long histories using % of Open Interest
Combine with seasonality, price structure, trend and market regime for a fuller picture
Support commodity and futures market research
Limitations
COT data is weekly and delayed: the report reflects positions as of Tuesday and is usually published the following Friday. This indicator is not designed for intraday timing and is not a standalone trading system. Net positioning alone does not predict price direction. Both groups can remain positioned the same way for extended periods, especially in strong trending markets. Past positioning patterns do not guarantee future price behavior.
Symbol Support
Designed for futures and continuous futures charts. Some micro contracts, CFDs, broker-specific symbols or otherwise unsupported markets may not return valid COT data.
Originality
COT data retrieval uses the public TradingView "LibraryCOT" community library. The net-position calculation for both trader groups, the optional % of Open Interest normalization, the weekly change tracking, and the info table are original to this script. It complements the companion "Commercials COT Index Weekly" indicator, which shows Commercial positioning as a normalized 0-100 index rather than as raw/percentage net values.
For educational and research purposes only. This is not financial advice. אינדיקטור

ICT Session FVGs [50% Mitigated]This TradingView Pine Script (Version 5) is an overlay indicator designed for traders who use **Inner Circle Trader (ICT)** concepts. It automatically detects and highlights **Fair Value Gaps (FVGs)** that form during specific trading sessions (Killzones) and tracks them until price "mitigates" (fills) them to the 50% level.
Here is a breakdown of exactly how the script works under the hood:
### 1. User Inputs & Constraints
* **Session Toggles:** You can choose to highlight FVGs formed during the **Asia Killzone** (8:00 PM - 12:00 AM EST) and/or the **London Killzone** (2:00 AM - 5:00 AM EST).
* **Performance Lookback:** It only scans for and draws FVGs over the last X days (default is 5). Limiting historical data prevents the chart from lagging.
* **Visuals:** Allows customization of colors for Bullish (green) and Bearish (red) gaps.
### 2. Time Logic Filtering
The script hardcodes the timezone to `America/New_York` (EST). It checks every candle on the chart to see if it falls within the specified Asia or London time windows. If a candle is outside these windows (or outside the 5-day lookback limit), the script will ignore any FVGs that form.
### 3. FVG Detection (The 3-Bar Pattern)
When the active time zones are met, the script looks for the classic 3-candle FVG pattern using an array of custom data objects (`type FVG`):
* **Bullish FVG:** It triggers if the current candle's `low` is higher than the `high` of two candles ago. This leaves an empty gap where only buyers were present.
* **Bearish FVG:** It triggers if the current candle's `high` is lower than the `low` of two candles ago, leaving a gap where only sellers were present.
When a gap is found, the script calculates the exact top, bottom, and **midpoint (50% level)** of the gap, draws a colored box starting from the gap candle, and saves all this data into an array to be tracked.
### 4. Mitigation & 12 PM Cutoff Logic
This is the most dynamic part of the script. On every new candle, the script loops through all previously drawn, active FVGs to see what price is doing to them:
* **The 50% Mitigation Rule:** The script considers a gap "mitigated" (resolved) only when the price pierces the **50% midline** of the box.
* If a bullish gap's midline is hit by a candle's low, or a bearish gap's midline is hit by a candle's high, the gap is marked `mitigated = true`.
* The script then permanently locks the right side of the box to that specific candle, showing exactly where the gap was filled.
* **The Time Cutoff Rule:** If a gap has *not* been mitigated, the script will extend the box to the right so it stays visible on the chart. **However**, it stops extending unmitigated boxes at **12:00 PM (Noon) NY time**. It resumes extending them at 8:00 PM. This mimics the ICT concept of disregarding morning session unmitigated zones once the lunch hour hits. אינדיקטור

CQ_(9)_Phases Counter + Adaptive Projection v2================================================================================
CQ_(9)_Phases Counter + Adaptive Projection v2
FUNCTIONALITY DESCRIPTION AND USER MANUAL
Pine Script v6 | TradingView | Overlay indicator
================================================================================
TABLE OF CONTENTS
PART 1 - FUNCTIONALITY DESCRIPTION
1. Purpose and overview
2. Feature summary
3. How the script works (engine walkthrough)
3.1 ZigZag engine
3.2 ZigZag drawing (confirmed / unconfirmed / active legs)
3.3 Adaptive Projection engine
3.4 Leg (phase) numbering engine
3.5 Phase Statistics table engine
3.6 Table padding frame
4. Data model (internal arrays and state)
5. Repainting, timing and performance notes
PART 2 - USER MANUAL
6. Quick start
7. Setting up the phase counter (anchors) step by step
8. Settings reference (every input, by group)
9. Reading the chart
10. Reading the Phase Statistics table (every metric explained)
11. Recommended workflows
12. Troubleshooting and FAQ
13. Known limitations and behaviors worth knowing
14. Glossary
################################################################################
# PART 1 - FUNCTIONALITY DESCRIPTION
################################################################################
--------------------------------------------------------------------------------
1. PURPOSE AND OVERVIEW
--------------------------------------------------------------------------------
This indicator turns raw price action into a structured "phase" map. It:
a) Builds a ZigZag of alternating swing highs and swing lows using a single
lookback period.
b) Draws the ZigZag legs on the chart, with the two most recent legs styled
differently from the settled history.
c) Numbers each leg 1-2-3-4-5 in a repeating cycle, anchored to a pivot whose
phase number YOU verify manually (one saved anchor per timeframe).
d) Projects a two-segment "adaptive" path forward from the current price,
based on the average size, slope and direction of all past legs on the
chart.
e) Displays a Phase Statistics table with per-leg metrics: direction,
high/low, growth, bars, retracement, velocity, comparison to averages,
ATR-normalized size, ratio to the prior leg, plus Fibonacci-style
retracement and extension price targets.
Everything is driven by ONE structural setting, the ZigZag Period. Changing it
changes the pivots, the numbering, the averages behind the projection, and every
number in the table.
The indicator is an analysis/visualization tool. It does not place orders, does
not generate alerts, and does not plot any series (the script ends with
plot(na), which only satisfies TradingView's requirement of having a plot).
--------------------------------------------------------------------------------
2. FEATURE SUMMARY
--------------------------------------------------------------------------------
- ZigZag with adjustable period (10-100, default 45)
- Three leg states, each with its own line style:
Confirmed (older, settled legs)
Unconfirmed (most recent completed pivot-to-pivot leg)
Active (live leg from the latest pivot to the current price)
- Optional circle markers at both ends of the Active and Unconfirmed legs
- Adaptive Projection: 2 dotted segments (continue current leg, then reverse)
- Phase numbering 1-5, repeating, forward and backward from a user anchor
- Separate saved anchors for 1H, 4H, 1D, 1W and 1M charts
- Manual or Automatic anchor-timeframe selection
- Six numbering glyph styles
- Label placement on the pivot or at the leg midpoint
- Anchor marker (anchor symbol) showing which pivot was snapped to
- Phase Statistics table, vertical or horizontal, 1-10 legs
- 40/50/60% retracement targets and 127.2/161.8/200% extension targets, with
"reached" markers
- Three cell coloring styles for the table
- Invisible padding frame to fine-tune table position on screen
--------------------------------------------------------------------------------
3. HOW THE SCRIPT WORKS (ENGINE WALKTHROUGH)
--------------------------------------------------------------------------------
3.1 ZIGZAG ENGINE
----------------------------------------------------------------------
Pivot detection uses the ZigZag Period (N):
A bar is a pivot HIGH candidate if its high is the highest high of the
last N bars.
A bar is a pivot LOW candidate if its low is the lowest low of the last
N bars.
The current direction (dir) is +1 (up) or -1 (down). Direction flips when a bar
is a pivot high but not a pivot low (dir becomes +1) or a pivot low but not a
pivot high (dir becomes -1). If a bar is both or neither, direction is kept.
Pivot storage:
- On a direction change, a NEW pivot is added at the front of the pivot list.
- If direction has not changed and a more extreme candidate appears (a higher
high in an up move, or a lower low in a down move), the CURRENT (front)
pivot is UPDATED in place (its price, time and bar index are replaced).
- The ATR(20) value at the moment a pivot is created or updated is stored
alongside it (used later for the xATR metric).
The pivot list is stored newest-first. Index 0 is the most recent pivot (the
start of the currently forming leg), index 1 the one before it, and so on.
Because the newest pivot can keep moving while price makes new extremes, the
most recent leg is not final until a new opposite pivot forms.
3.2 ZIGZAG DRAWING
----------------------------------------------------------------------
Whenever at least two legs' worth of data exists (4+ stored values), all
ZigZag lines are deleted and redrawn from the stored pivots:
- The most recent completed leg (pivot 1 -> pivot 0 pair) uses the
"Unconfirmed Leg Style".
- All older legs use the "Confirmed Style".
- Leg color: bullish color if the leg ended higher than it started,
bearish color otherwise.
- If "Mark Unconfirmed Leg Start/End" is on, two circle markers are placed at
that leg's endpoints, in the leg's color.
The ACTIVE leg is drawn on the last bar only: a line from the latest pivot to
the current close, using the "Active Leg Style". Its color is bullish when
close is above the latest pivot's price, otherwise bearish. If "Mark Active
Leg Start/End" is on, circle markers are drawn at both ends.
All lines are positioned by bar TIME (xloc.bar_time), so they align to the
chart regardless of scrolling.
3.3 ADAPTIVE PROJECTION ENGINE
----------------------------------------------------------------------
Step 1 - Collect statistics from EVERY leg in the stored pivot history:
For each leg the script records: length ($), slope ($ per unit time), and
duration (bars). Legs are separated into bullish and bearish groups.
It then computes: average bullish/bearish length, slope and bars.
Step 2 - Describe the live leg:
current_direction : +1 if close > latest pivot price, otherwise -1
current_length : |close - latest pivot price|
current_slope : (close - latest pivot price) / time elapsed
Step 3 - Build the projection from the current price:
Segment 1 ("finish the leg"):
If the current leg is shorter than the average leg length in the same
direction, draw a line continuing at the CURRENT leg's slope until the
leg would reach the average length. Color follows the current
direction.
Segment 2 ("reversal"):
Draw a line in the OPPOSITE direction using the average length and
average slope of past legs in that opposite direction. It starts where
Segment 1 ends.
If the current leg is ALREADY as long as or longer than the average,
Segment 1 is skipped and only Segment 2 is drawn, starting at the current
price.
Safety cap: the projection never extends more than 500 bars (of the chart's
timeframe) into the future, in total.
Only the projection lines from the latest bar are kept; earlier copies are
deleted each time the script recalculates.
3.4 LEG (PHASE) NUMBERING ENGINE
----------------------------------------------------------------------
Goal: label every pivot with a phase number 1-5 in a repeating cycle that
matches a numbering YOU have verified.
Inputs: for each supported timeframe (1h, 4h, 1d, 1w, 1m) there is an anchor
date/time and a phase number (1-5).
Selecting the active anchor:
- Manual mode: the "Anchor Timeframe (Manual)" dropdown decides which saved
anchor is used.
- Automatic mode: the script detects the chart's timeframe (must be exactly
60m, 240m, 1D, 1W or 1M) and uses that timeframe's saved anchor. On any
other timeframe there is no saved anchor and the counter stays silent.
The counter DISPLAYS only when the chart timeframe actually matches the active
anchor timeframe (tf_matches). Otherwise labels and anchor marker are hidden,
keeping other timeframes uncluttered.
Seeding (runs once, on the last bar, when at least 4 pivot values exist):
1. The script finds the stored pivot whose timestamp is closest to the anchor
date/time you entered ("snap to nearest pivot"). The newest pivot (the one
still forming) is excluded from this search.
2. That pivot receives the phase number you entered.
3. Pivots NEWER than the anchor count up (…, n, n+1, …, wrapping 5 -> 1).
Pivots OLDER than the anchor count down (…, n-1, n-2, …, wrapping 1 -> 5).
4. The result is stored in three parallel lists: bar time, price, number.
Auto-extension: after seeding, each time a new pivot becomes frozen (a newer
opposite pivot forms), the next number in the cycle is appended automatically.
You do not need to renumber by hand as the chart advances.
Label placement: each label is drawn on the last bar.
- "Pivot": label sits on the pivot itself.
- "Leg Midpoint": label sits halfway (in time and price) between that pivot
and the next numbered pivot. The newest label uses the live current price
as its far endpoint, so it drifts until the leg is confirmed.
Label colors: with Auto-Color on, the label text uses bullish or bearish color
according to whether the next pivot's price is higher or lower than this
pivot's price; the background is the same color faded by the Fade %. With
Auto-Color off, custom background and text colors are used.
Anchor marker: an anchor-symbol label is placed above (if the anchor pivot was
a high) or below (if a low) the anchor pivot, offset by 2x ATR(20). It shows
the anchor's phase number and timeframe, for example "anchor 5 1d".
3.5 PHASE STATISTICS TABLE ENGINE
----------------------------------------------------------------------
The table is rebuilt on the last bar. Legs shown = Active + Previous
(Unconfirmed) + (Legs Shown - 2) older confirmed legs, up to 10 total.
Each leg is a column (Vertical orientation) or a row (Horizontal). Column order
left to right (Vertical): oldest historical leg ... newest historical leg,
Previous (Unconfirmed), Active (Projected).
Per-leg metric sources:
- Historical legs: computed from fixed pivot-to-pivot data.
- Previous leg: computed from the leg's pivot window through the current
bar, plus live retracement information.
- Active leg: computed from the latest pivot through the current bar.
Full definitions of every metric are in Section 10.
Cell coloring is controlled by "Value Cell Style":
- White: flat background, flat text.
- Tendency Color: text colored by the leg's direction.
- Tendency Background: the cell background colored by direction with a flat
text color on top.
On the Rtd and Ext target rows, the direction color is INVERTED (a bullish leg's
targets are drawn in the bearish color and vice versa), because those targets
are prices price would reach by moving against (retracing) or beyond (extending)
the leg.
3.6 TABLE PADDING FRAME
----------------------------------------------------------------------
The table has an extra outer row above and below, and an extra column left and
right of the real content. Each of these four padding areas is a single merged,
fully transparent cell. Their sizes are user inputs (0-100). Since the table is
anchored to a chart edge or corner, growing a padding cell shifts the visible
content away from that anchor, giving fine position control beyond the nine
presets.
--------------------------------------------------------------------------------
4. DATA MODEL (INTERNAL ARRAYS AND STATE)
--------------------------------------------------------------------------------
z Pivot list, newest first, stored as pairs: . Index 0 = newest pivot price, index 1 = its time.
zbar Pivot bar indices, newest first.
zatr ATR(20) captured at each pivot, newest first.
leg_bar_arr / leg_price_arr / leg_num_arr
Numbered pivots, OLDEST first (opposite order from z). Filled at
seeding and extended as pivots freeze.
seeded true once the counter has been seeded.
last_recorded_bar bar index of the last pivot already numbered.
last_assigned_num the phase number given to that pivot.
anchor_*_saved memory of which pivot was snapped to (for the marker).
avg_bullish_length, avg_bearish_length
avg_bullish_slope, avg_bearish_slope
avg_bullish_bars, avg_bearish_bars
Averages used by both the projection and the table's
"vs Avg" metrics.
Drawing object pools (lines, labels, table) are kept in persistent
variables and deleted/recreated so old objects never pile up.
--------------------------------------------------------------------------------
5. REPAINTING, TIMING AND PERFORMANCE NOTES
--------------------------------------------------------------------------------
- The newest ZigZag pivot repaints by design: it moves as price makes new
extremes in the current direction. The most recent completed leg is
therefore labeled "Unconfirmed".
- Older pivots do not change unless you change the ZigZag Period.
- Labels, the projection, the table, the active leg and the anchor marker are
only (re)drawn on the last bar of the chart, so they update on each new
tick/bar of the latest candle.
- The script is limited to 500 lines and 500 labels. With very small ZigZag
Periods on long histories, the oldest legs may be dropped by TradingView.
- The projection average is calculated over the whole stored pivot history
each time a pivot is added, so it adapts as more legs form.
################################################################################
# PART 2 - USER MANUAL
################################################################################
--------------------------------------------------------------------------------
6. QUICK START
--------------------------------------------------------------------------------
1. Add the indicator to a chart on one of the supported timeframes:
1H, 4H, 1D, 1W or 1M.
2. Open Settings. Leave ZigZag Period at 45 for a first look.
3. Under "Leg Numbering", set "Anchor Timeframe Selection" to Automatic (so
the right saved anchor is used per chart), or leave Manual and pick the
matching timeframe.
4. Set the anchor date/time (Pivot anchor) and phase number for that
timeframe (see Section 7).
5. Look at the chart: ZigZag legs, numbered labels, a dotted projection from
the current price, and the Phase Statistics table at the bottom left.
6. Adjust colors, sizes and table position to taste.
If you see legs and the table but NO numbers, the chart timeframe does not
match the active anchor timeframe (see Troubleshooting, Q1).
--------------------------------------------------------------------------------
7. SETTING UP THE PHASE COUNTER (ANCHORS) STEP BY STEP
--------------------------------------------------------------------------------
The counter needs one reliable reference: "this specific pivot is phase N".
1. Decide which pivot you consider a known phase, based on your own analysis.
2. Note its date and time on that timeframe's chart.
3. In the "Leg Numbering" group, find the row for that timeframe, for
example "Pivot (1D)".
4. Enter the pivot's date/time in the date field.
5. Enter its phase number (1-5) in the small numeric box on the same row.
6. Make sure the active timeframe (Manual pick or Automatic detection) equals
the chart timeframe.
7. Enable "Mark Anchor Pivot". An anchor marker should appear above or below
a pivot. Verify it sits on the pivot you intended.
8. If the marker is on the wrong pivot, adjust the date/time to sit closer to
the intended pivot. The script always snaps to the NEAREST pivot in time.
Tips:
- The anchor only needs to be near the pivot in time, not exact to the bar,
but if two pivots are close together, be precise.
- Re-check the anchor if you change the ZigZag Period: a different Period may
produce different pivots, so the snapped pivot can change.
- Each timeframe keeps its own anchor. Setting the 1D anchor does not affect
the 4H anchor.
- The anchor pivot must exist in the loaded chart history. If you scroll too
little history or use a very large Period, the anchor pivot might not
exist, and the snap will pick the nearest one that does.
--------------------------------------------------------------------------------
8. SETTINGS REFERENCE (EVERY INPUT, BY GROUP)
--------------------------------------------------------------------------------
GROUP: Phases (ZigZag)
----------------------
Period (10-100, default 45)
ZigZag lookback in bars. Higher = fewer, larger, later-confirming legs.
Lower = more, smaller, faster legs. Drives everything else.
Bullish Leg / Bearish Leg (colors)
Colors for upward / downward legs, including the active leg and its
markers.
Confirmed Style (Solid/Dashed/Dotted) and Width (1-8)
Style for settled older legs. Width applies to ALL legs.
Active Leg Style (default Dotted)
Style of the live leg to the current price.
Unconfirmed Leg Style (default Dashed)
Style of the most recent completed leg.
Mark Active Leg Start/End + size (Tiny..Huge)
Circle markers at both ends of the Active leg.
Mark Unconfirmed Leg Start/End + size (Tiny..Huge)
Circle markers at both ends of the Unconfirmed leg.
GROUP: Adaptive Projection
--------------------------
Show Projection
Master switch for the two projection segments.
Bullish Projection / Bearish Projection (colors)
Colors for upward / downward projection segments.
Style and Width (1-5)
Line style and width for both segments (default Dotted, width 1).
GROUP: Leg Numbering
--------------------
Pivot (1H / 4H / 1D / 1W / 1M) - date/time + phase number (1-5)
The five saved anchors. Only the active timeframe's anchor is used.
Anchor Timeframe Selection (Manual / Automatic)
Manual: uses the dropdown below regardless of the chart.
Automatic: uses the chart's own timeframe (1h/4h/1d/1w/1m only).
Anchor Timeframe (Manual)
Which saved anchor to use in Manual mode. The counter displays only when
the chart is on this timeframe.
Mark Anchor Pivot
Shows the anchor marker on the snapped pivot.
Numbering Style
Glyph set for phase numbers: circled, filled circled, Roman numerals,
keycap emoji, subscript parentheses, or parenthesized. Rendering varies
by OS/browser/font.
Label Size (Tiny..Huge, default Huge)
Size of the number labels on the chart (not the table).
Auto-Color by Leg Direction
On: labels use the Bullish/Bearish Label colors below.
Off: labels use the custom colors below.
Bullish Label Color / Bearish Label Color
Also the bullish/bearish colors used throughout the Phase Statistics
table (tendency text, tendency background lookup, inverted target rows).
Custom Label Background Color / Custom Label Text Color
Used only when Auto-Color is off.
Label Background Fade % (0-100, default 90)
0 = opaque background, 100 = fully transparent (only the glyph shows).
Overrides any transparency of the picked colors.
Label Position (Pivot / Leg Midpoint, default Leg Midpoint)
Where each number sits relative to its leg.
GROUP: Phase Statistics Table
-----------------------------
Show Table
Master switch. Table appears once at least two pivots exist.
Orientation (Vertical / Horizontal)
Vertical: legs are columns, metrics are rows.
Horizontal: legs are rows, metrics are columns.
Position (nine presets)
Chart corner/edge anchor. Default Bottom Left.
Text Size (Tiny..Huge)
Table text. Single-line leg headers are always Normal size; the
Unconfirmed/Projected two-line headers follow this setting.
Header Background / Header Text
Colors for title bar, corner cell, leg headers and metric labels.
Cell Background / Cell Text
Value-cell colors for the White style, and the fallback otherwise.
Value Cell Style (White / Tendency Color / Tendency Background)
How value cells are colored (see Section 3.5).
Tendency BG: Bullish / Bearish / Text Color
Used only with the Tendency Background style.
Border Color
Grid line color. Use a transparent color for a borderless table.
Retracement Bar Glyphs
Four filled/empty glyph pairs for the 10-segment retracement bar.
Show Retracement Progress Bar
Adds a "Rtd %" row/column with the 10-segment bar.
Legs Shown (2-10, default 7)
Total legs displayed (Active + Previous + older).
Show Retracement % Targets
Adds Rtd 40%, 50%, 60% price targets per leg.
Mark Reached Retracement Levels + Reached Marker Glyph
Appends a marker (one of four glyphs) to a target price once price has
retraced at least that far.
Show Velocity, Show Size vs Avg, Show Bars vs Avg, Show ATR-Normalized Size
(xATR), Show Ratio to Prior Leg
Toggle the advanced metrics (Section 10).
Show Extension % Targets (127/162/200%)
Adds Ext 127%, 162%, 200% price targets per leg.
GROUP: Table Position Fine Tunning
----------------------------------
Four padding inputs (top, bottom, left, right; 0-100 each, default 0).
Adds invisible, merged, fully transparent space on that side of the
table so the visible content shifts away from its anchor corner.
Example: anchored Bottom Left, raising the bottom padding lifts the
table up; raising the left padding pushes it right.
--------------------------------------------------------------------------------
9. READING THE CHART
--------------------------------------------------------------------------------
ZigZag legs
Teal legs (default) go up; orange legs (default) go down.
Dashed = the most recent completed leg (may still shift).
Dotted = the live leg running to the current price.
Solid = older, settled legs.
Circle markers
Small circles mark the start and end of the Active and Unconfirmed legs.
Number labels
Each pivot/leg carries a 1-5 phase number. When Label Position is "Leg
Midpoint", the number sits mid-leg. The newest number drifts with price
until its leg is confirmed.
Anchor marker
Shows which pivot your anchor snapped to, with its phase number and
timeframe.
Projection
Dotted two-part line from the current price. Segment 1 = expected
continuation of the current leg to the average length; Segment 2 =
expected reversal by the average opposite-leg length and slope. It is a
statistical average of past behavior on this chart, not a forecast.
--------------------------------------------------------------------------------
10. READING THE PHASE STATISTICS TABLE (EVERY METRIC EXPLAINED)
--------------------------------------------------------------------------------
Column headers
- Historical legs: the leg's phase number (or "Leg-N" if not numbered).
- Previous leg: phase number + "Unconfirmed".
- Active leg: phase number + "Projected".
Metrics
Dir
UP or DN: the leg's direction.
High / Low
Highest and lowest price of the leg.
Historical legs: their two pivot prices.
Previous leg: highest/lowest from the older pivot through the latest bar.
Active leg: highest/lowest from the latest pivot through the latest bar.
Growth
Size of the leg in dollars (high minus low, per the definitions above).
Bars
Number of bars the leg lasted (pivot to pivot). For the Active leg, bars
since the latest pivot.
Retraced
Two lines: percent and dollars.
Historical legs: how much of that leg the NEXT (more recent) confirmed
leg gave back.
Previous leg: distance from the current close to that leg's end pivot,
relative to the confirmed leg before it.
Active leg: distance from the current close to the latest pivot, relative
to the previous leg's size.
Rtd %
A 10-segment progress bar of the retracement percentage (one segment per
10%). Optional.
Velocity
Growth divided by Bars, shown as dollars per bar.
vs Avg Size
The leg's Growth compared with the average leg of the same direction on
the chart. Signed percent: +18% means 18% larger than average.
vs Avg Bars
The leg's duration compared with the average duration of same-direction
legs. Signed percent.
xATR
Growth divided by the ATR(20) recorded at the leg's starting pivot.
Makes sizes comparable across volatility regimes (shown as "1.8x ATR").
Ratio to Prior
The leg's size divided by the size of the leg immediately before it.
Tagged with the nearest Fibonacci ratio if within tolerance, for example
"0.62x (~.618)". Recognized tags: .382, .5, .618, .786, 1.0, 1.272,
1.618, 2.0, 2.618.
Rtd 40% / 50% / 60%
Prices at 40/50/60% retracement of that leg's own range, measured from
the leg's more recent pivot back toward its older pivot. A marker is
appended if price has retraced at least that far (see Marker settings).
The Previous leg uses the live Active retracement %.
The Active column shows a dash: its own targets are not yet defined.
Ext 127% / 162% / 200%
Prices at 127.2%, 161.8% and 200% of the leg's range, projected beyond
the leg's older end in the same direction as the leg. Same marker rules;
the Active column shows a dash.
Color inversion
On Rtd and Ext rows, a bullish leg's values use the bearish color (and
vice versa), since they describe where price would go relative to the
leg's direction.
Price formatting
Prices are rounded to whole dollars with thousands separators ($12,345).
This suits high-priced assets. For assets that trade in cents or a few
dollars, the table values will look rounded/coarse (see Section 13).
--------------------------------------------------------------------------------
11. RECOMMENDED WORKFLOWS
--------------------------------------------------------------------------------
A) Multi-timeframe counting
Set Anchor Timeframe Selection to Automatic. Save an anchor for each of
1H/4H/1D/1W/1M once. Then simply switch chart timeframe; the counter
switches anchors automatically. Timeframes such as 15m or 2D show no
numbering.
B) Using the table as a checklist
Keep Legs Shown at 7. Watch the Active column for Retraced % and the Rtd
bar. Compare the Active leg's "vs Avg Size / Bars" to see if the current
move is stretched or young relative to history.
C) Target planning
Use the Previous (Unconfirmed) column for live Rtd 40/50/60 and Ext
127/162/200 prices, and the "reached" marker to see what has already been
touched.
D) Cleaner chart
Turn off marker circles and the projection; set Label Background Fade to
100 so only the glyphs show; or switch the table to Horizontal and reduce
Legs Shown.
E) Tuning the Period
Start with 45. Raise it for macro swings on lower timeframes; lower it for
more responsive legs. Re-verify your anchor afterwards.
--------------------------------------------------------------------------------
12. TROUBLESHOOTING AND FAQ
--------------------------------------------------------------------------------
Q1. I see legs and the table but no number labels or anchor marker.
The chart timeframe does not match the active anchor timeframe. In Manual
mode, set "Anchor Timeframe (Manual)" to the chart's timeframe. In
Automatic mode, use exactly 1h, 4h, 1D, 1W or 1M (60m/240m/D/W/M).
Q2. The anchor marker is on the wrong pivot.
The script snaps to the pivot nearest in time to your date/time. Move the
date/time closer to the intended pivot. If you changed the ZigZag Period,
pivots have changed; re-check.
Q3. Numbers changed after I changed the ZigZag Period.
Expected. Different Period = different pivots = different sequence. Re-set
the anchor.
Q4. The last pivot keeps moving.
Expected. The newest pivot follows price while direction persists; that is
why the latest completed leg is called Unconfirmed.
Q5. The projection has only one segment.
The current leg already meets or exceeds the average same-direction leg, so
only the reversal segment is drawn from the current price.
Q6. No projection at all.
Check "Show Projection", and make sure at least two pivots exist (a longer
history or a smaller Period).
Q7. The table does not appear.
Check "Show Table". It also requires enough pivots to exist. If the table
was moved off-screen with large padding values, reduce them.
Q8. Some legs/labels are missing on long histories.
TradingView limits this script to 500 lines and 500 labels. Increase the
Period so fewer legs are produced.
Q9. Emoji or glyphs render oddly.
Glyph rendering depends on your OS/browser/font. Try another Numbering
Style or Retracement Bar Glyph set.
Q10. Numbers on some older legs are "Leg-N" instead of a glyph.
Those older table legs have no phase number assigned, for instance when
the counter has not seeded yet.
--------------------------------------------------------------------------------
13. KNOWN LIMITATIONS AND BEHAVIORS WORTH KNOWING
--------------------------------------------------------------------------------
1. Seeding happens once, on the first last-bar calculation where enough
pivots exist. Changing a setting recalculates the script and reseeds.
2. Numbering labels are only displayed when the chart timeframe matches the
active anchor timeframe. The table's header glyphs use the numbering data
whenever it has been seeded, even if labels are hidden for a timeframe
mismatch.
3. The newest phase label always uses the bullish label color (there is no
later pivot yet to compare against for direction).
4. The Previous (Unconfirmed) column's High/Low and Growth are measured from
the older pivot through the current bar, so they can include movement
from the Active leg. Historical columns use fixed pivot-to-pivot values.
5. The Adaptive Projection is based on averages, so a few very large or very
small legs can skew it. It is a statistical tool, not a prediction.
6. Table prices are rounded to whole dollars, which suits high-priced assets
(for example Bitcoin) and can look coarse on low-priced instruments.
7. Anchors exist only for 1h, 4h, 1d, 1w and 1m. Other timeframes have no
saved anchor and no numbering.
8. No alerts are provided.
9. Because the pivot direction logic uses one lookback in both directions,
a bar that is simultaneously the highest high and lowest low of the window
(an extreme outside bar) does not change direction.
--------------------------------------------------------------------------------
14. GLOSSARY
--------------------------------------------------------------------------------
Active leg Live line from the latest pivot to the current price.
Anchor A pivot you nominate as having a known phase number.
ATR(20) Average True Range over 20 bars, used for volatility scaling.
Confirmed leg A settled older leg that no longer changes.
Extension A price projected beyond a leg's range in its own direction.
Leg The move between two consecutive ZigZag pivots.
Phase The repeating 1-2-3-4-5 label given to each leg.
Pivot A swing high or low detected by the ZigZag Period.
Retracement The fraction of a leg that the following move gives back.
Snap Choosing the stored pivot closest in time to your anchor
date/time.
Unconfirmed leg The most recent completed leg, whose end pivot may still move.
ZigZag Period The lookback (in bars) that decides what counts as a pivot.
================================================================================
END OF DOCUMENT
================================================================================ אינדיקטור

MACD Momentum StructureMACD Momentum Structure
MACD Momentum Structure transforms the traditional MACD into a visual momentum framework designed to make changes in market momentum easier to interpret.
Instead of relying only on the conventional MACD histogram and signal-line crossover, the script organizes momentum into a dynamic visual structure that highlights how momentum develops, expands, slows, and transitions.
What It Shows
Momentum Wave
A smoothed representation of MACD that makes the underlying momentum structure easier to follow.
Momentum Phases
The indicator identifies different stages of momentum development, including:
* Bullish Acceleration
* Bullish Expansion
* Bullish Deceleration
* Bearish Acceleration
* Bearish Expansion
* Bearish Deceleration
* Transition
These phases help visualize whether momentum is strengthening, continuing, weakening, or transitioning.
Momentum Turning Points
Confirmed swing points are highlighted on the momentum wave to make important changes in momentum structure easier to identify.
Momentum Flow
A visual flow element extends the current momentum direction to illustrate the potential continuation path of the current momentum structure. This is a visual aid, not a prediction or guarantee of future price movement.
Momentum Divergence
The indicator can highlight potential bullish and bearish divergence between price structure and MACD momentum, helping identify situations where price movement and underlying momentum may be developing differently.
MACD Structure
The traditional MACD, signal line, histogram, and zero-line relationship remain visible, while the additional visual structure provides greater context around those familiar signals.
How to Read It
The visual structure can be interpreted as a sequence of momentum development:
Acceleration → Expansion → Deceleration → Transition
Strong acceleration and expansion indicate increasing momentum, while deceleration can indicate that the current momentum is losing strength. A transition phase highlights a change in the relationship between momentum and its signal structure.
The purpose is not to predict the market with certainty, but to make momentum behavior more visible and easier to analyze.
Important Note
This indicator is a visual analytical tool based on MACD calculations and momentum structure. Turning points and divergence signals are confirmed using historical data and may appear with a delay.
It does not provide guaranteed future price predictions, entry signals, or trading results.
Use it together with price action, market structure, volatility, and other forms of technical analysis as part of a broader trading process.
אינדיקטור

אינדיקטור

First-Hour ImbalanceConcept
The First-Hour Imbalance is the high/low range established during the first hour of a trading session. That opening hour is where institutional order flow is heaviest — it sets the auction's initial balance. Once that range is complete, its high, low, and 50% midpoint become the session's reference levels. Price breaking and sweeping those levels is the trade signal.
The indicator automates the full lifecycle: capture → freeze → persist → signal.
Session Definitions
Four sessions, each with its own color and independent state machine:
Session Window (chart time) Color Notes
Asia 20:00 – 21:00 🟡 Yellow Tokyo open
London 02:00 – 03:00 🟢 Teal London open
NY AM 09:30 – 10:30 ET 🟠 Orange True equity open — intentionally diverges from the 08:30 start used in Liquidity Sweep PRO
NY PM 13:30 – 14:30 ET 🟣 Magenta Afternoon session
What It Draws
For each session, three horizontal lines anchored at the session's first hour and extended rightward:
Line Meaning
High IB Highest high of the first hour
50% Midpoint of the range (dashed) — the equilibrium / premium-discount divider
Low IB Lowest low of the first hour
Lines persist through the rest of the session and beyond — they don't vanish when the capture window closes. Each line is labeled at its right end.
State Machine
Each session runs its own four-state cycle:
ST_IDLE → ST_CAPTURING → ST_FROZEN → ST_DONE
ST_IDLE — outside the session window, no range yet
ST_CAPTURING — inside the first hour; high/low expanding bar by bar
ST_FROZEN — first hour closed; range locked, three lines drawn
ST_DONE — sweep detected, signal fired, lines persist to session end
Signal Logic — Definition A Sweep
The signal fires when price breaks the range boundary and then sweeps it:
SHORT signal — price wicks above High IB (liquidity grab above the range), then closes back below → Direction: SHORT
LONG signal — price wicks below Low IB, then closes back above → Direction: LONG
The sweep is the trap: stops sitting just beyond the range high/low get taken, and the reversal is the trade. A SHORT / LONG label is drawn at the signal bar.
Dashboard
A table in the top-right corner displays the live state:
Field Description
Session Currently active session (Asia / London / NY AM / NY PM)
Direction Current signal direction — SHORT, LONG, or WAIT
Last Signal Signal type — e.g. High IB Sweep
Signal Price Exact price level where the sweep occurred
Signal Time Bar time of the signal
Worked Example — London Session
Chart: HTX:BTCUSDT25U2026 · 2-minute
1. Capture (02:00 – 03:00) The first hour of London trades between:
High IB = 81,117
Low IB = 80,000
50% = 81,000 (derived)
2. Freeze (03:00) The hour closes. Range locks. Three lines draw at 81,117 / 81,000 / 80,000, extending rightward.
3. Sweep (03:08) Price wicks above 81,117 — taking out buy-side liquidity sitting above the range high — then closes back below.
4. Signal fires
Session: London
Direction: SHORT ← rendered in red
Last Signal: High IB Sweep
Signal Price: 81117.0
Signal Time: 03:08
A red SHORT label is drawn at the 03:08 bar, anchored to the High IB line.
5. Interpretation The wick above 81,117 was a liquidity grab. Price failed to hold above the range high, signalling sellers defending that level. The trade thesis: short the failed breakout, target the 50% midpoint (81,000), then the Low IB (80,000).
Reading the Levels
Scenario Interpretation
Price holds above High IB Bullish acceptance — range high becomes support; look for continuation
Price sweeps above High IB then rejects Bearish — liquidity taken, expect rotation back into range
Price holds above 50% Premium — sellers have the edge; longs need discount
Price holds below 50% Discount — buyers have the edge; shorts are chasing
Price sweeps below Low IB then reclaims Bullish — sell-side liquidity taken, expect rotation up
Price holds below Low IB Bearish acceptance — range low becomes resistance
The 50% line is the bias divider: above = premium (favour shorts), below = discount (favour longs).
Technical Notes
Pine v6, Midniteblade
max_bars_back history buffers declared on reassigned series variables (volSeries, hlc3Series, closeSeries, openSeries) — required because Pine keys history buffers to the specific series referenced, not the built-in name
Dynamic indexing inside the capture loop uses those reassigned variables, not the built-ins
max_lines_count / max_labels_count sized for four sessions × three lines × labels across the visible history
Lines anchored at the freeze bar, extended rightward, persisting through session end
Why It Works
The first hour of a session is where the day's initial auction resolves. Once that range is set, it becomes the map: the high and low are where stops cluster, and the 50% is where the market decides premium vs discount. The indicator doesn't predict direction — it marks the levels where liquidity sits, then tells you when that liquidity gets taken.
The sweep signal is the payoff: a break of the range that fails is far more informative than a break that holds. אינדיקטור

C-PowerIndicator "C-Power" (candle buy/sell power) and is designed to dynamically measure and display the buying power (Buyers) and selling power (Sellers) over a specific period.
Simply put: the script analyzes recent candles and displays a small label on your chart showing who currently holds the upper hand in the market, along with their respective percentages.
How the Script Works (Step-by-Step)
1. Volume Filtering:
- The script retrieves market volume and smooths it using an ALMA (Arnaud Legoux Moving Average) over a selected period (5 candles by default).
- It protects the chart from anomalies – if an abrupt, massive volume spike occurs (over 3.5 times the average), the script "caps" it so that a single outlier does not distort the overall result.
2. Gap Protection:
- Instead of using just the raw highs and lows of the current candle, the script compares them with the closing price of the previous candle (prev_close). This ensures that price gaps are factored into the market's true momentum.
3. Garman-Klass Volatility Calculation (GK Volatility):
- This is the mathematical core of the script. It utilizes the advanced Garman-Klass formula, which measures market volatility based on the relationship between the open, high, low, and close prices.
- The result is further smoothed by the ALMA filter, delivering a highly stable representation of market volatility that is resilient against market noise.
4. Z-Score and Probability Estimation (Statistics):
- The script measures where the current price sits relative to the candle's midpoint and divides this by the calculated volatility. This creates a statistical value known as a Z-score.
- Using a built-in Cumulative Distribution Function for a normal distribution (normCDF via the error function erf), the script converts this score into a directional weight between 0 and 1. This weight represents the statistical probability of whether the move is inherently bullish or bearish.
5. Determining Final Power (Buy/Sell Power):
- If trading volume data is available for the asset, the script multiplies the volume by this calculated statistical weight.
- If volume data is unavailable (e.g., on certain indices or Forex pairs), the script relies entirely on the mathematical structure of the price action itself (hence the dynamic text update to GK Price).
- These accumulated values over the specified period (e.g., 5 candles) are then converted into percentages (e.g., BUY: 65.0% / SELL: 35.0%).
6. Chart Visualization:
- A text label is generated on the right side of the chart, shifted forward by a user-defined offset (3 candles by default).
- This label smoothly changes color (gradient) depending on who is dominating the market. If buyers have the upper hand, the label turns green (or your custom bullish color). If sellers take control, it turns red. It remains gray when the market is in balance.
Key Advantages of This Script:
- Versatility: It functions seamlessly both on markets with volume data (crypto, stocks) and markets without it (forex).
- Statistical Framework: Rather than guessing a trend based on simple logic like "the price is going up, so buy," it evaluates mathematical probability and volatility.
Conclusion – Overall, this is a dynamic indicator that utilizes mathematical estimations (Garman-Klass volatility, statistical Z-score, and probability distribution) to estimate the power of buyers and sellers over a selected candle lookback period.Typically, similar indicators fetch data from lower timeframes and rely on a simple logic: a red candle means a drop where sellers won, while a green candle means a rise where buyers won. They then simply aggregate the data and determine the buy/sell power based on the ratio of bullish to bearish candles.This indicator, however, attempts to reconstruct those same relationships mathematically on a single timeframe.Soon, I will release an oscillator that will serve as a historical complement to this indicator. אינדיקטור

Open Space (PAID HTF)this indicator marks out two things at once: open space boxes on your selected timeframe, and fair value gaps one timeframe below it.
the idea is simple. higher timeframe open space shows you where price has room to move. the lower timeframe fair value gaps show you the imbalances inside that space. you get the bigger picture and the finer detail on the same chart without having to flip back and forth.
how the timeframe pairing works
you pick one timeframe. the indicator handles the rest.
1 month open space → 1 week fair value gaps
1 week → 1 day
1 day → 4 hour
4 hour → 2 hour
2 hour → 1 hour
1 hour → 15 min
so if you select 4 hour, you get 4 hour open space and 2 hour fair value gaps together. there's an override in settings if you want to break the pairing, but it runs on auto by default.
no overlapping boxes
overlapping boxes on the same layer get merged into one. if a fair value gap sits fully inside an open space box, it gets dropped since it doesn't add anything there. partial overlaps get trimmed so you only see the part that matters. the chart stays clean.
price anchored
every box is locked to actual price values and actual bar times. zoom in, zoom out, drag the chart around, the levels stay where they belong.
settings
separate color, opacity, and border controls for each layer so you can tell open space from fair value gaps at a glance. timeframe selector with auto pairing or manual override.
how i use it
levels first, entries second. these boxes are where i mark my zones, not where i take blind entries. i want price to react at the level and confirm before i do anything. open space tells me where there's room. the fair value gaps tell me where the imbalance sits inside it. confirmation still comes from structure and the actual reaction at the level.
this is not a signal indicator. it doesn't tell you to buy or sell. it marks levels so you can build your own plan around them. אינדיקטור

High Tight Flag [DJYYLAB]OVERVIEW
Finds high tight flags: a stock doubles within a few weeks, then pauses in a tight range just under the high. The indicator draws the pole and the flag and keeps track of what happens after each one forms: a breakout, a quick drop back under the top, invalidation, or no breakout in time. All thresholds are listed below, so every result can be checked by hand.
Everything is calculated on closed bars. A flag shows up on the bar where it is first confirmed, and its box then grows with each new bar until the flag ends.
HOW IT WORKS
1. Pole
- The pole top is the highest point of the whole pattern: no bar from the pole low up to it reaches it, and nothing after it trades above it until the breakout.
- The pole low is the lowest low of the 40 bars before the pole top.
- From the pole low to the pole top: a gain of at least 100%, taking 3 to 40 bars (40 bars is 8 weeks on a daily chart). The 3-bar minimum keeps out jumps of a day or two.
- Volume surges in the pole: the biggest pole bar has at least 1.3x the average volume of the 5 bars before the pole (skipped when the chart has fewer than 5 bars before it).
2. Flag
- Every bar after the pole top. The flag is 10 to 25 bars long.
- The flag low stays within 25% of the pole top.
- Volume dries up: the flag's average volume is at most 0.75x the pole's.
- No rule on the flag's shape. It can drift down, move sideways or narrow.
The flag forms on the first bar where all of the above is true, at the earliest 10 bars after the pole top.
3. After it forms (breakout level = pole top)
- Breakout: the first bar that trades above the pole top. The breakout price is the pole top, or the open if the bar opened above it.
- Back below in 5 bars: after a breakout, a close at or under the pole top within 5 bars.
- Invalidated: trading more than 25% under the pole top before a breakout.
- Expired: more than 25 flag bars without a breakout.
- A bar that trades both above the top and more than 25% under it counts on the side nearer to its open.
ON THE CHART
- The pole: a line from the pole low to the pole top.
- The flag: a box from the pole top level down to the flag low, from the pole top to the latest bar. It ends on the breakout bar. The bottom of the box moves down when the flag makes a new low, so the flag's candles always stay inside it.
- Purple = waiting, green label = broke out, orange label = back below in 5 bars, grey = invalidated or expired (the box is cut on that bar).
- On a breakout: a triangle under the bar and a dotted measured move. The measured move is half the pole height added to the flag low.
- Hover the "High Tight Flag" label for the pole dates, prices, length and gain, the flag length, depth and volume, the result, the breakout price and its volume against the 50-bar average, the measured move, and the move 5, 10 and 20 bars after the breakout.
- Alerts: "High tight flag formed", "Near the top" (close within 3% under the pole top), "High tight flag breakout" (price trades above the pole top).
SETTINGS AND TIMEFRAMES
- Pole length, pole gain, pole volume, flag length, flag depth, flag volume, the failure window and the number of flags kept on the chart (6 by default, up to 20) can all be changed.
- Works on any timeframe. Lengths are in bars, so on a weekly chart the pole can take up to 40 weeks.
- Volume rules are skipped on symbols without volume.
- On stocks, keep dividend adjustment (ADJ) on so ex-dividend gaps don't look like price moves.
ORIGINALITY
Written from scratch, no code taken from other scripts. The breakout level is the highest point of the pattern, not a sloping line over the flag, and the flag has to hold within 25% of that high for 10 to 25 bars. Every flag is followed after it forms, and the box always holds the flag's candles.
------------------------------------------------------------
日本語
概要
ハイ・タイト・フラッグ(数週間で株価がおよそ2倍になり、その高値のすぐ下で狭い範囲の横ばいになる形)を検出するインジケーターです。ポールとフラッグを描き、形成後にどうなったか(ブレイク、すぐにポールの頂上の下へ戻った、失効、期限切れ)まで追いかけます。しきい値はすべて下に書いてあるので、結果を自分で確かめられます。
計算はすべて確定足で行います。フラッグは初めて確定した足に表示され、その後はフラッグが終わるまで新しい足ごとに箱が伸びていきます。
判定ルール
1. ポール
- ポールの頂上はパターン全体の最高値です。ポールの安値から頂上までの間にこれに届く足はなく、頂上のあとブレイクまでこれを上回る足もありません。
- ポールの安値は、頂上より前の40本の中の最安値です。
- ポールの安値から頂上まで100%以上の上昇で、かかる本数は3〜40本(日足なら40本で8週間)。3本以上とするのは、1〜2日の急騰を除くためです。
- ポールで出来高が増えること:ポール内で最大の出来高が、ポールが始まる前の5本の平均の1.3倍以上(その前に5本ない場合はこの条件を使いません)。
2. フラッグ
- ポールの頂上のあとのすべての足。長さは10〜25本。
- フラッグの安値はポールの頂上から25%以内。
- 出来高が細ること:フラッグの平均出来高がポールの平均の0.75倍以下。
- 形の条件はありません。下向き、横ばい、収束のどれでもかまいません。
すべてを満たした最初の足でフラッグが形成されます(早くてもポールの頂上の10本後)。
3. 形成後(ブレイクの水準=ポールの頂上)
- ブレイク:ポールの頂上を初めて上回った足。ブレイク価格はポールの頂上(その足が頂上より上で寄り付いた場合は始値)。
- 5本以内に戻る:ブレイク後5本以内に終値がポールの頂上以下になる。
- 失効:ブレイク前にポールの頂上から25%を超えて下げる。
- 期限切れ:フラッグが25本を超えてもブレイクしない。
- 1本の足が頂上の上と25%下の両方に届いた場合は、始値に近い側として数えます。
チャート表示
- ポール:安値から頂上までの1本の線。
- フラッグ:ポールの頂上の水準からフラッグの安値までの箱。頂上から最新の足まで伸び、ブレイクした足で終わります。フラッグが安値を更新すると箱の下辺も下がるので、フラッグのローソク足は常に箱の中に収まります。
- 紫=ブレイク待ち、緑のラベル=ブレイク、オレンジのラベル=5本以内に戻る、グレー=失効または期限切れ(箱はその足で切れます)。
- ブレイク時:足の下に三角と、点線の値幅目標。値幅目標はポールの高さの半分をフラッグの安値に足したものです。
- 「High Tight Flag」ラベルにカーソルを合わせると、ポールの日付・価格・本数・上昇率、フラッグの本数・深さ・出来高、結果、ブレイク価格とその出来高(直前50本の平均との比)、値幅目標、ブレイク後5・10・20本の値動きが表示されます。
- アラート:「High tight flag formed」「Near the top」(終値がポールの頂上の下3%以内)「High tight flag breakout」(ポールの頂上を上回る)。
設定と時間足
- ポールの本数・上昇率・出来高、フラッグの本数・深さ・出来高、「5本以内に戻る」の本数、チャートに残すフラッグの数(初期値6、最大20)は変更できます。
- どの時間足でも使えます。長さは本数なので、週足ならポールは最大40週になります。
- 出来高のない銘柄では出来高のルールは使いません。
- 株式では配当調整(ADJ)をオンにしてください。権利落ちの窓が値動きに見えるのを防げます。
独自性
他のスクリプトのコードは使わず、一から書いています。ブレイクの水準はフラッグの上の斜めの線ではなくパターンの最高値で、フラッグはその高値から25%以内で10〜25本持ちこたえる必要があります。形成後の経過まで追いかけ、箱は常にフラッグのローソク足を収めます。 אינדיקטור

Volatility# Volatility — Body vs. Wick Decomposition
**Every standard volatility tool collapses a candle into one number. That number throws away the
only thing you actually needed to know: whether the range was earned or rejected.**
ATR tells you a bar was 12 points. It cannot tell you whether that was a 12-point body driving t
hrough offers, or a 1-point body with 11 points of wick where price went there and got slammed b
ack. Those two bars have identical ATR. They are opposite trades.
This indicator refuses to average them together.
---
## What it does
**Two independent histograms, volume-style.**
- **Bodies** plot up from zero — the portion of the range that *held*. Committed movement. What
actually printed a close somewhere new.
- **Wicks** plot down from zero — the portion that was *rejected*. Price went, and price came ba
ck. Failed exploration.
Each histogram has its own rolling average and its own spike threshold. A wick spike and a body
spike are different events, and the indicator scores them separately instead of blending them in
to one meaningless mean.
That separation is the whole idea. Range is not a single quantity — it is two opposing forces th
at happen to share a bar.
---
## How to read it
**Tall bodies, short wicks** — trend. The range is being converted into progress. Continuation s
etups work, mean-reversion gets ru
**Short bodies, long wicks** — a fut nobody keeps it. Fades work, brea
kouts fail. This is the state that looks identical to a trend on ATR and costs people money.
**Both compressing** — a coil. Genuine low volatility, not just quiet direction. Expansion pendi
ng.
**Wick spike with no body spike** e tried, got rejected, and the tape
told you so in real time.
**Body share of range** (in the readout) is the single cleanest number here. High share = convic
tion. Low share = indecision. Watc
Split the wick histogram into **upich side* is doing the rejecting. A
run of long upper wicks under a flat high is supply, plainly drawn.
---
## The average candle
On the price pane, the indicator draws a single synthetic candle built from the lookback: averag
e body, average upper wick, averagd separately and drawn to scale.
Crucially, the body is the **net s− open`, not the absolute average. T
his matters more than it sounds:
- In a **trend**, the moves don't cancel — you get a tall body pointing the way the market is ac
tually going.
- In **consolidation**, up and down bars cancel each other out and the body **collapses to a stu
b**, with the wicks left standing
An absolute average can't do that. body in pure chop, because it has d
iscarded the sign. Here, the shape of the average candle *is* the market regime — you read it th
e same way you read any candle, be
Switch to `Body represents: Absolulassic reading where body + wicks eq
uals the average range.
---
## Settings
**Average over** — `Candles` for a fixed bar count (default 50), or `Time` for a clock window co
nverted to bars on your timeframe.urrent leg; long windows describe th
e session's character. A very long window on a fast chart will read flat by design, because that
is the truth about a long window.
**Layout** — `Mirrored` for two ind a zero line, or `Stacked` for one
range column with the body solid inside it, preserving body + wick = range.
**Color mode** — `Above/below average` (default), `Up/down candle` for classic direction tinting
, or `Flat`.
**Spike threshold** — multiple of drawn as a step line on both.
**Avg candle** — position, width, r the body reads net or absolute.
Every color is exposed.
---
## Honest limitations
- Mirrored mode auto-scales to whiwicks routinely dwarf bodies on your
instrument, the body histogram will look compressed — use Stacked.
- The average candle is anchored iight of price, so it drifts closer a
s you zoom out. Adjust the offset.
- Wicks are measured to the extrem will distort a short lookback. That
is a feature when you want to see it and a nuisance when you don't.
---
## Why bother
Volatility is not one number. It is a *composition*. A market can be loud and going nowhere, or
quiet and going somewhere, and thet distinguish those cases because th
e information is destroyed before it reaches you.
This puts the composition back on the chart. אינדיקטור

COT Index - Commercial Positioning (Weekly)Overview
This indicator helps futures traders identify relative Commercial Trader positioning extremes using weekly Commitment of Traders (COT) data from the CFTC.
How It Works
The script calculates Commercial Net Position each week:
Commercial Net Position = Commercial Long - Commercial Short
It then normalizes this value against its own recent history over a configurable lookback period:
COT Index = 100 * (Net Position - Lowest Net Position) / (Highest Net Position - Lowest Net Position)
This shows where current Commercial positioning stands relative to its own recent range, rather than looking at absolute long/short numbers in isolation.
The script runs its core calculation on a fixed Weekly timeframe internally, regardless of the chart timeframe it's added to — so it stays useful on daily, 4H, 1H and intraday charts while still showing correct weekly positioning context. COT data is requested with lookahead disabled, so the indicator does not repaint.
Default Settings
Lookback period: 26 weeks
Upper threshold: 75
Lower threshold: 25
Neutral midpoint: 50
All adjustable in the script's Settings.
Interpretation
A high COT Index indicates Commercial Traders are positioned relatively bullish compared to their own recent history.
A low COT Index indicates Commercial Traders are positioned relatively bearish compared to their own recent history.
Readings above the upper threshold (default 75) may indicate elevated Commercial positioning.
Readings below the lower threshold (default 25) may indicate depressed Commercial positioning.
Typical Use Cases
Identify relative Commercial positioning extremes
Add COT context to futures swing trades
Compare positioning across different futures markets
Combine COT data with seasonality, price structure, trend and market regime analysis
Support commodity research and trade planning
Limitations
COT data is weekly and delayed: the report reflects positions as of Tuesday and is usually published the following Friday. This indicator is not designed for intraday timing and is not a standalone trading system. Extreme COT readings are not automatic reversal signals. Commercial positioning can remain elevated or depressed for extended periods, especially in strong trending markets. Past positioning patterns do not guarantee future price behavior.
Symbol Support
Designed for futures and continuous futures charts. Some micro contracts, CFDs, broker-specific symbols or otherwise unsupported markets may not return valid COT data.
Originality
COT data retrieval uses the public TradingView "LibraryCOT" community library. The Commercial Net Position calculation, the lookback-based normalization into a 0-100 COT Index, the configurable thresholds, and the visualization are original to this script.
For educational and research purposes only. This is not financial advice. אינדיקטור

Relative Volume TiersVolume bars that change colour when volume is unusual: grey is normal, orange is high, magenta is extreme. Each bar is compared with the normal volume for that time of day over the last 20 sessions, so the open and close don't get coloured every day just for being busy. I use it to see whether a move has real volume behind it. It works from 5 second charts up, and the thresholds adjust to the timeframe automatically.
This is a volume indicator that looks like the regular volume bars, but each bar is coloured by how unusual its volume is. I made it to check whether a move on the chart has real participation behind it or is happening on thin volume.
How it works
Every bar is compared to a baseline, which is the volume you would normally expect for that bar. The bar then gets one of three colours (all adjustable):
- Gray: normal volume
- Orange: high volume, above the High multiplier times the baseline
- Magenta: extreme volume, above the Extreme multiplier times the baseline
The baseline
On intraday charts the baseline is based on time of day. A bar at 9:35 is compared with the 9:35 bars of the previous 20 sessions, not with the bars right before it. Without this the open, the close and news times would get coloured every day just because they are always busy, and the quiet midday hours would never get coloured at all. This way a bar is only coloured when its volume is unusual for that time of day.
A 5 second chart only covers a day or so of history, which is not enough for this. So on 5s, 10s, 15s, 30s and 1m charts the time of day profile is built from 5 minute data, which goes back much further, and scaled down to the chart's bar size.
If a time slot does not have enough history yet (5 sessions by default), or on daily and higher charts, the indicator uses the average of the previous 20 bars instead. The current bar is never part of its own baseline.
You can choose Median or SMA for the average. Median is the default, because one news day will not keep the baseline high for weeks afterwards.
Multipliers by timeframe
Volume on small bars jumps around much more than on large ones, so one pair of multipliers does not fit every timeframe. With Auto multipliers on, the indicator picks them based on the chart timeframe (High / Extreme):
- 10s and below: 2.5 / 5.0
- 15s to 30s: 2.0 / 4.0
- 45s to 4m: 1.8 / 3.0
- 5m to 20m: 1.5 / 2.5
- 30m and above: 1.4 / 2.0
All of these can be changed in the settings. Turn Auto off to use one fixed pair on every timeframe.
Other options
- Down bars (close below open) can be drawn fainter, so you still see direction.
- Price candles can be painted in the high and extreme colours.
- The live bar can be coloured by its projected volume, which is the volume so far divided by the part of the bar that has passed. It starts after 35% of the bar by default and can change until the bar closes. The bar height always shows the real volume.
- A baseline line, plus optional High and Extreme threshold lines.
- An info label showing the current relative volume, the multipliers in use and which baseline is active.
- Alerts for high, extreme, and high or extreme volume. They only trigger on closed bars.
Setup tip
The indicator is drawn on the price chart like the built-in volume. TradingView keeps a bottom margin under custom indicators, so the bars will float a little above the bottom edge. To make them sit on the bottom, right-click the chart, go to Settings > Canvas > Margins and set Bottom to 0. The Volume height setting controls how tall the bars are. If you would rather have it in its own pane, move it there and set Volume height to 100.
Notes
- Volume shows how many traders took part in a move, not which way price will go next. A big spike after a long run can mean the move is ending rather than starting.
- On futures, volume moves to the next contract around rollover, so make sure you are looking at the contract that has the volume.
- Time of day is only used on regular time based charts. On Renko, range and tick charts the indicator uses the average of the previous bars. אינדיקטור
