OPEN-SOURCE SCRIPT
Zaktualizowano Multi-Timeframe Pivot

Description:
This script provides an advanced tool for multi-timeframe pivot point
analysis. It identifies swing points based on a candle's relationship to
its neighbors. The default strength settings of 1 align with the Inner
Circle Trader (ICT) concept of market structure.
The ICT concept defines a swing point based on a simple 3-candle pattern:
- A swing high is a candle where the candles to the immediate left and right
both have lower highs.
- A swing low is a candle where the candles to the immediate left and right
both have higher lows.
A key feature is its ability to accurately calculate and translate pivot
points from up to five higher timeframes (HTFs) and display them
precisely on a lower timeframe (LTF) chart.
NOTE: This indicator is designed to show HTF data on an LTF chart.
If you select a timeframe in the settings that is lower than your
current chart's timeframe, it will show pivots for the chart's
timeframe instead.
Core Features:
- Up to five independent higher timeframes.
- Per-timeframe customization for pivot strength (left/right bars) and color.
- Optional "Watchlines" that project the price of each pivot forward,
complete with a text label identifying the timeframe.
- An optional "Alignment Model" that colors the background when price is
aligned across all active timeframes (requires at least 2 TFs to be enabled).
Default State:
For a clean initial application, the Watchlines and Alignment Model features
are disabled by default but can be enabled in the settings.
This script provides an advanced tool for multi-timeframe pivot point
analysis. It identifies swing points based on a candle's relationship to
its neighbors. The default strength settings of 1 align with the Inner
Circle Trader (ICT) concept of market structure.
The ICT concept defines a swing point based on a simple 3-candle pattern:
- A swing high is a candle where the candles to the immediate left and right
both have lower highs.
- A swing low is a candle where the candles to the immediate left and right
both have higher lows.
A key feature is its ability to accurately calculate and translate pivot
points from up to five higher timeframes (HTFs) and display them
precisely on a lower timeframe (LTF) chart.
NOTE: This indicator is designed to show HTF data on an LTF chart.
If you select a timeframe in the settings that is lower than your
current chart's timeframe, it will show pivots for the chart's
timeframe instead.
Core Features:
- Up to five independent higher timeframes.
- Per-timeframe customization for pivot strength (left/right bars) and color.
- Optional "Watchlines" that project the price of each pivot forward,
complete with a text label identifying the timeframe.
- An optional "Alignment Model" that colors the background when price is
aligned across all active timeframes (requires at least 2 TFs to be enabled).
Default State:
For a clean initial application, the Watchlines and Alignment Model features
are disabled by default but can be enabled in the settings.
Informacje o Wersji
This is an update. The time-frame alignment model has been removed. The script now uses a "direct analysis" engine that checks every single bar on the selected timeframe, allowing it to find and plot a much higher density of pivots. All pivot plotting is now done using the bar's timestamp for the most accurate visual representation.Informacje o Wersji
I added a function that creates a little space between the 'X' markers and the pivots, this allows us to see the wicks of the candles more clearly.Informacje o Wersji
Added a dedicated "Session" layer that marks the absolute High and Low of a completed timeframe (e.g., Previous Daily High/Low).Informacje o Wersji
Core Logic EvolutionSequence Filtering: Added a "Filter Weak Pivots" toggle. Unlike the old version which marked every pivot found, the new version can enforce a strict High-Low-High alternation, automatically removing minor "inside" pivots to reveal true market structure.
Flat Pivot Support: The old version strictly required neighbors to be lower/higher. The new version introduces Equal Pivots logic, allowing the indicator to detect and mark Double Tops and Double Bottoms.
Advanced State Tracking: The logic now tracks previous price points to determine market structure states (
Visual & UI Overhaul
Market Structure Labels: Transitioned from simple "X" markers to intelligent text labels. The indicator now automatically identifies and displays:
Highs:
Lows:
Enhanced Spatial Padding: Increased the visual offset from $0.1$ to $0.2$
Dynamic Label Positioning: Markers now use directional anchors (label.style_label_up/down), ensuring text is always pushed away from the candle for maximum readability.
Text Customization: Added global controls for Label Size (Small to Huge) and independent toggles to show/hide Crosses or Text labels for each of the 6 timeframes.
Quality of Life
Comprehensive Tooltips: Every input setting now includes a detailed explanation of its function, making the indicator significantly more user-friendly for new traders.
Refactored Execution: The drawing engine was rewritten into a unified function (drawPivotLabel) that handles both markers and text labels more efficiently, reducing the script's computational footprint.
Informacje o Wersji
1. Logic & Sequence RefinementStrict Alternation (Zig-Zag): The original logic allowed "Double Highs" or "Double Lows" to print consecutively. The new version enforces a strict High $\rightarrow$ Low $\rightarrow$ High sequence when the Filter weak pivots setting is enabled.
Dynamic Pivot Replacement: Implemented a "Better Pivot" check. If the script is in a "High" state and finds a new, higher High before a Low is confirmed, it now deletes the old labels and moves them to the new peak.
Independent State Tracking: Each of the 6 timeframes now maintains its own independent variables for lastPivotType and lastPivotPrice, ensuring that a pivot on the 5-minute chart does not interfere with the structure of the Daily chart.
2. Visual & Consistency Updates
Uniform Padding: Session High/Low markers were previously inconsistently placed. They now utilize the same
Marker Logic: The drawPivotLabel function was upgraded to return a tuple [label, label]. This allows the calling logic to specifically target and delete the "X" marker and the "Text" label of a rejected pivot simultaneously.
Text Alignment: Maintained v6 label styles (label.style_label_down for Highs and label.style_label_up for Lows) to ensure text always points away from the price action, preventing overlap.
3. Structural & Compiler Fixes
Function Hoisting: Resolved the "Could not find function" error by reordering the script so that processSessionLogic and processPivotLogic are fully defined before they are called in the execution block.
Scope Compliance: Strictly adhered to the v6 requirement of avoiding plotshape() in local scopes. All visual markers are managed via the label namespace, which allows for dynamic creation inside conditional blocks.
Memory Management: Maintained the MAX_DRAWING_OBJECTS limit of 500 to stay within TradingView’s resource limits while ensuring historical pivots remain visible on the chart.
Informacje o Wersji
Fixed the logic behind the text that displays HH, LH, LL, HLSkrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.