Pine Script® Indikator
BAR
Turtle Soup Reversal Map [AGPro Series]Turtle Soup Reversal Map
🔹 Overview
Turtle Soup Reversal Map is a mean-reversion pattern detector inspired by Linda Raschke's classic "Turtle Soup" setup — a counter-attack on failed 20-bar breakouts. When price pierces a multi-bar extreme and then closes back inside the prior range, institutional traders often interpret it as trapped breakout participants being flushed. This script automates the detection, qualifies each setup with a transparent 0–100 score, and projects a reference target alongside an auto-resolving rejection zone. It is designed for traders who want a disciplined, rule-based way to spot failed breakouts without drawing them manually.
🔹 Unique Edge
Unlike generic liquidity-sweep or wick-rejection indicators, Turtle Soup Reversal Map is built around Raschke's specific 20-bar-extreme rule — a pattern with decades of documented performance in swing-trading literature. Three characteristics separate it from similar tools:
• Strict N-bar-extreme definition (not a simple swing-high/low fade). Price must violate the exact prior-lookback extreme, not just a minor pivot.
• Five-component adaptive quality score — wick rejection, volume spike, overshoot magnitude, higher-timeframe trend alignment, and key-level proximity. Each component is a transparent weighted contribution, with clear A+ / A / B / C grades.
• Full lifecycle state engine — Pending → Fired → Target/Stop/Invalidated. Setups that do not confirm within their window are auto-invalidated (not left hanging), and live win-rate plus average R-multiple are tracked over the most recent resolved setups.
🔹 Methodology
The script continuously monitors for price piercing the highest high or lowest low of the prior N bars (default 20, range 10–50). When a sweep occurs, a Pending setup is created. Confirmation is then evaluated in one of two user-selectable modes:
• Same-Bar Close — the violating bar must close back inside the prior range on the same bar (faster, more signals).
• Next-Bar Close — Raschke's original specification; the next bar must close back inside the prior range (slower, higher reliability).
If confirmation fires, the setup becomes Fired and a reference target is projected from the confirmation close (default 2.5 × ATR(14)). Stop is placed at the sweep extreme plus a configurable ATR buffer. Setups that fail to confirm within their window, or where price overshoots the stop before confirmation, are automatically invalidated.
The quality score blends: wick-to-range ratio at the extreme bar, relative volume spike versus its 20-bar average, overshoot magnitude (ATR-normalized with a sweet-spot curve), counter-trend alignment against a user-defined higher timeframe, and proximity to round numbers or recent pivot levels.
🔹 Signals & Alerts
The script produces three alert types, all configurable:
• Pending — sweep detected, awaiting confirmation.
• Fired — confirmation closed back inside prior range.
• Invalidated — setup dismissed due to overshoot or window timeout.
Each alert message includes direction (Bull/Bear), current grade, ticker, and timeframe. Fired setups are visualized with a labeled confirmation marker, a dashed target-projection line, a dotted stop-reference line, and an auto-closing rejection zone. Labels display the Soup-Bull / Soup-Bear name, grade, and numeric score.
🔹 Key Inputs
• Lookback Bars — size of the extreme window (default 20, range 10–50).
• Confirmation Mode — Same-Bar Close or Next-Bar Close.
• Invalidation Distance (ATR) — stop buffer beyond the sweep extreme (default 0.5).
• Target Projection (ATR) — reference reversal target distance from entry (default 2.5).
• Quality Score Components — each of the five score components can be toggled independently for custom configurations.
• HTF for Trend — higher timeframe used for the trend-alignment component (default 240 min).
• Stats Sample Size — rolling window of resolved setups used for win-rate and average reward metrics (default 30).
• Visual & Panel Options — zones, lines, labels, target projection, panel location, font sizes, and per-element toggles.
🔹 How to Use
1. Apply to any liquid instrument and timeframe. The pattern's rule set is symbol-agnostic but performs differently across assets — review the live Win Rate and Avg Reward metrics in the panel to calibrate expectations.
2. Watch the Status field in the panel. Idle means no active setup; Pending Bull/Bear means a sweep has occurred and the script is waiting for confirmation; Fired Bull/Bear means confirmation closed and a target has been projected.
3. Filter setups by grade. A+ and A setups have stronger confluence — particularly wick rejection, volume, and HTF alignment. B setups are acceptable under favorable market regimes; C grades are educational only.
4. Treat the target projection as a reference, not a trade instruction. The stop reference line marks where the structural invalidation lies. Always combine with your own risk management.
5. The historical Win Rate is computed over the last N resolved setups on the current chart; it reflects the pattern's fit with the current symbol and timeframe, not a guarantee.
🔹 Limitations & Transparency
This indicator identifies historical setups algorithmically. It does not predict future price movement, and no indicator does. Turtle Soup is a counter-trend mean-reversion pattern — in strong trending regimes, false signals increase; in consolidation and range-bound conditions, it performs best. The displayed Win Rate and Avg Reward are historical, rolling, chart-dependent, and should not be interpreted as future expectations. Target and stop references are geometric projections based on ATR, not optimized parameters.
🔹 Risk Disclosure
This script is a technical analysis tool for educational and research purposes. It is not a trading strategy, not a recommendation, and not financial advice. Past performance does not guarantee future results. Always conduct your own analysis and use proper risk management. Trade at your own risk.
Pine Script® Indikator
AG Pro Inside Bar Breakout Quality [AGPro Series]AG Pro Inside Bar Breakout Quality
Overview / What it does
AG Pro Inside Bar Breakout Quality is an overlay tool built to study one of the market’s most familiar compression structures: the inside bar. Instead of stopping at simple detection, the script evaluates what happens after the pattern forms and grades the breakout attempt with a structured quality model. The result is a workflow-oriented view of inside bar compression, breakout strength, and failed continuation behavior.
The script first identifies a strict inside bar condition, where the current bar remains fully contained within the previous bar’s range. That parent range becomes the active reference zone. From there, the script monitors whether price resolves above or below the structure, whether the move is confirmed by close, whether volume supports the breakout, and whether the breakout later fails and re-enters the range within a user-defined window.
This is not designed as a generic “any breakout” marker. Its purpose is narrower and more specific: it focuses on a compact volatility contraction event, then measures how decisively price leaves that compression. In practical chart work, this helps separate a low-commitment range poke from a more convincing expansion move.
The visual presentation is intentionally structured. Inside bar zones are boxed, breakout direction is marked, quality is scored, and fakeouts are labeled when the breakout reverses back into the monitored range. This makes the script suitable for traders who want a cleaner way to inspect inside bar behavior without manually drawing every structure.
Unique Edge
The main difference here is that the script does not treat every inside bar break as equally meaningful. Many tools stop at “pattern detected” or “level broken.” This script adds a second layer: breakout quality. That layer is derived from close position, volume context, candle body participation, and alignment with the parent candle’s directional bias.
A second differentiator is the built-in fakeout logic. After a breakout is detected, the script continues to watch price for a limited number of bars. If the move quickly returns back through the breakout boundary, the event is tagged as a fakeout. This adds post-event context instead of only marking the first directional move.
Another distinction is that the methodology is deterministic and chart-native. The logic is rule-based, visible, and reproducible from bar to bar. Users can decide whether to require close confirmation beyond the inside bar range, whether to require volume confirmation, and how strict they want the displayed threshold to be through the minimum score filter.
In short, this script is not only about finding compression. It is about ranking the quality of the expansion attempt that follows the compression, while also acknowledging that some breakouts fail quickly and should be read differently.
Methodology
1) Inside Bar Detection
An inside bar is identified when the current bar’s high is lower than the previous bar’s high and the current bar’s low is higher than the previous bar’s low. This creates a strict containment definition based on the previous candle’s full range.
2) Reference Zone
Once an inside bar is detected, the prior candle becomes the parent reference bar. Its high and low define the active breakout boundaries. That range can be visualized as a box, with an optional midpoint line to make the compression zone easier to read on chart.
3) Breakout Confirmation
A bullish breakout occurs when price moves above the parent high. A bearish breakout occurs when price moves below the parent low. Users can choose whether breakout confirmation should be based on close beyond the range or on a less restrictive intrabar break condition.
4) Quality Score
Each breakout can be scored on a 0–10 scale. The score is built from multiple components:
- close position relative to the inside bar boundary
- volume ratio versus the selected moving average
- body participation within the breakout candle’s total range
- directional alignment between the breakout and the parent candle bias
This scoring model is designed to estimate how committed the breakout candle appears, rather than assuming all breaks have equal informational value.
5) Fakeout Detection
If enabled, the script monitors a user-defined number of bars after breakout. A bullish breakout that returns back below the upper boundary within that window is labeled as a bull trap / fakeout. A bearish breakout that returns back above the lower boundary within that window is labeled as a bear trap / fakeout.
6) Visual Layer
The script can display the inside bar zone, midpoint, breakout arrows, score labels, and fakeout markers. A summary panel tracks aggregate statistics such as total inside bars, total breakouts, breakout direction counts, fakeouts, and the latest breakout score.
Signals & Alerts
The script can provide alert conditions for:
- bullish inside bar breakout
- bearish inside bar breakout
- fakeout detection
- high-quality breakout events
- any breakout event
These alerts are intended to help users monitor the pattern and its resolution more efficiently. They do not replace trade planning, confirmation from broader market context, or independent risk management.
Key Inputs
Min Score to Show Breakout
Filters displayed breakout labels by quality threshold. This can be useful for reducing low-quality visual noise.
Volume Confirmation Required
When enabled, breakout evaluation requires volume to be above its moving average threshold. This can help remove low-participation breaks.
Volume MA Period
Defines the lookback length for average volume comparison.
Require Close Beyond IB
When enabled, breakout confirmation depends on bar close beyond the parent range. This creates a more conservative and more stable breakout definition.
Max IBs to Display
Controls how many recent structures and related objects remain visible on chart.
Show IB Box / Midline / Breakout Arrow / Score Label
Lets users decide how much visual detail they want to keep on screen.
Glow Effect on High Score
Adds emphasis to stronger breakout events without changing the underlying logic.
Fakeout Window
Defines how many bars after breakout the script should continue monitoring for a return back through the breakout boundary.
Limitations & Transparency
This script studies inside bar compression and subsequent breakout behavior. It does not claim to identify all meaningful consolidations, and it does not attempt to classify every market regime. The methodology is intentionally focused on one structure.
The score is a rule-based quality model, not an objective measure of future outcome. A high score does not guarantee continuation, and a lower score does not guarantee failure. It simply reflects how the breakout candle and its context behave according to the script’s internal criteria.
Volume-based interpretation may vary across symbols and markets. On some instruments, especially those with inconsistent or synthetic volume data, volume confirmation may be less informative than on others. Users should evaluate whether volume filtering is appropriate for the asset they are studying.
Fakeout detection is also definition-dependent. The script labels a fakeout when price returns through the breakout boundary within the selected lookback window. Different traders may prefer a different timing window or a different failure definition.
As with any overlay, chart readability depends on market volatility, timeframe, and user settings. On lower timeframes or during highly active periods, more visual events may appear. The built-in filters and display controls are there to help manage that density.
Risk Disclosure
This script is an analytical tool for chart study. It is not financial advice, not a trade recommendation, and not a promise of future results.
Inside bar breakouts can behave differently across timeframes, instruments, and market regimes. Users should not rely on a single pattern, score, or alert in isolation. Context still matters, including trend condition, liquidity environment, nearby structure, volatility regime, and execution discipline.
Before using this script in any live decision process, it should be reviewed in the specific market and timeframe relevant to the user’s own approach. Testing, observation, and risk controls remain essential.
Pine Script® Indikator
AG Pro Fair Value Gap Engine [AGPro Series]AG Pro Fair Value Gap Engine
OVERVIEW / WHAT IT DOES
AG Pro Fair Value Gap Engine is a rules-based overlay built to detect 3-bar fair value gap structures and organize them as a living imbalance map on the chart.
The script identifies bullish fair value gaps when the current low is above the high from two bars earlier, and bearish fair value gaps when the current high is below the low from two bars earlier. Once detected, each zone is stored, rendered, tracked through time, and updated as price interacts with it.
Instead of stopping at basic FVG detection, this script continues to follow the structure after creation. It monitors whether the gap remains active, whether price returns into it, whether mitigation occurs, how old the structure has become, and how strong or weak that mitigation event appears relative to the gap itself.
The result is not just a visual list of imbalances. It is an FVG lifecycle model designed to help traders distinguish between fresh gaps, aging gaps, mitigated gaps, and higher-quality mitigation events.
UNIQUE EDGE
Many fair value gap tools simply highlight every detected gap and leave the user to interpret the rest.
This script is built around a different idea:
not all FVGs deserve the same attention, and not every mitigation event carries the same informational value.
AG Pro Fair Value Gap Engine separates itself by combining detection, aging, prioritization, mitigation tracking, and scoring in a single structured workflow. Gaps are not treated as static rectangles. They are treated as evolving chart objects with a lifecycle.
Within the AG Pro Series, this script is also distinct from breakout-quality, reclaim, rotation, pressure, or acceptance-style overlays. Those models focus on trend behavior, reclaim behavior, structural confirmation, momentum pressure, or price acceptance around a reference. This one is centered on imbalance structure itself: where the 3-bar gap formed, how long it stayed relevant, whether price returned, and how credible that mitigation looked once interaction happened.
In practical terms, the script is designed to answer questions such as:
Which FVGs are still active?
Which ones are becoming stale?
Which mitigation events happened with better quality?
Which visible zones are worth keeping in focus, and which are just legacy context?
That is the core difference. This is not a generic FVG highlighter. It is an imbalance-ranking and mitigation-quality engine.
METHODOLOGY
1) Detection Logic
The script scans for standard 3-bar fair value gap structures.
Bullish FVG:
current low > high from two bars back
Bearish FVG:
current high < low from two bars back
A minimum size filter relative to ATR is applied so that very small gaps can be ignored when desired.
2) Structure Tracking
After detection, each FVG is stored and tracked over time. The script keeps the zone on the chart, extends active zones forward when enabled, and updates their visual state as the market evolves.
This allows the chart to preserve the structural memory of imbalance zones instead of treating every new gap as an isolated event.
3) Aging and Visual Decay
Older gaps gradually lose visual priority through fade logic. This helps newer or more relevant structures stay readable while old zones move into the background.
Optional controls can also suppress distant legacy zones when they become both old and far from current price.
4) Mitigation Logic
The script monitors how deeply price returns into each gap. When the user-defined mitigation threshold is reached, the FVG is marked as mitigated.
Mitigated zones can remain visible as context or be hidden for a cleaner chart, depending on preference.
5) Quality Scoring
Mitigation is not treated as a simple yes/no event. The script evaluates mitigation quality using a weighted model that includes:
- Gap size relative to ATR
- Speed of return into the zone
- Relative volume during the mitigation event
- Return strength after contact with the gap
This produces a normalized score intended to help separate weaker fills from stronger, better-formed mitigation behavior.
6) Focus and Prioritization
To reduce chart noise, the script includes focused labeling, active-zone prioritization, top-zone filtering, and legacy suppression logic.
This means the visual output can be tuned away from “show everything” and toward “show what matters most.”
SIGNALS & ALERTS
This script provides alert conditions for:
- Newly detected bullish fair value gaps
- Newly detected bearish fair value gaps
- Bullish fair value gaps reaching mitigation
- Bearish fair value gaps reaching mitigation
These alerts are event-based and rules-based. They are not forecasts, predictions, or trade instructions.
The labels and panel are designed to summarize state, not to replace the user’s broader market process.
KEY INPUTS
Core Settings
- Minimum FVG Size (ATR)
- Mitigation Threshold (%)
- Maximum Tracked FVG Count
- Age Fade Length
- Extend Active FVG Boxes
Scoring Engine
- Speed Score Reference
- Volume Score SMA Length
- Volume Score Max Ratio
- Size Score Max ATR
Visual Settings
- Show FVG Labels
- Focused Label Mode
- Focused Label Minimum Score
- Active / Mitigated Label Age Limits
- Highlight Score Threshold
- Theme Preset
- Show Mitigated Zones
- Show Mitigated Zone Labels
- Label Horizontal Offset
- Hide Distant Legacy FVGs
- Legacy Hide Age
- Legacy Hide Distance
- Show Only Top Active Zones
- Top Active Zones Count
- Label Stack Spacing
Panel Settings
- Show Panel
- Panel Position
- Panel Font Size
These controls allow the same logic to be used in a more information-dense mode or in a much cleaner presentation mode, depending on the charting style of the user.
LIMITATIONS & TRANSPARENCY
This script detects and organizes 3-bar imbalance structures. It does not claim to identify every meaningful liquidity event, order-flow shift, or broader smart money context factor on its own.
A fair value gap can remain open for a long time, fail quickly, or be revisited multiple times. A high score does not guarantee a directional outcome. A low score does not automatically invalidate the zone as context.
The mitigation score is a structured ranking model, not an objective truth about future price behavior. It is designed to help compare events inside the framework of this script.
Because chart structure, volatility, timeframe, and instrument behavior vary, users should expect different FVG densities and different score distributions across markets.
This tool is best used as a market-organization layer for imbalance analysis, not as a standalone execution system.
RISK DISCLOSURE
AG Pro Fair Value Gap Engine is an analytical charting tool for educational and informational use.
It does not provide financial advice, does not promise outcomes, and should not be interpreted as a standalone buy or sell system. Fair value gaps, mitigation events, and score readings should be evaluated together with market structure, volatility, timeframe context, liquidity conditions, and the user’s own risk framework.
Trading involves risk. Past chart behavior does not guarantee future results.
Pine Script® Indikator
Realtime Candle Ticks (High-Low)Realtime tick counter per bar
Counts the number of ticks per bar in realtime
Pine Script® Indikator
3D MACD Bar Plot [LuxAlgo]The 3D MACD Bar Plot indicator provides a multi-dimensional visualization of MACD values across a user-defined range of fast and slow EMA lengths. By projecting these values into a 3D grid, the tool allows traders to observe momentum clusters and identify robust trends that persist across various parameter settings.
🔶 USAGE
The indicator aims to solve the problem of "parameter sensitivity" by showing the MACD histogram for many different settings simultaneously. Instead of looking at a single (12, 26, 9) MACD, users can see a surface of momentum.
🔹 Identifying Momentum Clusters
When the majority of the 3D bars are tall and colored with the bullish color, it indicates a "momentum cluster" where most EMA combinations agree on a strong uptrend. Conversely, a mix of small bullish and bearish bars suggests a choppy or transitioning market where different settings are providing conflicting signals.
🔹 Trend Robustness
A robust trend is visible when the entire 3D surface slopes steeply in one direction. If only a small corner of the grid (specific EMA combinations) is showing strength while the rest remains flat, the trend may be fragile or limited to a specific timeframe/sensitivity.
🔹 3D Projection
The script uses a pseudo-3D isometric projection.
The Fast Axis represents variations in the Fast EMA length.
The Slow Axis represents variations in the Slow EMA length.
The Height (Z-axis) represents the resulting MACD value (Fast EMA - Slow EMA).
🔶 DETAILS
The tool calculates a matrix of MACD values by iterating through the "Step" values provided in the settings. It then maps these values to a 2D coordinate system on the chart to create the illusion of depth.
To maintain performance and visual clarity, the script uses a snaking polyline algorithm to draw the grid and surface. The bars also feature dynamic transparency: bars further back in the "depth" of the 3D space are more transparent, helping the user focus on the overall shape of the momentum surface rather than individual lines.
🔶 SETTINGS
🔹 Grid Configuration
Fast Min/Max/Step : Defines the range and increments for the Fast EMA lengths used in the calculation.
Slow Min/Max/Step : Defines the range and increments for the Slow EMA lengths used in the calculation.
🔹 3D Projection Settings
Y Baseline Price : Adjusts the vertical anchor point of the 3D plot.
X Spacing (bars) : Controls the horizontal spread between the 3D grid points.
Z Height : Scales the height of the MACD bars relative to the grid spacing.
🔹 Style
Bullish/Bearish Color : Sets the colors for positive and negative MACD bars.
Grid Color : Controls the color of the connecting surface lines and the base grid.
Pine Script® Indikator
StO Price Action - Daily Outside BarShort Summary
- Outside Bar indicator with multiple range calculation algorithms
- Highlights where the current range fully engulfs the previous
- Works with Daily candles in Daily, H4, and H1 timeframes only
- Highlights the current bar when it engulfs the previous bar according to the selected method
Full Description
Overview
- Identifies bars where the current period's range fully engulfs the prior period's range
- Offers three algorithms for defining the engulfing range:
- High/Low: uses absolute high and low values
- Open/Close: considers candle direction (bull/bear) and compares opens and closes
- Open/Close II: stricter version with exclusive inequalities for engulfing
- Engulfing behavior is detected automatically and highlighted for easy recognition
- Works on multiple markets but restricted to D, H4, and H1 charts for accuracy
Controls
- Year lookback (YLB) configurable to filter older bars
- Custom background color for highlighting Outside Bars
- Simple toggle interface with minimal chart clutter
Visual Representation
- Highlights engulfing bars with configurable background color
- Color transparency adjustable for clarity
Usage
- Use to identify strong market momentum or potential reversals
- Helps spot high-probability setups based on engulfing price action
Notes
- Only compatible with Daily, H4, and H1 timeframes
- Non-repainting: once an Outside Bar is drawn, it will not adjust retroactively
- Best used as a market structure reference not a direct trade signal
Pine Script® Indikator
Bar Count Custom Start TimeThis simple bar count script lets you configure when you want to start your count in case you have the globex charts in use for your assets.
Example NYSE:
Set start hour to: 8
Set start minute to: 30
Example DAX:
Set start hour to: 2
Set start minute to: 0
The indicator is based on the "Bar Count" indicator from GYH9 - many thanks!
Can be found here:
Pine Script® Indikator
Pine Script® Indikator
Alert N seconds before candle closeThe indicator alerts about the closing of the candle in N seconds.
Instruction:
1. Add an indicator
2. Specify the time in the indicator settings
3. Alt+A, Condition - choose indicator
Pine Script® Indikator
Inside Bar (Body-based) Ind/AlertDescription:
This indicator detects Inside Bar patterns based strictly on the candle body (open/close range) of the mother candle, rather than the traditional high/low wick method. An inside bar is highlighted when the current candle’s entire body is contained within the body of the previous candle.
It can be useful for traders who want a more conservative and reliable definition of inside bars, focusing on true consolidation periods and filtering out signals caused by extended wicks.
Features:
Body-based Inside Bar detection:
The indicator colors and marks candles where the current bar’s body is fully within the previous bar’s body.
Bullish/Bearish identification:
Bullish inside bars are marked in green, bearish in red.
Double Inside Bar Detection:
An optional feature marks when two consecutive candles’ bodies are inside the same mother bar body—potentially indicating stronger consolidation.
Alerts:
Set alerts for single or double inside bars for automated monitoring.
How to Use:
Add the indicator to your chart.
Look for colored bars or plotted shapes for inside bar signals based on candle bodies.
Use alerts to get notified in real time when inside bar patterns appear.
Note:
This script uses only the candle body (open and close) for inside bar calculations, which may help filter out less reliable signals found with wick-based approaches.
Pine Script® Indikator
Bar Count for XAUThis TradingView indicator labels every other five-minute candle for XAU during the current Beijing session, which runs from 06:00 to 05:00 the next day. It shows the actual bar numbers—1, 3, 5, and so on—only for today’s session; yesterday’s labels are automatically cleared at the new open. The tags appear just below each qualifying candle with no background box, and you can adjust the font size in the settings. In short, it gives you a clean, real-time visual of intraday bar order without clutter
Pine Script® Indikator
Session Coloring Bar with ICT Macro [dani]The Session Coloring Bar is customizable Pine Script indicator designed to visually enhance your charts by applying unique colors to specific trading sessions or timeframes. This tool allows traders to easily identify and differentiate between macro sessions (e.g., 24-hour cycles) and custom-defined sessions (e.g., Session A, Session B), making it ideal for analyzing market activity during specific periods.
In the context of trading, the term "ICT Macro" , as discussed by Michael J. Huddleston (ICT), refers to specific timeframes or "windows" where market behavior often follows predictable patterns. Traders typically focus on the last 10 minutes of an hour and the first 10 minutes of the next hour (e.g., 0150-0210 , 0050-0110 , or 0950-1010 ) to identify key price movements, liquidity shifts, or market inefficiencies.
This script highlights these macro timeframes, enabling traders to visually analyze price action during these critical periods. Use this tool to support your strategy, but always combine it with your own analysis and risk management.
With this indicator, you can:
Highlight Macro Sessions : Automatically color bars based on predefined 24-hour macro sessions.
Customize Session Settings : Define up to three custom sessions (A & B) with individual start/end times, visibility toggles, and unique bar colors.
Timeframe Filtering : Hide session coloring above a specified timeframe to avoid clutter on higher timeframes.
Personal Notes : Add comments to each session for better organization and quick reference.
Dynamic Color Logic : Bars are colored based on their direction (up, down, or neutral) within the active session.
How to Use:
Enable/Disable Sessions :
Use the Show Coloring toggle to enable or disable session coloring for Macro, Session A, Session B, or Session C.
Set Session Times :
Define the start and end times for each session in the format HHMM-HHMM (e.g., 1600-0930 for an overnight session).
Choose Colors :
Assign unique colors for upward (Bar Up) and downward (Bar Down) bars within each session.
Adjust Timeframe Visibility :
Use the Hide above this TF input to specify the maximum timeframe where session coloring will be visible.
Add Notes :
Use the Comment field to add personal notes or labels for each session.
Example Use Cases:
Overnight Sessions :
Highlight overnight trading hours (e.g., 1600-0930) to analyze price action during low liquidity periods.
Asian/European/US Sessions : Define separate sessions for major trading regions to track regional market behavior.
Macro Analysis : Use the predefined 24-hour macro sessions to study hourly price movements across a full trading day.
Disclaimer:
The Session Coloring Bar is not a trading signal generator and does not predict market direction or provide buy/sell signals. Instead, it is a visualization tool designed to help you identify and analyze specific trading sessions or timeframes on your chart. By highlighting key sessions and their corresponding price movements, this indicator enables you to focus on periods of interest and make more informed trading decisions.
Thank you for choosing this indicator! I hope it becomes a valuable part of your trading toolkit. Remember, trading is a journey, and having the right tools can make all the difference. Whether you're a seasoned trader or just starting out, this indicator is designed to help you stay organized and focused on what matters most—price action. Happy trading, and may your charts be ever in your favor! 😊
Pine Script® Indikator
BBr1 Candle Range Volitility Gap IndicatorModified Candle Range Volatility Gap Indicator
1. Useful to analyze bars body and wicks and volatility of security.
2. Added a Percentage Option - easier to analyze across different securities.
2. Added a Standard Deviation ("1 std dev= 68.2%, 2 std dev=95.4%, 3 std dev=99.7%, etc") based upon user defined lookback period.
3. Added the ability to include Gaps in Analysis. (Gaps are when the prior closing cost does not equal opening price)
4. Possible Uses setting up stop losses, trailing entries/exits (inside range or outside range).
5. Use it with other indicators in determining if to make an entry or close entry.
Reposted Original Description by © ka66 Kamal Advani
Visually shows the Body Range (open to close) and Candle Range (high to low).
Semi-transparent overlapping area is the full Candle Range, and fully-opaque smaller area is the Body Range. For aesthetics and visual consistency, Candle Range follows the direction of the Body Range, even though technically it's always positive (high - low).
The different plots for each range type also means the UI will allow deselecting one or the other as needed. For example, some strategies may care only about the Body Range, rather than the entire Candle Range, so the latter can be hidden to reduce noise.
Threshold horizontal lines are plotted, so the trader can modify these high and low levels as needed through the user interface. These need to be configured to match the instrument's price range levels for the timeframe. The defaults are pretty arbitrary for +/- 0.0080 (80 pips in a 4-decimal place forex pair). Where a range reaches or exceeds a threshold, it's visually marked as well with a shape at the Body or Candle peak, to assist with quicker visual potential setup scanning, for example, to anticipate a following reversal or continuation.
Pine Script® Indikator
Lost Bar Locator v1 [Yaphott]Lost Bar Locator v1 helps you locate missing data on your chart.
It does this by looking for consecutive bars that have a delta time greater than the current interval.
Two lines are drawn for each group of one or more missing bars:
Bar before the missing bar(s).
Bar after the missing bar(s).
Pine Script® Indikator
Chained Inside BarsThis script identifies consecutive inside bars by referencing only the most recent non-inside bar, so it avoids excessive lookback. An “inside” bar means its high is lower than the reference bar’s high, and its low is higher than the reference bar’s low. If the current bar is inside, it’s colored white; once price breaks outside, the script updates that new bar as the next reference.
Key Points
• Bars are compared against the last non-inside bar, chaining consecutive inside bars off that same reference bar.
• Inside bars are highlighted in white (non-inside bars retain default chart colors).
• Includes an alert condition for when a new inside bar forms.
• Prevents large dynamic indexing, making it more stable and efficient.
Use this indicator to quickly spot consecutive inside-bar formations without needing to track every single bar-to-bar relationship.
Pine Script® Indikator
First 5 Minutes Open/Close LinesThis very simple indicator paints lines at the high and low of the first 5m candle of the session. It is primarily intended for big cap NYSE traded stocks with high volume. I wrote this indicator to save me the trouble of manually drawing the lines each day.
The lines drawn at the 5m high/low will remain constant regardless of which timeframe you switch to. In the example screenshot, we are looking at the 1m timeframe. This helps us switch effortlessly between different timeframes to see if a given price movement meets our entry criteria.
In addition to drawing lines at the first 5m high/low, it will optionally paint two zones, one each around the high and low. The boundaries of this zone are configurable and expressed as a percentage of the total movement of the first 5m bar. By default, it is set to 25%.
This indicator is based on the concept that the first 5m bar always has massive volume which helps us infer that price may react around the extremes of that movement. The basic strategy works something like this:
- You identify the high timeframe (HTF) trend direction of the stock
- You wait for the first 5m candle of the session to close
- You wait for price to puncture through the outer boundary of the zone marked by the indicator.
- You enter when price retraces to the high, or low, which marks the midpoint of the punctured zone.
- Only enter long on stocks in a HTF uptrend, and short on stocks in an HTF downtrend.
- Use market structure to identify stop loss and take profit targets
Note: Use at your own risk. This indicator and the strategy described herein are not in any way financial advice, nor does the author of this script make any claims about the effectiveness of this strategy, which may depend highly on the discretion and skill of the trader executing it, among many other factors outside of the author's control. The author of this script accepts no liability, and is not responsible for any trading decisions that you may or may not make as a result of this indicator. You should expect to lose money if using this indicator.
Pine Script® Indikator
Total Bars CalculatorThis indicator simply plots how much bars are available to the user in the respective chart.
For Example if plot shows 5000 , therefore you have total 5000 bars of OHLC available.
Pine Script® Indikator
Wick %Heyo Fellas,
thanks for checking out my new indicator.
Introduction
Wick % is a simple indicator to compare wick size with body size (mode 1) and to compare wick size with candle size (mode 2).
Upper wicks are bullish when close is higher than open pricen.
Lower wicks are bearish when close is lower than open price.
Wick Theory
In general, big wick and small bodie on a bar means that bull and bears are fighting heavily.
A big wick below the body means the bulls are leading in that fight,
and a big wick above the body means the bears are leading in that fight.
Calculation Formula
Mode 1 – Percentual Increase Wick/Body:
upperWickPercentage = (upperWick / body) * 100 - 100
lowerWickPercentage = (lowerWick / body) * 100 - 100
Mode 2 – Percent Wick/Candlestick:
upperWickPercentage = (upperWick / (high - low)) * 100
lowerWickPercentage = (lowerWick / (high - low)) * 100
Usage
You can use it on every symbol and every timeframe.
The indicator repaints by default, but you can disable it in the settings.
When you disable repaint, it moves the label one bar to the right.
If you want to use the indicator for signals, you must disable repainting.
Best regards,
simwai
Pine Script® Indikator
YinYang Bar ForecastOverview:
YinYang Bar Forecast is a prediction indicator. It predicts the movement for High, Low, Open and Close for up to 13 bars into the future. We created this Indicator as we felt the TradingView community could benefit from a bar forecast as there wasn’t any currently available.
Our YinYang Bar Forecast is something we plan on continuously working on to better improve it, but at its current state it is still very useful and decently accurate. It features many calculations to derive what it thinks the future bars will hold. Let’s discuss some of the logic behind it:
Each bar has its High, Low, Open and Close calculated individually for highest accuracy. Within these calculations we first check which bar it is we are calculating and base our span back length that we are getting our data from based on the bar index we are generating. This helps us get a Moving Average for this bar index.
We take this MA and we apply our Custom Volume Filter calculation on it, which is essentially us dividing the current bars volume over the average volume in the last ‘Filtered Length’ (Setting) length. We take this decimal and multiply it on our MA and smooth it out with a VWMA.
We take the new Volume Filtered MA and apply a RSI Filter calculation on it. RSI Filter is where we take the difference between the high and low of this bar and we multiply it with an RSI calculation using our Volume Filtered MA. We take the result of that multiplication and either add or subtract it from the Volume Filtered MA based on if close > open. This makes our RSI Filtered MA.
Next, we do an EMA Strength Calculation which is where we check if close > ema(close, ‘EMA Averaged Length’) (Setting). Based on this condition we assign a multiplier that is applied to our RSI Filtered MA. We divide by how many bars we are predicting and add a bit to each predictive bar so that the further we go into the future the stronger the strength is.
Next we check RSI and RSI MA levels and apply multiplications based on its RSI levels and if it is greater than or less than the MA. Also it is affected by if the RSI is <= 30 and >= 70.
Finally we check the MFI and MFI MA levels and like RSI we apply multiplications based on its MFI levels and if it is greater than or less than the MA. It is also affected by if the MFI is <= 30 and >= 70.
Please note the way we calculate this may change in the future, this is just currently what we deemed works best for forecasting the future bars. Also note this script uses MA calculations out of scope for efficiency but there is potential for inconsistencies.
Innately it’s main use is the projection it provides. It only draws the bars for realtime bars and not historical ones, so the best way to backtest it is with TradingView’s Replay Tool.
Well, enough of the logic behind it, let's get to understanding how to use it:
Tutorial:
So unfortunately we aren’t able to plot legit bars/candles into the future so we’ve had to do a bit of a work around using lines and fills. As you can see here we have 4 Lines and 3 Zones:
Lines:
Green: Represents the High
Orange: Represents the Open
Teal: Represents the Close
Red: Represents the Low
Zones:
High Zone: This zone is from either Open or Close to the High and is ALWAYS filled with Green.
Open/Close Zone: This zone is from the Open to the Close and is filled with either Green or Red based on if it's greater than the previous bar (real or forecasted).
Low Zone: This zone is from either Open or Close to the Low and is ALWAYS filled with Red.
As you can see generally the Forecasted bars are generally within strong pivot locations and are a good estimation of what will likely go on. Please note, the WHOLE structure of the prediction can change based on the current bars movements and the way it affects the calculations.
Let's look 1 bar back from the current bar just so we can see what it used to Forecast:
As you can see it has changed quite a bit from the previous bar, but if you look close, we drew horizontal lines around where its projecting the next bar to be (our current realtime bar), if we go back to the live chart:
Its projections were pretty close for the high and low. Generally, right now at least, it does a much better job at predicting the high and low than it does the open and close, however we will do our best to fine tune that in future updates.
Remember, this indicator is not meant to base your trades on, but rather give you a Forecast towards the general direction of the next few bars. Somewhat like weather, the farther the bar (or day for weather), the harder it is to predict. For this reason we recommend you focusing on the first few bars as they are more accurate, but review the further ones as they may help show the trend and the way that pair will move.
We will conclude this tutorial here, hopefully this Predictive Indicator can be of some help and use to you. If you have any questions, comments, ideas or concerns please let us know.
Settings:
Forecast Length: How many bars should we predict into the Future? Max 13
Each Bar Length Multiplier: For each new Forecast bar, how many more bars are averaged? Min 2
VWMA Averaged Length: All Forecast bars are put into a VWMA, what length should we use?
EMA Averaged Length: All Forecast bars are put into a EMA, what length should we use?
Filtered Length: What length should we use for Filtered Volume and RSI?
EMA Strength Length: What length should we use for the EMA Strength
HAPPY TRADING!
Pine Script® Indikator
CandlesGroup_TypesLibrary "CandlesGroup_Types"
CandlesGroup Type allows you to efficiently store and access properties of all the candles in your chart.
You can easily manipulate large datasets, work with multiple timeframes, or analyze multiple symbols simultaneously. By encapsulating the properties of each candle within a CandlesGroup object, you gain a convenient and organized way to handle complex candlestick patterns and data.
For usage instructions and detailed examples, please refer to the comments and examples provided in the source code.
method init(_self)
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup)
method init(_self, propertyNames)
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup)
propertyNames (string )
method get(_self, key)
get values array from a given property name
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
key (string) : : key name of selected property. Default is "index"
Returns: values array
method size(_self)
get size of values array. By default it equals to current bar_index
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
Returns: size of values array
method push(_self, key, value)
push single value to specific property
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
key (string) : : key name of selected property
value (float) : : property value
Returns: CandlesGroup object
method push(_self, arr)
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup)
arr (float )
method populate(_self, ohlc)
populate ohlc to CandlesGroup
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
ohlc (float ) : : array of ohlc
Returns: CandlesGroup object
method populate(_self, values, propertiesNames)
populate values base on given properties Names
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
values (float ) : : array of property values
propertiesNames (string ) : : an array stores property names. Use as keys to get values
Returns: CandlesGroup object
method populate(_self)
populate values (default setup)
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
Returns: CandlesGroup object
method lookback(arr, bars_lookback)
get property value on previous candles. For current candle, use *.lookback()
Namespace types: float
Parameters:
arr (float ) : : array of selected property values
bars_lookback (int) : : number of candles lookback. 0 = current candle. Default is 0
Returns: single property value
method highest_within_bars(_self, hiSource, start, end, useIndex)
get the highest property value between specific candles
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
hiSource (string) : : key name of selected property
start (int) : : start bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true
end (int) : : end bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true. Default is 0
useIndex (bool) : : use index instead of lookback value. Default = false
Returns: the highest value within candles
method highest_within_bars(_self, returnWithIndex, hiSource, start, end, useIndex)
get the highest property value and bar index between specific candles
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
returnWithIndex (bool) : : the function only applicable when it is true
hiSource (string) : : key name of selected property
start (int) : : start bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true
end (int) : : end bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true. Default is 0
useIndex (bool) : : use index instead of lookback value. Default = false
Returns:
method highest_point_within_bars(_self, hiSource, start, end, useIndex)
get a Point object which contains highest property value between specific candles
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
hiSource (string) : : key name of selected property
start (int) : : start bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true
end (int) : : end bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true. Default is 0
useIndex (bool) : : use index instead of lookback value. Default = false
Returns: Point object contains highest property value
method lowest_within_bars(_self, loSource, start, end, useIndex)
get the lowest property value between specific candles
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
loSource (string) : : key name of selected property
start (int) : : start bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true
end (int) : : end bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true. Default is 0
useIndex (bool) : : use index instead of lookback value. Default = false
Returns: the lowest value within candles
method lowest_within_bars(_self, returnWithIndex, loSource, start, end, useIndex)
get the lowest property value and bar index between specific candles
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
returnWithIndex (bool) : : the function only applicable when it is true
loSource (string) : : key name of selected property
start (int) : : start bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true
end (int) : : end bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true. Default is 0
useIndex (bool) : : use index instead of lookback value. Default = false
Returns:
method lowest_point_within_bars(_self, loSource, start, end, useIndex)
get a Point object which contains lowest property value between specific candles
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
loSource (string) : : key name of selected property
start (int) : : start bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true
end (int) : : end bar for calculation. Default is candles lookback value from current candle. 'index' value is used if 'useIndex' = true. Default is 0
useIndex (bool) : : use index instead of lookback value. Default = false
Returns: Point object contains lowest property value
method time2bar(_self, t)
Convert UNIX time to bar index of active chart
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
t (int) : : UNIX time
Returns: bar index
method time2bar(_self, timezone, YYYY, MMM, DD, hh, mm, ss)
Convert timestamp to bar index of active chart. User defined timezone required
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
timezone (string) : : User defined timezone
YYYY (int) : : Year
MMM (int) : : Month
DD (int) : : Day
hh (int) : : Hour. Default is 0
mm (int) : : Minute. Default is 0
ss (int) : : Second. Default is 0
Returns: bar index
method time2bar(_self, YYYY, MMM, DD, hh, mm, ss)
Convert timestamp to bar index of active chart
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
YYYY (int) : : Year
MMM (int) : : Month
DD (int) : : Day
hh (int) : : Hour. Default is 0
mm (int) : : Minute. Default is 0
ss (int) : : Second. Default is 0
Returns: bar index
method get_prop_from_time(_self, key, t)
get single property value from UNIX time
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
key (string) : : key name of selected property
t (int) : : UNIX time
Returns: single property value
method get_prop_from_time(_self, key, timezone, YYYY, MMM, DD, hh, mm, ss)
get single property value from timestamp. User defined timezone required
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
key (string) : : key name of selected property
timezone (string) : : User defined timezone
YYYY (int) : : Year
MMM (int) : : Month
DD (int) : : Day
hh (int) : : Hour. Default is 0
mm (int) : : Minute. Default is 0
ss (int) : : Second. Default is 0
Returns: single property value
method get_prop_from_time(_self, key, YYYY, MMM, DD, hh, mm, ss)
get single property value from timestamp
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
key (string) : : key name of selected property
YYYY (int) : : Year
MMM (int) : : Month
DD (int) : : Day
hh (int) : : Hour. Default is 0
mm (int) : : Minute. Default is 0
ss (int) : : Second. Default is 0
Returns: single property value
method bar2time(_self, index)
Convert bar index of active chart to UNIX time
Namespace types: CandlesGroup
Parameters:
_self (CandlesGroup) : : CandlesGroup object
index (int) : : bar index
Returns: UNIX time
Point
A point on chart
Fields:
price (series float) : : price value
bar (series int) : : bar index
bartime (series int) : : time in UNIX format of bar
Property
Property object which contains values of all candles
Fields:
name (series string) : : name of property
values (float ) : : an array stores values of all candles. Size of array = bar_index
CandlesGroup
Candles Group object which contains properties of all candles
Fields:
propertyNames (string ) : : an array stores property names. Use as keys to get values
properties (Property ) : : array of Property objects
Pine Script® Bibliothek
Inside Bars (Multiple / Consecutive)Description
When an inside bar is found, the indicator remembers the high and low (= range) of the candle before the inside bar.
As long as price moves within the range, every bar is highlighted as an inside bar to the range.
Purpose
The indicator can assist when identifying valid pullbacks and buy-side liquidity (BSL) / sell-side liquidity (SSL).
Pine Script® Indikator
shadow barThis indicator shows a new formation of retrospective candlestick bars of one period (n) of time.
In this way the trader can see how the traditional bars are part of a larger formation that can show a trend or a range.
The new shadow bars are drawn with a degree of transparency that makes it possible to distinguish traditional candlesticks;
and where shadow candles can be seen as support or resistance to traditional candlesticks.
When the traditional candlesticks are the same size as the shadow candlesticks, it can be expected that we are forming a compression or range that will result in a strong move.
In addition to the shadow bars, there is a ribbon created from the new candlestick data that is formed as a line from the linear regression function and another that is the previous line smoothed by its exponential moving average. This tape allows you to see the trend more clearly and at the crossovers of the lines that form possible reversals or continuations of the trend. The indicator has the timeframe field active, which allows the indicator to be displayed in other temporalities.
*The closing price of the new bars is the same as that of the traditional bars.
* The tape is turned off by defa
Pine Script® Indikator






















