OPEN-SOURCE SCRIPT
업데이트됨

Multi-Timeframe Pivot

8 286
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 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.
릴리즈 노트
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.
릴리즈 노트
Added a dedicated "Session" layer that marks the absolute High and Low of a completed timeframe (e.g., Previous Daily High/Low).
릴리즈 노트
Core Logic Evolution
Sequence 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 (HH, LH, LL, HL$) in real-time.

Visual & UI Overhaul
Market Structure Labels: Transitioned from simple "X" markers to intelligent text labels. The indicator now automatically identifies and displays:
Highs: HH$ (Higher High) and LH$ (Lower High).
Lows: LL$ (Lower Low) and HL$ (Higher Low).
Enhanced Spatial Padding: Increased the visual offset from $0.1$ to $0.2$ ATR$. This ensures markers and text labels "float" clearly above or below candles without overlapping price action.
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.
릴리즈 노트
1. Logic & Sequence Refinement
Strict 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 ATR \times 0.2$ priceOffset logic as the timeframe pivots for a professional, uniform look.
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.
릴리즈 노트
Fixed the logic behind the text that displays HH, LH, LL, HL

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.