10am/10pm opensDual Time Opens (10:00 / 22:00) — 2H
This indicator marks the opening price of two specific times of day and draws each as a horizontal line that stops after a set duration. By default it plots the 10:00 AM and 10:00 PM New York opens, with each line running exactly two hours forward.
WHY TIME-LIMITED LINES
Most opening-price scripts extend their levels to the right edge of the chart or to the end of the session. That works when you only care about one level, but it clutters quickly once you're tracking multiple times per day, and it visually implies the level still matters hours after it stopped being relevant. This script draws each line for a defined window and then ends it, so what you see on the chart is the period the level was actually in play.
HOW IT WORKS
On each trading day the script identifies the first bar that reaches the configured time and records that bar's open price. It then draws a horizontal line from that bar forward by the chosen duration, measured in clock time rather than in bar counts — so the line covers the same real-world window regardless of whether you're on a 1-minute or 15-minute chart. If the exact bar is missing due to a data gap or thin liquidity, the script falls back to the first available bar within the window rather than skipping the day.
Times are evaluated in a user-selected timezone, independent of the chart's own timezone setting. The default is America/New_York, so 10:00 and 22:00 mean 10am and 10pm Eastern no matter how your chart is configured.
SETTINGS
Clock to use — timezone the times are measured in, or "Exchange" for the symbol's native time
Open #1 / Open #2 — hour and minute for each level, plus color and label tag; either can be turned off
Extend for (hours) — line duration, adjustable from 15 minutes to 24 hours
Width / Style — solid, dashed or dotted
Price tag — optional label showing the level's price at the end of each line
Keep last N days — trims older drawings to stay under Pine's 500-object limit
Alerts are available for each level being marked.
NOTES
Requires an intraday timeframe of 1 hour or lower. On symbols with restricted sessions, a level only appears if the chart's session actually covers that time — for a 22:00 level on equities, extended hours must be enabled. Indicador

Swing Volume Profile (VPVR) with POC and Value AreaSwing Volume Profile (VPVR) with POC and Value Area
What it does
This indicator builds a volume profile anchored to the last confirmed swing pivot instead of a fixed number of bars. As price makes a new confirmed swing high or low, the profile re-anchors and rebuilds over the range from that pivot to the current bar.
How it works
Swing pivots are detected with a symmetric left/right pivot strength. The price range between the last confirmed pivot and the current bar is divided into rows, and each bar's volume is spread evenly across the rows its high-low range covers.
The row with the most volume becomes the Point of Control (POC).
Starting from the POC, the script expands outward to the next-highest-volume row on either side until the chosen share of total volume is enclosed - that range is the Value Area, bounded by VAH (Value Area High) and VAL (Value Area Low).
An optional estimated buy/sell split colors each row by where price closed inside every bar's range (close near the high leans buy, close near the low leans sell). This is a derived estimate from bar data, not tick or order flow data, and is off by default.
The profile is placed beside price, never on top of it, with an adjustable offset so the most recent candles stay uncovered.
An optional faded profile of the previous completed swing can be shown alongside the current one for comparison.
How to use it
Add the script to a chart. The profile appears once the first swing pivot has confirmed.
Read the widest row as the Point of Control and the shaded band around it as the Value Area.
Turn on Split Buy/Sell to see an estimated buy/sell lean per row, or Show Previous Swing Profile to compare against the prior swing.
Watch for price crossing the POC or leaving the Value Area, and use the matching alert instead of watching the chart continuously.
Inputs
Anchor - Pivot Strength (bars required on both sides of a high/low to confirm a pivot), Anchor Mode (Last Swing High, Last Swing Low, or Last Swing Either), Max Bars In Profile (safety cap while no new pivot has confirmed).
Profile - Rows, Value Area % (50-95), Split Buy/Sell (estimated), Show Previous Swing Profile.
Placement - Profile Side (Right of Price or Left Edge of Range), Profile Width %, Offset Bars.
Style - Profile Color, Buy Color, Sell Color, POC Color, Value Area Color, Profile Opacity, Show POC Line, Show Value Area Box, Extend POC To Right, Show Level Prices, Text Size.
Signals and alerts
Price crossed POC - fires once per bar close when price closes across the swing-anchored volume profile's POC level.
Price left Value Area - fires once per bar close when price closes outside the value area after previously trading inside it.
New swing anchor set - fires once per bar close when a new confirmed swing pivot re-anchors the volume profile.
Repainting
No repainting - measured, not claimed: alert conditions are evaluated only on confirmed bar closes. The profile itself updates live while the current bar is still forming, similar to a moving average or VWAP, but no past drawing is ever redrawn or removed retroactively.
Limitations
The buy/sell split is an estimate derived from bar close position, not real order flow.
The profile only appears once a first swing pivot has confirmed on the chart.
This script works exclusively with bars of the chart's own timeframe. It does not request data from any other timeframe or resolution, so it has no plan-dependent history limit and looks the same on every account tier and every amount of chart history.
One package, one system - module from a shared engine of chart-timeframe-only indicators.
This script is a charting tool for educational purposes. It does not provide financial advice and does not predict future price movement. Trading carries risk; decisions and their outcome remain yours. Indicador

Lows and highs strength indicatorLows and highs strength indicator marks the two levels that matter most to the current market structure — the swing high sitting above price and the swing low sitting beneath it — and then answers the question most level-drawing tools leave open: which one of these two is going to break, and which one is going to hold?
Every level on your chart is not equal. Some are defended and will reject price. Others are simply liquidity waiting to be collected. This indicator labels each of its two levels as either strong (defended — treat it as a barrier) or weak (undefended — treat it as a target), and updates those labels automatically as market structure shifts.
Two lines, two labels, one setting. Works on any market and any timeframe.
THE CORE IDEA
A strong high is a high that price tried to reach and failed to take out. Because it was never breached, the buy-side liquidity resting above it is still sitting there untouched, and the level has proven it can push price away. It behaves like genuine resistance.
A weak high is the opposite. Structure is already trending upward into it, so rather than defending itself it is far more likely to be run through. It is not resistance — it is a magnet. Price is being drawn toward the liquidity above it.
The same logic applies in reverse to lows. A strong low has held and represents real support; a weak low is a downside liquidity target that the market is expected to reach for.
The crucial part is that the two labels are always opposite each other . You will never see a strong high and a strong low at the same time. Market structure can only lean one way:
Strong high above + weak low below → structure is bearish. The high is defended, the low is the target.
Weak high above + strong low below → structure is bullish. The low is defended, the high is the target.
That single pairing tells you the directional bias, where price is being pulled, and where it is likely to be rejected — all from two lines.
HOW TO USE IT WHEN TRADING
1. As a directional bias filter.
Before taking any setup, glance at which side is strong. If the high is strong and the low is weak, the path of least resistance is down. Longs into a strong high are fighting a defended level with an untouched pool of liquidity above it. This alone filters out a large share of low-quality counter-structure entries.
2. As a target.
The weak level is where the market is most likely headed, because that is where the unclaimed liquidity sits. In bearish structure, the weak low is a natural take-profit reference for shorts. In bullish structure, the weak high serves the same purpose for longs. Trading toward the weak side and away from the strong side is the indicator's most direct application.
3. As invalidation and stop placement.
The strong level is the structural line in the sand. If price closes decisively beyond it, the premise of your trade is gone — that break is exactly what flips the bias and relabels both levels. Placing stops beyond the strong level means you are stopped out only when the structure genuinely changes, rather than on ordinary noise.
4. As a reversal zone.
Approaches into a strong level are where rejections tend to occur. Combined with your own entry trigger — an engulfing candle, a lower-timeframe structure shift, a divergence — a strong level gives you a high-quality location to look for a turn, with clearly defined invalidation just beyond it.
5. As a liquidity sweep watch.
Pay attention when price wicks just past a strong level and immediately closes back inside. That is often a stop run rather than a real break: the level collected the liquidity above (or below) it and rejected. This indicator deliberately ignores wicks — only a decisive close through the level counts as a structural break.
Example read. On the Bitcoin daily chart, structure is bearish: the indicator shows a strong high at 82,791 and a weak low at 56,018. You know three things immediately: the bias is down, the weak low is the level price is reaching for, and the strong high is where the bearish premise would be proven wrong. A short taken on a rally into the strong high has its target, its invalidation, and its directional logic all defined by two lines.
Hover either label for a full plain-language explanation of why that level currently reads strong or weak, and exactly what would flip it to the other state.
HOW IT WORKS
The indicator runs a four-stage pipeline on every bar.
1. Swing detection.
A swing high is confirmed when a bar's high has Swing length bars with lower highs on both sides of it; a swing low is the mirror image. This symmetric test means a swing point is only recognised once enough bars have passed to prove it genuinely was the extreme — no forward-looking data is used.
2. Level anchoring.
When a new swing point is confirmed, it becomes the active swing high or swing low, and the corresponding line re-anchors to it.
3. Trailing extremes.
Between swing points, each line ratchets outward with price — the upper line tracks the highest high of the current swing, the lower line the lowest low. This keeps both levels pinned to the true extremes of the live swing rather than to a stale historical price.
4. Break of structure.
When a candle closes beyond the active swing high, structure flips bullish; a close beyond the swing low flips it bearish. This bias drives the strong/weak labelling. Each swing level is consumed the moment it breaks, so a single level can only flip the bias once. And because the test is a plain closing test rather than a crossing test, the rare case where a swing point is confirmed while price already trades beyond it is registered immediately instead of being missed.
Closes are used rather than wicks deliberately — a wick through a level is a liquidity sweep, not a structural break, and treating the two the same is what causes most false structure signals.
No repainting. Every calculation uses confirmed historical data with no lookahead. The lines extend in real time as the current candle makes new extremes, which is expected live behaviour, but past structure is never rewritten.
SETTINGS
Swing length (default 50) — how many bars are required on each side of a candidate swing point before it is confirmed. This is the one setting that meaningfully changes the indicator's character:
Lower (10–25) — faster, more reactive levels that track shorter swings. Suited to intraday and scalping, at the cost of more frequent bias flips.
Default (50) — balanced structural levels. A solid starting point on most markets and timeframes.
Higher (75–150) — only major structural turning points register. Suited to swing and position trading, where you want the levels to stay put.
High color and Low color — the two line and label colours, red and green by default.
THINGS TO BE AWARE OF
The levels lag, by design. A swing point cannot be confirmed until enough bars have passed to prove nothing exceeded it. That delay is what makes the level trustworthy rather than a guess, but it does mean this is a tool for structural context and bias, not for precise entry timing. Pair it with your own entry trigger.
On very short chart histories both levels may read weak. Until the first break of structure occurs there is no bias to judge them against, and the labels default to weak. Hovering a label will tell you when this is the case. It resolves as soon as the first structural break happens.
It is a context tool, not a complete system. It tells you which direction structure favours and where the liquidity sits. It does not tell you when to click the button. Use it to frame your bias, choose your targets, and place your invalidation — then let your own entry method handle the timing.
Indicador

NASDAQ Pre-Market Range Sweep [josseliani]NASDAQ Pre-Market Range Sweep is an intraday trading assistant built around a familiar pre-market range sweep-and-reclaim setup. It automatically maps the NASDAQ range formed between 08:00 and 09:00 New York time, then monitors price behavior as activity increases ahead of the 09:30 cash-session open. The main idea is simple: after price sweeps liquidity beyond one side of the pre-market range, it may either continue moving away or return inside the range and move toward its midpoint or opposite boundary. Instead of requiring users to draw these levels manually and monitor every candle, the indicator plots the range, qualifies the sweep, waits for one of two entry confirmations, marks Entry and TP1, and collects historical statistics for the same setup.
This is an indicator, not a TradingView strategy. It does not place orders or manage positions.
WHY THIS RANGE
By default, the range is built from M1 candles between 08:00 and 09:00 in the America/New_York time zone.
This hour captures a defined part of the NASDAQ pre-market before the transition into the more active New York morning and the 09:30 cash-session open. Once this period is complete, the indicator fixes: → Range High → Range Low → the 50% midpoint
With the default one-minute delay, sweep monitoring begins at 09:01 New York time.
The range levels can remain visible for a fixed number of minutes or extend until the next daily range begins.
QUALIFIED LIQUIDITY SWEEP
A small wick through Range High or Range Low is not enough to qualify as a sweep.
The entire M1 candle must be outside the range: → for an upper sweep, the candle’s low must be above Range High → for a lower sweep, the candle’s high must be below Range Low
By default, the outside candle must also take the nearest previously confirmed pivot on the same side. This optional structural filter helps distinguish a more substantial liquidity event from a minor extension beyond the range.
A qualified sweep is not an immediate entry. The indicator then waits for one of two confirmations: Range Reclaim or Pivot Entry.
RANGE RECLAIM
Range Reclaim is used when price returns inside the pre-market range after the sweep.
For a BUY after a lower sweep, the indicator waits for a closed M1 candle that: → closes inside the range → has at least 70% of its body inside the range under the default settings
Once that candle has closed, its high becomes the confirmation level. BUY is displayed when price subsequently breaks that high.
For a SELL after an upper sweep, the logic is reversed: the acceptance candle closes inside the range, and SELL is confirmed when price subsequently breaks its low.
For Range Reclaim: → Entry is the high or low whose break confirmed the signal → TP1 · Partial close is placed at the 50% midpoint of the range
The midpoint is used as the first structural objective because price has returned inside the range but is not guaranteed to reach the opposite boundary.
PIVOT ENTRY
Pivot Entry is designed for cases where price continues significantly beyond the swept range boundary.
The search for this entry is activated only after price has moved at least one complete range width beyond that boundary.
The indicator then waits for a new confirmed pivot to form outside the range: → after a lower sweep, it looks for a confirmed pivot high below Range Low and a subsequent break above it → after an upper sweep, it looks for a confirmed pivot low above Range High and a subsequent break below it
For Pivot Entry: → Entry is placed at the broken pivot level → TP1 · Partial close is placed at the nearest boundary of the original range
If Range Reclaim and Pivot Entry are confirmed on the same M1 candle, only one signal is recorded.
SIGNAL CONTROL
The same acceptance candle or confirmed pivot cannot generate repeated signals.
After a BUY, another BUY requires a genuinely new low beyond the extreme of the previous outside movement. After a SELL, another SELL requires a genuinely new high. The number of signals per range is also limited by the Maximum signals per range setting.
Once price reaches the opposite boundary of the range, the current range cycle is considered complete, and no additional signals are generated until the next range.
CHART DISPLAY
The indicator can display: → Range High and Range Low → the 50% midpoint → confirmed BUY and SELL arrows → Entry → TP1 · Partial close → the statistics table
BUY and SELL arrows show that one of the two confirmation models has been completed. Entry marks the level whose break confirmed the setup. TP1 · Partial close marks the first structural reference: → the range midpoint for Range Reclaim → the nearest range boundary for Pivot Entry
The trade markup is an analytical reference. It does not represent an automatically executed order or a guaranteed target.
TIMEFRAMES
All signal calculations are performed using M1 data.
On M1, the indicator displays the original signals together with the Entry and TP1 markup. On M5 and M15, it displays markers cloned from the original M1 events. It does not recalculate the setup using M5 or M15 candles. This allows the same M1 signals to be viewed within a wider market context.
Timeframes above M15 are not supported.
STATISTICS TABLE
The statistics table provides a historical view of how price behaved after a qualified sweep. For each completed range, the table evaluates the first qualified sweep found within the observation window.
Return depth is normalized according to the width of each individual range: → 0% = the swept boundary → 50% = the range midpoint → 100% = the opposite boundary
OVERVIEW
Completed ranges — the number of completed observations. An observation ends when price reaches the opposite boundary or when the statistics look-forward window expires.
Qualified sweeps — the number of completed ranges in which a qualified sweep occurred. The percentage is calculated from all completed ranges.
Returned into range — the number and percentage of qualified sweeps followed by at least some movement back inside the range.
Full opposite edge — the number and percentage of qualified sweeps that eventually reached the opposite range boundary.
RETURN DEPTH
Average return (>0) — the average maximum return depth among sweeps that produced a positive return. A complete return is capped at 100%.
Minimum return (>0) — the smallest positive return recorded in the sample.
0–25%, 25–50%, 50–75%, 75–90%, and 90–99% — the distribution of incomplete returns that did not reach the opposite boundary.
These rows show how far price most often returned. They are useful because waiting for the opposite boundary in every case may not be realistic.
RISK & TIME
Average adverse excursion — the average maximum distance that price continued moving away from the range after the qualified sweep. It is expressed as a percentage of that range’s width.
Maximum adverse excursion — the largest such movement recorded in the available sample.
For example, a maximum adverse excursion of 600% means that, in the most extreme historical case, price continued approximately six range widths farther away before the observation ended.
Average time to 20% — the average number of minutes from the sweep until price completed a 20% return.
Average time to 50% — the average number of minutes from the sweep until price reached the range midpoint.
Average time to full — the average number of minutes from the sweep until price reached the opposite boundary.
These values help estimate how long the historical return process usually took rather than assuming that it should happen immediately.
BREAK-EVEN SIMULATION
BE armed / stopped / later full is a statistical simulation only.
It shows: → how many events reached the selected return depth and activated the hypothetical protection level → how many subsequently returned to that simulated protection level → how many of those stopped cases later reached the opposite boundary anyway
The simulation does not move a real stop, alter the signals, or manage a trade.
EXAMPLE OF READING THE TABLE
The table shown in this example contains:
→ Completed ranges: 18
→ Qualified sweeps: 18 | 100%
→ Returned into range: 16 | 88.89%
→ Full opposite edge: 5 | 27.78%
Completed ranges: 18
The indicator completed 18 statistical observations on the available chart history.
An observation is considered complete when either:
→ price reaches the opposite boundary of the range
→ the Statistics look-forward window expires
This number does not represent 18 trades. It represents 18 completed range observations.
Qualified sweeps: 18 | 100%
A qualified sweep was found in all 18 completed observations.
The 100% is calculated as:
→ 18 qualified sweeps ÷ 18 completed ranges
For the statistics, only the first qualified sweep found within each range observation is evaluated.
Returned into range: 16 | 88.89%
After 16 of the 18 qualified sweeps, price made at least some positive movement back inside the range.
The percentage is calculated as:
→ 16 returns ÷ 18 qualified sweeps = 88.89%
This does not mean that all 16 events reached the midpoint or the opposite boundary. It means only that price moved back inside the range by more than 0%.
Full opposite edge: 5 | 27.78%
In 5 of the 18 qualified sweep events, price moved through the entire range and reached its opposite boundary.
The percentage is calculated as:
→ 5 full returns ÷ 18 qualified sweeps = 27.78%
This is an important distinction. In this sample, price returned inside the range in 88.89% of the events, but it completed the full journey to the opposite boundary in only 27.78%.
The table therefore helps avoid the assumption that every successful return should be held all the way to the other side of the range.
RETURN DEPTH
The same example shows:
→ Average return (>0): 66.2%
→ Minimum return (>0): 3.33%
Average return (>0): 66.2%
Among the 16 events that produced a positive return, the average maximum return depth was 66.2% of the corresponding range width.
The calculation includes partial returns and full returns. A return that reaches the opposite boundary is capped at 100%.
This does not mean that every event returned 66.2%. It means that 66.2% was the average maximum depth across the positive-return sample.
Minimum return (>0): 3.33%
The smallest positive return in the sample was only 3.33% of the range width.
Events with no positive return are not included in this minimum calculation. This row shows the weakest recorded return that was still greater than zero.
INCOMPLETE RETURN DISTRIBUTION
The example contains:
→ 0–25%: 4 | 30.77%
→ 25–50%: 2 | 15.38%
→ 50–75%: 5 | 38.46%
→ 75–90%: 2 | 15.38%
→ 90–99%: 0 | 0%
Five events reached the full opposite boundary and are therefore excluded from these incomplete-return groups.
That leaves:
→ 18 qualified sweeps − 5 full returns = 13 incomplete returns
The percentages in this section are calculated from these 13 incomplete events, not from all 18 qualified sweeps.
0–25%: 4 | 30.77%
Four of the 13 incomplete observations returned by less than 25% of the range width.
This group also includes events with a 0% return. Therefore, not every event in the 0–25% group necessarily moved back inside the range.
25–50%: 2 | 15.38%
Two incomplete observations returned through at least 25% of the range but did not reach its midpoint.
50–75%: 5 | 38.46%
Five incomplete observations reached the midpoint and continued beyond it, but did not reach 75% of the range.
This was the largest incomplete-return group in the example.
75–90%: 2 | 15.38%
Two observations returned through at least 75% of the range but stopped before reaching 90%.
90–99%: 0 | 0%
None of the incomplete observations stopped between 90% and 99%.
Events that reached 100% are counted separately under Full opposite edge.
ADVERSE EXCURSION
The example shows:
→ Average adverse excursion: 189.34%
→ Maximum adverse excursion: 665.07%
Adverse excursion measures how far price continued moving away from the swept boundary after the qualified sweep.
It is also normalized according to the width of the corresponding range.
Average adverse excursion: 189.34%
On average, price traveled approximately 1.89 range widths farther away from the swept boundary during the observed events.
This number shows why a liquidity sweep should not automatically be treated as an immediate reversal or as an entry without confirmation.
Maximum adverse excursion: 665.07%
In the most extreme observation, price continued approximately 6.65 range widths beyond the swept boundary.
This does not mean that every setup requires such a large stop. It shows the largest historical extension found in the available sample and demonstrates that price can continue significantly farther after a sweep.
TIME STATISTICS
The example shows:
→ Average time to 20%: 14.86 min
→ Average time to 50%: 23.75 min
→ Average time to full: 30 min
These values are measured from the qualified sweep.
Average time to 20%: 14.86 min
Among the observations that reached a 20% return, the average time required was 14.86 minutes.
Events that never reached 20% are not included in this average.
Average time to 50%: 23.75 min
Among the observations that reached the range midpoint, the average time required was 23.75 minutes.
Events that never reached 50% are not included.
Average time to full: 30 min
Among the five observations that reached the opposite boundary, the average time required to complete the full return was 30 minutes.
This does not mean that a full return should always occur within 30 minutes. It describes only the average of the completed full-return cases in this sample.
BREAK-EVEN SIMULATION
The example shows:
→ BE armed / stopped / later full: 14 / 10 / 4
With the default 20% activation setting, this means:
→ 14 events reached at least a 20% return and activated the hypothetical protection level
→ 10 of those events subsequently returned to the simulated protection level
→ 4 of those 10 events later reached the opposite boundary anyway
This row helps examine whether protecting a position after the first part of the return might remove exposure from some events that would later continue to the full target.
It is a statistical simulation only. It does not place a stop, move a stop, change the signals, or manage a real position.
WHAT THE TABLE TELLS ME
In this particular sample, the table shows that a return inside the range occurred much more frequently than a complete move to the opposite boundary.
It also shows:
→ how deep the average return was
→ how shallow the weakest positive return was
→ where incomplete returns most often stopped
→ how long different stages of the return usually took
→ how far price sometimes continued away from the range before returning or before the observation ended
The purpose of the table is not to prove that the setup will work in the future. It provides a structured statistical view of the price behavior visible on the current chart, symbol, data feed, and settings.
HOW I USE IT
I use the indicator on a NASDAQ M1 chart and first wait for the pre-market range to be completed.
After 09:00 New York time, I watch for a qualified sweep of one of the boundaries. The sweep itself is not my entry.
I then wait for either: → a confirmed return inside the range through Range Reclaim → a confirmed pivot break after a deeper movement outside the range
The arrow shows that one of these confirmation conditions has been completed. Entry marks the confirmation level and the potential trade-entry level. TP1 · Partial close marks the first structural area where a partial exit or closer observation of the price reaction may be considered.
The default settings and presets are built for the NASDAQ sweep-and-reclaim strategy around the New York pre-market open. The same logic can also be used on other instruments, including FX pairs and gold. On gold, you can keep the same New York pre-market range; the market will simply produce its own statistics. On EURUSD, for example, you can build a London session window by adjusting Range start hour / minute and Range length (still entered in New York time).
Use the statistics table to judge how clean the setup looks on that symbol and those settings, and build the variation that fits you: → try different instruments and currency pairs → try different chart timeframes → choose your own pre-market hour and range length → decide from the table whether the setup is worth trading there
MAIN SETTINGS
Range start hour / minute — sets the beginning of the range in New York time.
Range length — sets the duration of the range.
Start watching after range end — sets the delay before sweep monitoring begins. The default value of one minute starts monitoring at 09:01.
Statistics look-forward window — sets how long each sweep is observed for the statistics table.
Signal window mode — limits signal generation to a fixed period or allows it to continue until the next range.
Signal window — sets the duration of the fixed signal-search period.
Maximum signals per range — limits the number of confirmed signals for one range.
Minimum reclaim body inside range — sets how much of the closed acceptance candle’s body must be inside the range.
Require nearest confirmed pivot sweep — requires the outside candle to take the nearest confirmed pivot.
Pivot strength — controls the size and confirmation delay of local pivots.
Level extension — extends the range levels for a fixed period or until the next range.
Trade markup length — controls the length of the Entry and TP1 lines.
ORIGINALITY
Pre-market ranges, liquidity sweeps, and confirmed pivots are established market concepts. The originality of this implementation lies in how these elements are combined and managed as one complete process.
The script: → requires the entire M1 candle to move outside the range → can require the nearest confirmed pivot to be swept → separates the liquidity event from the entry confirmation → provides two distinct confirmation models: Range Reclaim and Pivot Entry → activates Pivot Entry only after a one-range-width excursion → prevents the same candle or pivot from producing repeated signals → requires a new external extreme before another same-direction signal can occur → terminates the cycle after price reaches the opposite boundary → includes a normalized statistics table designed specifically to evaluate this range-sweep setup
The table is not intended to present a strategy win rate. It provides a statistical view of the underlying idea: how often qualified sweeps occurred, how often price returned inside the range, how frequently it reached the opposite boundary, the average and minimum return depth, the time required for different stages of the return, and the adverse distance price sometimes traveled before returning or before the observation ended.
This helps users evaluate the historical behavior of the setup instead of assuming that every sweep must produce a complete return or that every return should take the same amount of time.
The indicator is published free and open-source so that users can inspect the calculations and verify how the signals and statistics are produced.
LIMITATIONS
Results can differ between NASDAQ symbols, exchanges, and data feeds because the calculations depend on M1 OHLC data.
Confirmed pivots require bars on their right side and therefore become available only after a structural confirmation delay.
M5 and M15 display cloned M1 events, not independently calculated higher-timeframe signals.
The statistics describe only the available historical sample under the current settings. They are not a strategy report and do not guarantee future results.
The indicator does not account for commissions, slippage, position size, or individual stop-loss placement. Entry, TP1, and the break-even simulation are analytical references, not automated trade-management instructions. Indicador

Indicador

Inside Bar [scriptedge]Overview
Inside Bar looks for a higher timeframe candle that trades entirely within the range of the one before it. Throughout this description the larger candle is called the mother candle , the contained one is the inside bar , and the one that follows is the trading candle .
The indicator is designed so that the whole setup can be visualised from the lower timeframe you intend to trade. The higher timeframe is read in the background and its structure is drawn onto your chart, so there is no need to switch timeframes to see where the range sits or how the trading candle is developing.
The tool draws structure and context. It does not generate buy or sell signals, and it does not manage entries, exits, stops, or position size. Those decisions are left to the trader.
The Higher Timeframe Pattern
An inside bar is a two candle pattern. The second candle's high is at or below the first candle's high, and its low is at or above the first candle's low — the whole candle sits within the range of the one before it. That is compression. Range has contracted, and unlike most patterns it carries no direction of its own. Both boundaries of the mother candle are live, and the market decides which one matters.
What Gets Drawn
Once the inside bar closes, the mother candle's high and low are drawn as solid lines. These are the levels a break has to clear, and they are what almost every published treatment of this pattern uses for entries and stops.
A shaded box spans the compression itself: from the mother candle through every inside bar, ending where the trading candle opens. The box shows the coil, the lines carry the levels forward through the trading candle.
Two target lines are projected at one times the mother candle's range, one above the high and one below the low. This is the measured move, the conventional objective for a range break. They are drawn from the trading candle's open, since that is when a target first becomes relevant. Every line stops when price trades through it, or when the trading candle ends, whichever comes first.
Nested Inside Bars
Inside bars often arrive in runs. When the trading candle turns out to be another inside bar — still entirely within the mother's range — the coil has not resolved, so nothing is reset. The mother candle's levels stay exactly where they are, the box extends, and the next candle takes over as the trading candle. A label on the box counts the inside bars whenever there is more than one, so a deep coil is visible at a glance.
Higher Timeframe Panel
The mother candle, every inside bar and the trading candle are redrawn to the right of the live chart, with the mother's levels marked across them. The trading candle updates live. On a long coil the mother candle is often well off the left of your screen. The panel is what lets you see the whole pattern without scrolling or switching timeframes.
Stats Dashboard
The table counts how past breaks on the selected higher timeframe resolved. A break is recorded the moment price trades outside the mother candle's range during the trading candle.
Breakout — after breaking, price reached the target before reaching the opposite boundary.
Failed breakout — after breaking, price reached the opposite boundary first.
Those two levels sit exactly one mother range either side of the break, so this is a symmetrical test rather than an arbitrary pairing.
A trading candle can break both boundaries, in which case both breaks are counted separately with their own outcomes. Breaks that have not yet resolved are excluded until they do, and setups still coiling are not counted at all, so the two percentages always sum to one hundred.
There is deliberately no win rate here. A failed breakout is a losing outcome to one trader and the entire premise to another, and it is not the indicator's place to decide which.
Please read this table for what it is. It is a count of what price did on the bars loaded in your chart. It is not a backtest and not a strategy report. No entry price, exit price, stop, commission, or slippage is assumed, because the indicator does not place trades. Past behaviour of a market does not indicate future behaviour.
Settings
Chart Theme — light or dark colour palette.
Stats Dashboard — show or hide the table.
Higher Timeframe — 15m, 1h, 4h, D, W or M.
HTF Candle Separators — vertical line at each higher timeframe open.
Show Target Lines — the measured move projections.
Alerts
An alert fires the first time price trades outside the mother candle's range in each direction, with a message naming the timeframe and the side, for example 1h inside bar broken up . A trading candle that breaks both boundaries produces two alerts. To use them, create an alert on the indicator and choose Any alert() function call as the condition.
Repainting
Historical bars are never restated. Specifically:
Higher timeframe candles are built by aggregating completed chart bars, so the pattern is only known once the inside bar has closed. request.security() with lookahead is not used anywhere in the script.
Levels come from candles that have already closed. Nothing is drawn at a price that could still change.
A break occurs once price trades through a level, which cannot be undone within a bar — once price has traded outside the range it has traded outside the range.
The box and the lines extend to the right as the trading candle progresses. That is a drawing being lengthened, not a value being changed.
Limitations
The mother candle defines the levels . Some traders use the inside bar's own high and low instead, for a tighter trigger and smaller risk. This tool does not draw those.
A break is any trade outside the range, wick or close . A candle that pokes through and closes back inside counts as a break. If you think of a break as requiring a close, the counts here will run higher than you expect.
On the higher timeframe itself , target lines, the inside bar count and the stats table are not shown. There the trading candle is a single bar, which cannot say whether a break or its outcome came first. The pattern, its levels and the box are still drawn.
Above the higher timeframe , nothing is drawn. Select a chart timeframe lower than the higher timeframe setting.
The panel is capped at twelve candles . A coil deeper than that still tracks correctly, but the panel shows the mother candle and the most recent inside bars rather than all of them.
Drawing objects are capped by the platform . On very long histories the oldest drawings will drop off the chart.
The stats table depends on how much history your plan loads , so the counts will differ between account types on the same instrument.
This is an indicator, not a strategy . It offers no entries, exits, stop levels, position sizing, or risk management, and makes no claim about profitability.
Disclaimer
This script is for informational and educational purposes only. It is not financial advice and not a recommendation to buy or sell anything. Trading involves substantial risk of loss. Test any tool thoroughly and make your own decisions. Indicador

Volume Profile Fixed/Range [1CG]Fixed Range Volume Profile (Open Source)
This open-source indicator serves a dual purpose: it is a highly customizable, high-performance volume profile tool for traders, and it acts as the official implementation guide for developers looking to integrate the Volume Profile Library into their own indicators and strategies.
Leveraging intrabar arrays for volume accuracy, this tool provides precise Point of Control (POC) and Value Area calculations alongside box and polyline visuals.
Why This Indicator Is Necessary
The volume profile in Pine Script is not accessible programmatically. By reviewing the source code of this indicator, developers can see exactly how to integrate the library engine into their own projets:
Setup the `VolumeProfileLibrary` engine state using `var`.
Fetch 1-minute intrabar data efficiently using `request.security_lower_tf()`.
Safely pass data into the engine for accurate volume distribution.
Extract the calculated POC and Value Area levels for external logic.
Traditional vs. Polyline Rendering
This indicator breaks away from the limitations of standard histograms by offering multiple rendering modes:
Traditional (Boxes) : The classic stacked volume row display, with options to split each row into estimated buy/sell volumes and dim areas outside the Value Area.
Modern (Polylines) : Render the profile as Polylines or Curved Polylines. This modern aesthetic connects row endpoints with sleek lines and fills the internal regions with stunning spatial color gradients.
Use As An External Input Source
You do not need to fork this code to use its data! This indicator plots the most recent POC, Value Area High, and Value Area Low invisibly to the chart.
Because these plots are exposed to the Data Window, you can use this script as a direct "Source" input for other indicators and strategies in your workflow. This allows you to trigger alerts or build strategies based on exact Volume Profile levels without writing a single line of code.
Additional Features
Flexible Range Anchoring : Select between absolute ranges ('From Time', 'Between Times') or recurring windows ('Daily Anchor', 'Daily Session') that automatically reset every day.
Intrabar Accuracy : Dives into 1-minute intrabar data to distribute volume accurately within the chart's bars.
Session History : Keep historical sessions alive on the chart, allowing you to instantly visually backtest how the volume profile evolved day over day.
How to Use
Add the indicator to your chart.
Open the settings menu and configure your preferred Timezone . All fixed time pickers and session windows respect this timezone automatically.
Select your Range Mode (e.g. 'Daily Session' for the RTH open).
Customize your resolution (`Rows`), rendering styles, and gradients.
Indicador

Volume Profile Library [1CG]Volume Profile Library
A high-performance fixed range volume profile engine bundled with an embedded renderer. This library handles volume accumulation, core analytics (Point of Control and Value Area), and complex visual rendering natively. It features robust box and polyline display modes, handles absolute and recurring time ranges, and accepts lower-timeframe intrabar arrays to construct highly accurate volume profiles.
Supported Configurations (As Seen in Example)
By wrapping the engine in your own script, you can expose a wide array of configurations to the user. The library natively supports processing all of the following parameters:
Time zone & Range Modes : Support for 'From Time' (single anchored profile), 'Between Times', 'Daily Anchor' (recurring at a specific time), and 'Daily Session' (recurring inside a specific session).
Profile Fidelity : Configure the number of price rows (up to 49), define the Value Area percentage, and optionally split each row into estimated buy/sell volumes based on intrabar close locations.
Visual Modes : Choose between traditional 'Boxes' (stacked volume rows), 'Polylines' (straight connective bands), and 'Curved Polylines', or disable all drawings while calculations continue.
Appearance & Gradients : Natively handles coloring for bull/bear/total volume, fading volume out outside the Value Area, rendering gradient color bands within polylines, and highlighting the Range Box and Point of Control (POC) line/label.
History Retention : Retain multiple historical recurring profiles on the chart at once without constantly recalculating them.
How to Use Correctly
To use this library effectively, the consuming indicator or strategy must handle three critical tasks:
Declare Engine State : Create a persistent state instance using `var profileState = VP.createState()`. The engine requires this state to manage arrays, recycle drawings, and persist historical sessions across bars.
Allocate Limits : Because the library manages drawing native Pine boxes, lines, and polylines, your main script must provide it with a large enough budget. You must add these limits to your `indicator()` or `strategy()` declaration (e.g., `max_boxes_count = 500`, `max_polylines_count = 100`).
Fetch Intrabar Data : Pine Script restricts `request.security_lower_tf()` inside loops and libraries. You must fetch these arrays (High, Low, Close, Volume) at the global scope of your consumer script and pass them directly into `VP.update()`.
Example Integration
import OneCleverGuy/VolumeProfileLibrary/ as VP
// 1. Declare persistent state and assemble config
var VP.ProfileState profileState = VP.createState()
var VP.ProfileConfig profileConfig = VP.ProfileConfig.new()
// 2. Fetch lower-timeframe data for volume accuracy
string ltf = timeframe.in_seconds() > 60 ? "1" : timeframe.period
= request.security_lower_tf(syminfo.tickerid, ltf, )
// 3. Update the engine on every bar
profileState := VP.update(profileState, profileConfig, true, ltfHighs, ltfLows, ltfCloses, ltfVolumes)
// 4. Retrieve statistics for your own logic
= VP.getMostRecentLevels(profileState)
Important Notes
Bars without lower-timeframe coverage will automatically fall back to the chart bar's data during accumulation.
Ensure you guard against missing volume in your main script (e.g., `if not na(volume)`), as the engine strictly requires volume data to function.
Biblioteca

Volatility Position Risk Planner [Pineify]Volatility Position Risk Planner
Overview
This indicator converts a trade idea into a stress-sized quantity. Its corridor separates target, nominal risk, and reserve; a ledger identifies the binding constraint.
Problem Definition
A basic position size calculator divides account risk by entry-to-stop distance. It ignores fills beyond a stop during gaps, slippage, and per-unit cash costs. A tight stop can also produce notional exposure disproportionate to the account. The result may satisfy nominal loss math while violating another capital limit. This script instead asks what quantity fits both a stated stress-loss budget and an exposure ceiling under the units supplied by the user.
Design Rationale
Technical invalidation and execution uncertainty are separate. The stop says where the setup fails; ATR gap allowance and tick slippage extend a stress boundary. Cash cost remains in currency units. This replaces inflating one ATR multiplier, which would mix stop logic and reserve.
Risk and notional capacity are calculated independently. The smaller candidate is rounded down, leaving some budget unused but avoiding either limit. The target uses stress price distance for a consistent visual scale; it is not a forecast.
Key Features
ATR, structure, or wider-of-both stop logic.
Separate gap, slippage, and cash-cost reserves.
Risk and exposure candidates with a binding constraint.
Step rounding plus utilization and headroom diagnostics.
How It Works
Current close rolls with price; Manual price fixes entry. ATR comes from chart OHLC. Stop distance is ATR times its factor, directional distance to structure, or the wider valid distance. The stop is tick-normalized.
The reserve adds ATR times Gap reserve and slippage ticks, producing a stress edge. Nominal unit risk is stop distance times point value plus cash cost; stress unit risk uses the full distance to that edge. Account size times risk percent, divided by stress unit risk, gives the risk candidate.
Entry times point value estimates unit notional. Account size times Maximum notional exposure, divided by unit notional, gives the exposure candidate. The smaller quantity is rounded down by step. Nominal risk, stress risk, reserve cash, both utilizations, and unused budget are then reconciled. Warm-up, wrongly sided stops, invalid units or prices, and sub-step quantities are rejected.
How Multiple Indicators Work Together
This is a causal chain, not a signal stack. ATR scales stop and gap allowance; structure supplies price invalidation. Point value converts distance into cash risk. Risk budget limits stress loss; exposure limits concentration. Removing ATR ignores current range, removing structure loses chart context, and removing either capital constraint leaves one dimension unchecked. Corridor and ledger expose each link.
Trading Ideas and Insights
Compare the same setup under different volatility, reserve, and exposure assumptions. RISK means stress-loss capacity is tighter; EXPOSURE means concentration controls size; BOTH means candidates are close within half a quantity step. A large amber zone relative to red shows that execution assumptions materially reduce size. Headroom is cash left after rounding, not permission to exceed the constraint.
Unique Aspects
The structural contribution is a two-stage constraint lattice. Technical invalidation and execution overrun first become auditable loss layers. The stress-loss candidate then competes with an independent exposure candidate before step rounding. The ledger reconciles final quantity to both budgets and names the binding one, showing how much risk belongs to the stop, how much to reserve, and when exposure overrides them.
How to Use
Choose direction and a rolling or manual entry.
Select ATR, structure, or combined stop logic; verify stop direction.
Enter reserve, cost, account, point value, step, and exposure data from broker specifications.
Proceed only at PLAN READY; note quantity and binding constraint.
Read amber as a stress boundary, not another order or a guaranteed fill limit.
Customization
ATR length and multiple control the volatility stop. Gap reserve adds a scaled allowance; slippage ticks add a fixed allowance. Cash cost must share the account-currency and quantity convention. Exposure above 100% should be deliberate leverage, not assumed margin. Visual switches hide corridor, candidates, labels, or ledger without altering calculations or alerts. Projection bars change drawing length only.
Assumptions and Limitations
This calculator omits liquidity, partial fills, spreads, rejection, margin tiers, liquidation, currency conversion, financing, tax, and minimum notional. A gap can exceed reserve, so stress risk is a scenario, not maximum loss. Point value, cost, step, currency, and exposure need compatible units; metadata may differ from a broker contract.
Current close, ATR, corridor, and quantity can change intrabar. Manual entry is fixed, but ATR values still move. Confirmed-bar alerts can miss a reversed intrabar touch, and gaps can cross boundaries before processing. Drawings show only the latest plan. The script estimates no probability, return, win rate, or stop quality. Nonstandard charts and illiquid markets can make ATR a poor execution proxy.
Conclusion
This planner separates risk, reserve, and exposure. Reliability still depends on verified units, stop logic, and realistic stress assumptions.
Indicador

PIPSHUSTLE GOLD OPTION FLOW DEALER The **PIPSHUSTLE Gold Dealer Flow Indicator** is a liquidity-and-volume-based trading indicator designed specifically for **Gold (XAUUSD)**. Its purpose is to identify areas where price may be trapping traders, reacting to liquidity, or showing signs of stronger institutional-style activity.
The indicator focuses on six main components:
* **Sweep Trap Zone:** Detects when Gold runs above a previous high or below a previous low, then closes back inside the level. This can indicate a liquidity grab or false breakout. Bullish sweep traps form below previous lows, while bearish sweep traps form above previous highs.
* **Active Dealers Zone:** A dynamic area around VWAP that uses ATR and relative volume to highlight periods where trading activity is unusually strong. This is intended to act as a proxy for areas where larger market participants may be most active.
* **Reclaim Pivot:** Marks the key price level that was swept and then reclaimed. A bullish reclaim pivot appears after downside liquidity is taken and price closes back above the level. A bearish reclaim pivot appears after upside liquidity is taken and price falls back below it.
* **Main Dealer Ceiling:** A dynamic resistance level created from important upper-side liquidity sweeps and rejection points. If Gold repeatedly fails around this area, it can act as a major resistance or potential SELL zone.
* **Main Dealer Floor:** The bullish equivalent of the Dealer Ceiling. It tracks important lower-side liquidity sweeps and reclaim points, acting as a potential support or BUY zone.
* **BUY / SELL Signals:** The indicator does not generate a signal from a liquidity sweep alone. It combines several conditions such as liquidity sweep, reclaim, VWAP position, volume, EMA trend, displacement, and dealer-zone activity. A signal is printed only after enough conditions align.
A typical **BUY setup** is:
**Sell-side liquidity sweep → bullish trap → reclaim pivot → Dealer Floor holds → price confirms above VWAP → BUY**
A typical **SELL setup** is:
**Buy-side liquidity sweep → bearish trap → Dealer Ceiling rejection → reclaim pivot fails → price confirms below VWAP → SELL**
The signal system also uses a **confirmation score**, allowing stronger setups to require more conditions before a BUY or SELL appears.
It is best viewed as a **dealer-flow/liquidity proxy indicator**, not a true institutional options-feed indicator. Pine Script does not directly provide dealer gamma positioning or full options order-flow data, so the indicator estimates these areas using price action, liquidity behavior, VWAP, volatility and volume.
Indicador

Indicador

Volatility-Scaled Range Level with Term Structure FilterWHAT IT DOES
This indicator plots a single volatility-scaled price level and evaluates three independent market-condition filters against it. The level sits one Average True Range below the prior period's close, so it widens automatically when realized volatility expands and tightens when volatility contracts. A summary table reports the level, its distance from current price as a percentage, and the state of each filter.
It is a reference and condition-monitoring tool. It does not generate buy or sell orders, does not connect to a broker, and takes no position on whether any particular trade should be placed.
HOW IT WORKS
The level is computed on a higher timeframe than the chart:
level = close of higher timeframe − ATR(14) of higher timeframe
ATR here is Wilder's RMA of True Range, which is what ta.atr() returns. Both components are pulled with request.security(..., lookahead = barmerge.lookahead_off) and referenced at index , so the value is drawn from the last completed higher timeframe bar and does not repaint. Setting the timeframe input to W produces a weekly-anchored level; D produces a daily-anchored one.
The level is then floored to a user-defined increment (default 5). This is optional rounding for users who want the level snapped to a round number rather than an arbitrary decimal.
Three filters are evaluated independently:
Term structure. The ratio of a short-dated volatility index to a longer-dated one (default CBOE:VIX over CBOE:VIX3M). A ratio below the threshold indicates contango, the normal state. A ratio above it indicates backwardation, which historically coincides with volatility clustering and trending decline. Both symbols are user inputs and can be swapped for other instruments.
Absolute volatility floor. A minimum level on the short-dated volatility index. Below this, the distance implied by ATR is small in absolute terms.
Optional trend filter. Price above its 21-period EMA.
The table reads GATES PASS only when all enabled filters are satisfied. An alert() call fires on the first bar of each new higher-timeframe period, with the level, the distance, and the filter states embedded in the message text.
HOW TO USE IT
Add to a daily chart. Set the ATR timeframe input to match the horizon you care about: W for a weekly-anchored level, D for a daily one. Confirm your data plan resolves both volatility symbols; substitute alternatives in the Symbols group if not.
The panel position is adjustable through the "Panel offset right of centre (%)" input, from 0 for centred through 45 for the right edge.
For notifications: right-click the chart, Add alert, select this indicator as the condition, choose "Any alert() function call", and set the frequency to Once Per Bar so it fires at the start of a new period rather than at its close.
The "Anchor on forming period" input switches the level to use the in-progress higher-timeframe bar rather than the last completed one. This produces a value that updates continuously through the period. It is intended as a preview of where the next period's level is forming, not as a signal, and it will change intrabar.
ORIGINALITY
Prior-close-minus-ATR levels are a well-established concept and several published indicators plot them, most notably Saty Mahajan's ATR Levels, which plots a full Fibonacci ladder of them across six timeframe modes. This script is not a republication of that work and does not reuse its code. It differs in scope and purpose:
It plots one level rather than a ladder, to keep the chart readable when the level is the only thing being monitored.
It adds volatility term structure and absolute volatility as explicit gating conditions, which existing ATR level indicators do not evaluate.
It rounds the level to a user-defined increment.
It emits a dynamic alert message containing the computed values, so the notification is self-contained and requires no chart lookup.
The arithmetic that produces the level is standard and deliberately matches the conventional definition so that values are comparable with other implementations.
LIMITATIONS AND SHORTCOMINGS
The level is descriptive, not predictive. It describes a distance in volatility units. Price reaching or not reaching it carries no guarantee of any kind.
The term structure filter depends on external symbols. If your data plan does not provide them, the filter cannot be evaluated and the table will not populate correctly. Verify both symbols resolve before relying on it.
Volatility index data is daily. The filter therefore updates on a slower cadence than the chart and can be stale relative to fast intraday moves.
The absolute volatility floor is a coarse proxy. It says nothing about the actual pricing of any instrument.
On index CFD feeds, the underlying value can differ slightly from the cash index. Where the level is near a rounding boundary, the rounded output may differ between feeds.
The forming-period preview mode updates continuously and is not a fixed reference.
No backtest or performance statistics are presented, because this is an indicator and not a strategy. Nothing here has been tested as a system.
CREDITS
The prior-close-minus-ATR level concept is widely used. Saty Mahajan's open-source ATR Levels indicator is the best-known implementation on TradingView and is worth reviewing for a fuller treatment of the concept across multiple timeframe modes and Fibonacci ratios.
DISCLAIMER
This script is provided for educational and analytical purposes. It is not financial, investment, or trading advice, and it is not a recommendation to buy or sell anything. Volatility-based levels describe historical range behaviour and carry no predictive guarantee. Any use of this tool is at your own risk.# TradingView publication description Indicador

Pattern Atlas : Candlestick [AxeAlgo]Pattern Atlas : Candlestick
WHAT THIS LIBRARY IS
This is a Pine Script v6 library of 23 candlestick pattern detectors — one exported function per pattern family, each doing pure open/high/low/close arithmetic against the current or a specified historical bar. There is no plotting, no alerts, and no inputs in this script by design: a library's job is to hand other scripts a clean, reusable, well-documented API, not to draw on a chart itself (Pine doesn't allow a library to plot anything anyway). If you're looking for a ready-to-use indicator built on top of this library, see the companion "Pattern Atlas : Candlestick Scanner " script, which imports every function here and turns it into on-chart signals, a live scanner table, and alerts.(will be published soon)
Candlestick reading is one of the oldest and most widely taught tools in technical analysis, going back to Steve Nison's work bringing Japanese candlestick charting to Western traders. The patterns in this library follow that standard catalog (cross-checked against TA-Lib's CDL* function list, the closest thing to an industry-standard reference), so anyone who already knows what a Morning Star or a Bullish Engulfing bar looks like will recognize exactly what each function is checking for.
WHY A LIBRARY INSTEAD OF ONE MONOLITHIC INDICATOR
Splitting detection logic out as an importable library means:
- Any Pine coder building their own strategy, indicator, or screener can pull in exactly the pattern checks they need without copy-pasting candlestick math into every new script.
- The detection logic is tested and maintained in one place. When a threshold gets refined, everything importing this library benefits from the update by bumping one version number.
- It keeps the math separate from presentation — how a pattern gets drawn, colored, or alerted on is a completely separate decision from whether the pattern is actually present, and different users want different presentations.
HOW TO IMPORT AND USE IT
Add this line near the top of your script (adjust the version number to whatever the current published version is):
import AxeAlgo/PatternCandlestick/1 as cdl
Then call any function directly. Every function returns the same structure, called CandleMatch, so the calling pattern is identical no matter which of the 23 you use:
match = cdl.detectDoji()
if match.found
label.new(bar_index, low, match.patternName)
CandleMatch has six fields:
- found — true if the pattern matched at the evaluated bar, false otherwise.
- patternName — the specific name of what matched (e.g. "Hanging Man"), na when not found.
- direction — "bullish", "bearish", or "neutral".
- barIndex — the bar_index the pattern completes on.
- barsUsed — how many bars the pattern spans (1, 2, 3, or 5 for the one continuation pattern that needs a 5-bar read).
- description — a full sentence naming the pattern and the actual measured values that triggered it (body size as a percent of range, wick-to-body multiples, or the specific price levels involved, depending on the pattern) — genuinely useful for a tooltip or an alert message, not just a repeat of the pattern name.
Every function also accepts an optional offset parameter (default 0, meaning the current/most recent bar) if you want to check a pattern further back in history, plus its own set of tunable threshold parameters — how strict the "small body" or "long wick" cutoffs are — all exposed with sensible defaults so you don't have to touch them unless you want to tighten or loosen a specific pattern's sensitivity for a particular instrument.
THE 23 PATTERNS
Single-bar patterns (9) — each reads one candle's own open/high/low/close shape:
- Doji — detectDoji(). Body is negligible relative to the bar's range; open and close land almost on top of each other. Neutral.
- Long-Legged Doji — detectLongLeggedDoji(). A doji with long wicks on both sides — both directions were pushed and rejected in the same bar. Neutral.
- Dragonfly Doji — detectDragonflyDoji(). A doji with a long lower wick and almost no upper wick — buyers rejected the lows. Bullish.
- Gravestone Doji — detectGravestoneDoji(). A doji with a long upper wick and almost no lower wick — sellers rejected the highs. Bearish.
- Hammer / Hanging Man — detectHammerHangingMan(). Small body, long lower wick, negligible upper wick — the same shape read two ways depending on the prior trend: a Hammer after a decline (bullish), a Hanging Man after an advance (bearish). The function infers the prior trend automatically from a lookback window, or you can supply your own trend context.
- Inverted Hammer / Shooting Star — detectInvertedHammerShootingStar(). The mirror shape (long upper wick, negligible lower wick), same trend-dependent split: Inverted Hammer after a decline (bullish), Shooting Star after an advance (bearish).
- Marubozu — detectMarubozu(). A full-bodied candle with negligible wicks on either side — one side was in complete control from open to close. Direction follows the body color.
- Spinning Top — detectSpinningTop(). Small body with real wicks on both sides, roughly balanced — pushes both up and down failed. Neutral.
- Belt Hold — detectBeltHold(). Opens at (or almost at) one extreme with almost no wick on the opening side, then closes strongly the other way — one side controlled the entire session from the opening bell.
Two-bar patterns (6) — each compares the current bar against the one before it:
- Engulfing — detectEngulfing(). The current bar's body fully covers the prior bar's opposite-colored body.
- Harami — detectHarami(). The current bar's body sits fully inside the prior bar's opposite-colored body — the inverse of Engulfing, read as the move stalling.
- Harami Cross — detectHaramiCross(). A Harami where the contained bar is also a doji — a stronger version of the stall.
- Piercing Line / Dark Cloud Cover — detectPiercingDarkCloud(). The current bar opens beyond the prior bar's extreme and closes back past its midpoint — Piercing Line is the bullish version after a decline, Dark Cloud Cover the bearish version after an advance.
- Tweezer Top / Bottom — detectTweezer(). Two consecutive bars sharing a near-identical high (Tweezer Top, bearish) or low (Tweezer Bottom, bullish) — the level held on both attempts.
- Kicker — detectKicker(). A gap between two opposite-colored bars with zero overlap between their bodies — an abrupt, no-transition reversal in sentiment.
Three-bar-and-longer patterns (8) — each reads a short sequence of bars together:
- Morning Star / Evening Star — detectStar(). A large bar, a small bar gapped away from it, then a third bar closing back past the midpoint of the first — the classic three-bar reversal, bullish (Morning) at the bottom or bearish (Evening) at the top.
- Morning Doji Star / Evening Doji Star — detectDojiStar(). The same structure as the Star pattern above, but the middle bar is specifically a doji — a stronger version of the signal.
- Three White Soldiers / Three Black Crows — detectThreeSoldiersCrows(). Three consecutive same-direction bars, each opening inside the prior body and closing beyond the prior close — steady, sustained buying or selling.
- Three Inside Up / Down — detectThreeInside(). A Harami followed by a third bar closing beyond the first bar's open, confirming the stall seen in the Harami actually turned into a reversal.
- Three Outside Up / Down — detectThreeOutside(). An Engulfing followed by a third bar extending the same move, confirming the reversal.
- Abandoned Baby — detectAbandonedBaby(). A Doji Star with a genuine price gap (not just a wick gap) on both sides of the middle bar — a rare, high-conviction reversal.
- Rising / Falling Three Methods — detectThreeMethods(). A strong trend bar, three small counter-trend bars fully contained inside its range, then a bar resuming the original direction beyond the first bar's close — the trend paused without reversing. This is the one pattern spanning 5 bars rather than 1-3.
- Stick Sandwich — detectStickSandwich(). Two bearish bars with matching closes sandwiching one bullish bar in between — sellers failed to push the close any lower on the second attempt.
WHAT THIS LIBRARY DELIBERATELY DOES NOT DO
No plotting, no drawing, no alertcondition() calls, and no inputs — Pine doesn't allow any of those inside a library in the first place, since a library can never be added to a chart on its own. If you want signals, a scanner table, or alerts, import this library into your own script (or use the companion "Pattern Atlas : Candlestick Scanner " indicator, which does exactly that) rather than expecting this script to render anything by itself.
This library also does not evaluate multi-timeframe data, volume, or broader market structure — it's candlestick shape and price-only, on purpose, so its behavior is easy to reason about and easy to reuse as one building block among several.
PART OF A LARGER SERIES
This is Library #1 in the AxeAlgo Pattern Atlas — a planned set of Pine libraries splitting pattern detection by the method actually used to find each kind of pattern: candlestick shape (this library), classical chart/geometric patterns (trendline-based structures like triangles, head and shoulders, flags), harmonic patterns (Fibonacci-ratio XABCD structures), and market-structure concepts (order blocks, liquidity, Wyckoff-style events). Each library is independent and useful on its own; together they're meant to cover technical pattern analysis without forcing unrelated detection methods into the same function.
A NOTE ON REPAINTING
Every function here evaluates whatever bar you point it at (the current bar by default, via the offset parameter) using that bar's own open/high/low/close. On the currently-forming bar, those values are still changing tick to tick — that's inherent to reading live price action, not a defect in this library. If you're building persisted signals, drawings, or alerts on top of these functions (rather than a live "what's happening right now" readout), gate your usage on barstate.isconfirmed so a signal only fires once the bar it describes has actually closed, exactly like the companion scanner indicator does.
DISCLAIMER
This library is a technical analysis tool for identifying classical candlestick shapes in historical and live price data. It does not predict future price movement, and a detected pattern is a description of past price action, not a signal guaranteed to repeat. Nothing in this script constitutes financial advice. Always combine pattern recognition with your own risk management and broader analysis before making any trading decision.
Biblioteca

Indicador

Custom Key LevelsCustom Key Levels
Simple tool for plotting your own price levels — support/resistance, liquidity zones, order blocks, whatever you're tracking. Set up to 10 levels, name them yourself, get alerted when price hits them. No auto-detection, no fancy calculations — just your levels, on your chart, the way you want them to look.
What it does
10 level slots, each with its own on/off switch, name, price, and color
Pick short tags near the current price or full lines across the whole chart
Solid/dashed/dotted, adjust width and label size
Turn labels off if you just want clean lines with no text
Crossing alerts built in — get pinged when price crosses a level, and the alert message tells you which one
Indicador

Change of Character (CHoCH) Alert System [algotim]Change of Character (CHoCH) Alert System is a market structure signal tool focused on a single event: a confirmed shift in directional bias. Rather than labeling every Break of Structure and CHoCH the way many public structure scripts do, this indicator deliberately ignores continuation breaks and limits both the chart and the alert feed to the moments where the prevailing character of the market actually flips.
Problem Statement
Most public CHoCH implementations classify a character change purely on the direction of a swing break, with no measure of how convincing that break actually was. This creates two practical issues for anyone building alerts around structure. Every minor swing wobble can trigger a notification, producing alert fatigue, and there is no way to separate a decisive character change from one that barely closed beyond the swing level. This script addresses both issues with a close-confirmed CHoCH-only detection engine and a built-in confidence grading step applied to every signal.
Methodology
The script maintains a single structure register holding the most recent confirmed swing high and swing low, located with standard pivot detection over a user-defined pivot length. When the adaptive swing filter is enabled, a newly confirmed pivot only replaces the stored swing if its distance from the last opposite-type pivot exceeds a configurable ATR-relative threshold, which keeps insignificant micro-swings out of the structure register before they can influence a signal.
A Change of Character is only evaluated on a confirmed candle close, so nothing in the detection logic repaints once a signal has printed. A bullish CHoCH requires a close above the last swing high while the tracked bias is bearish or undefined. A bearish CHoCH requires a close below the last swing low while the tracked bias is bullish or undefined. A break that occurs while the bias already agrees with the break direction is treated as ordinary continuation and is not flagged.
Two optional filters gate confirmation further. A displacement filter requires the breaking close to clear the swing level by a minimum ATR multiple, removing marginal breaks. A momentum filter requires the breakout candle's body to represent a minimum percentage of its total range, removing breaks driven mostly by wick with little real conviction behind the close.
Once a CHoCH is confirmed, the broken swing level is projected forward on the chart as an active structure line. If a later confirmed close moves back through that level, the structure is marked invalidated and the projection line is dimmed, separately from the detection of any new CHoCH.
Signal Workflow
Track the most recent confirmed swing high and swing low using pivot detection.
Apply the adaptive swing filter to reject pivots too close to the last opposite-type pivot.
On each confirmed candle close, test for a close beyond the stored swing level against the current bias.
Apply the displacement filter to confirm the close cleared the level by a minimum ATR multiple.
Apply the momentum filter to confirm the breakout candle's body-to-range ratio meets the minimum threshold.
Score the confirmed breakout candle on displacement in ATR units and body-to-range ratio to produce a Weak, Moderate, or Strong confidence grade.
Flip the tracked bias, plot the CHoCH label with its grade, and project the broken level forward as an active structure line.
Continue monitoring the active structure line and mark it invalidated if a later confirmed close moves back through it.
Why This Indicator Is Different
Many structure tools plot every Break of Structure alongside every CHoCH, leaving the trader to filter out which events represent an actual change in character.
This script omits BOS events entirely and reports only confirmed CHoCH signals, which are the events that correspond to a bias flip.
Each confirmed CHoCH is scored using two independent factors measured on the breakout candle itself, its ATR-normalized displacement past the level and its body-to-range ratio, rather than being treated as a single undifferentiated event.
The confidence grade is written into the alert message text at the moment the event fires, which requires composing the message dynamically rather than relying on a fixed template.
The swing level broken by a CHoCH remains tracked after the signal fires, so a later close back through that level produces a distinct invalidation alert rather than silently vanishing into the next structure calculation.
Detection is restricted to confirmed candle closes throughout, so the bias, the grade, and the invalidation state cannot change intrabar once printed.
Inputs
Structure Engine
Swing Pivot Length
Adaptive Swing Filter
Filter Threshold (ATR multiple)
Break Confirmation
Displacement Filter
Displacement Multiplier
Momentum Filter
Minimum Body % of Range
ATR Length
Visual Settings
Show Swing Points
Show Structure Projection
Projection Extension
Show Trend Background Wash
Color Candles After CHoCH
Show Confidence Grade
Label Size
Bullish, Bearish, and Projection colors
Status Panel
Show Status Panel
Panel Position
Alerts
Alert: Bullish CHoCH
Alert: Bearish CHoCH
Alert: Bullish Structure Invalidated
Alert: Bearish Structure Invalidated
Alerts
Alerts are available for:
Bullish CHoCH confirmed on a closed candle, with the confidence grade included in the alert message
Bearish CHoCH confirmed on a closed candle, with the confidence grade included in the alert message
Bullish structure invalidated after a confirmed close back below an active bullish level
Bearish structure invalidated after a confirmed close back above an active bearish level
Practical Usage
Use a shorter pivot length on intraday charts to react to structure earlier, combined with the displacement and momentum filters to avoid marginal breaks.
Use a longer pivot length on higher timeframes to isolate structurally significant character changes only.
Treat a Strong-grade CHoCH as a higher-conviction event than a Weak-grade CHoCH when weighing entry timing or position sizing.
Watch for a structure invalidated alert shortly after a CHoCH, since it indicates price has returned through the level that produced the signal.
Use the status panel as a quick reference for the current bias and the most recent CHoCH grade without needing to scan the chart for labels.
Limitations
Swing highs and lows depend on confirmed pivots, which require the full pivot length of bars to close on both sides before becoming available, introducing a disclosed confirmation lag.
The displacement and momentum filters reduce signal frequency by design, which means fewer but more selective CHoCH events compared to unfiltered structure break detection.
Structure invalidation reflects a return through a previously broken level and does not attempt to forecast subsequent price direction.
This indicator identifies structural events only and does not constitute financial advice or a complete trading system on its own.
Notes
All structural state, including the tracked bias, the active levels, and the confidence grade, is evaluated only on a confirmed candle close, so nothing in this script repaints once printed.
The only lag in the system is the standard pivot confirmation lag inherent to pivot-based swing detection, which is disclosed above rather than hidden.
Designed for dark theme charts. On light themes, consider darkening the projection line color for improved contrast. Indicador
