OPEN-SOURCE SCRIPT

Session highs, lows & opens

2 254
Overview
This Pine Script indicator, titled "Session Highs, Lows & Opens", is a comprehensive tool designed for traders employing the Inner Circle Trader (ICT) methodology. It plots key price levels across multiple timeframes and trading sessions, including session highs and lows, session opens, and previous timeframe highs and lows (1-hour, 4-hour, daily, weekly, monthly). These levels are visually represented with horizontal lines and labels, making it easy to identify critical price zones for market analysis and trade execution. The indicator is highly customisable, allowing traders to tailor its appearance and functionality to their specific needs.

Key Features
The indicator provides the following features, all plotted as horizontal lines extending to the right of the chart with optional labels for clarity:
Trading Session Highs and Lows:
Tracks and plots the high and low prices for four user-defined sessions:
London Session (default: 02:00–08:00, New York time)

New York Session (default: 08:00–17:00)

Asia Session (default: 18:00–02:00)

New York PM Session (default: 13:00–17:00)

Each session’s high and low are drawn as horizontal lines starting at the session’s start time, extending to a fixed point beyond the current bar (last_bar_time + 14400000/2 milliseconds, approximately 4 hours).

Labels are placed at the line’s end, identifying the session and level (e.g., “London High”).

Customisation options include session times, visibility, history persistence, line colours, and line styles (Solid, Dotted, Dashed).

Session Opens:
Plots the opening price for:
Midnight Open (default: 00:00–00:01, all days)

New York Session Open (default: 08:00–08:01, all days)

Lines start at the session’s start time and extend to the same fixed point, with optional labels (e.g., “Midnight Open”).

Customisation includes visibility, history, labels, colours, styles, and widths.

Previous Timeframe Highs and Lows:
Plots the high and low prices from the previous period for multiple timeframes:
1-Hour (1H): Previous 1-hour period’s high and low.

4-Hour (4H): Previous 4-hour period’s high and low.

Daily: Previous day’s high, low, and optional midpoint (50% level).

Weekly: Previous week’s high, low, and optional midpoint.

Monthly: Previous month’s high, low, and optional midpoint.

Lines start at the period’s start timestamp and extend to the fixed point, with labels (e.g., “H1H” or “Prev 1H High”).

Customisation includes visibility, history, labels, high/low colours, line styles, widths, and midpoint toggles (for daily, weekly, monthly).

Current Week Open:
Plots the opening price of the current week as a horizontal line, starting at the week’s start and extending to the fixed point.

Customisation includes visibility, history, labels, colour, style, and width.

General Customisation:
Abbreviate Labels: Toggle between abbreviated (e.g., “H1H”, “PDH”) or full labels (e.g., “Prev 1H High”, “Prev Day High”).

Label Size: Choose from tiny, small, normal, large, or huge.

History Persistence: Enable/disable history for each level to control whether lines persist after the session/period ends.

Session Backgrounds: Optional background boxes for sessions with adjustable transparency, border style, and width (primarily for visual context, not used for line plotting).

How It Works
Data Retrieval: Uses request.security to fetch high, low, open, and start times from higher timeframes (1H, 4H, daily, weekly, monthly) and session data from the current chart.

Line Drawing: Horizontal lines are drawn using line.new with xloc.bar_time, starting at the session/period’s start time and extending to last_bar_time + 14400000/2. Labels are added with label.new at the line’s end, using yloc.price and text.align_right for consistency.

Updates: Lines and labels are updated on the last confirmed bar (bar_index == last_bar_index) to reflect the latest session/period data. Previous lines/labels are deleted to avoid clutter, and history settings determine persistence.

Cross Detection: Tracks price crossings of each level (e.g., PH1H_cross for 1H high) for potential integration with alerts or strategies (not used in plotting but included for future expansion).

ICT Trading Perspective: Why These Levels Are Important
The Inner Circle Trader (ICT) methodology emphasises key price levels as areas of liquidity, manipulation, and institutional interest. The levels plotted by this indicator are critical for ICT traders for the following reasons:
Session Highs and Lows:
Liquidity Pools: ICT teaches that session highs and lows (e.g., London, New York, Asia) are where stop-loss orders accumulate, making them targets for market makers. These levels often act as support/resistance or reversal points as price sweeps liquidity before reversing.

Kill Zones: ICT’s “kill zones” (e.g., London open, New York AM) are periods of high volatility. The highs and lows of these sessions are key reference points for identifying manipulation (e.g., stop hunts) and optimal trade entries during expansions.

Judas Swing: The indicator’s session levels help identify potential “Judas swings” (false breakouts) at session highs/lows, where price briefly breaches a level to trap traders before reversing.

Session Opens (Midnight and New York):
Market Structure Reference: The Midnight Open and New York Open are significant ICT levels, often marking the start of major price movements. These opens serve as pivot points for intraday bias (bullish above, bearish below).

Order Block Formation: ICT traders use session opens to identify order blocks—areas where institutional orders are placed. Price often returns to these levels before continuing in the direction of the trend.

Time-Based Analysis: The New York Open (08:00) aligns with ICT’s focus on specific times for market participation, making it a critical level for scalping or swing setups.

Previous Timeframe Highs and Lows (1H, 4H, Daily, Weekly, Monthly):
Higher Timeframe Liquidity: ICT emphasises that previous highs and lows on higher timeframes (e.g., daily, weekly) are magnets for price due to liquidity (stop-losses, breakout orders). The indicator’s 1H and 4H levels cater to intraday traders, while daily, weekly, and monthly levels suit swing traders.

Smart Money Reversals: These levels are where smart money often engineers reversals. For example, a sweep of the previous day’s high (PDH) followed by a rejection is a classic ICT setup for a bearish move.

Breaker Blocks: Previous timeframe highs/lows can form breaker blocks—key areas where price breaks structure and returns for retests. The indicator’s clear visualisation helps traders spot these zones.

Midpoints (Daily, Weekly, Monthly): The optional 50% levels act as equilibrium points within the range, often serving as fair value gaps or mean reversion targets in ICT’s market profile analysis.

Current Week Open:
Weekly Bias: The week’s opening price is a cornerstone of ICT’s weekly profile analysis. It acts as a reference for determining bullish or bearish bias and identifying potential retracement zones.

Institutional Levels: ICT traders use the week open to gauge institutional intent, as price often respects this level during consolidations or retracements before trending.

Visual Clarity for ICT Setups:
The indicator’s clean, labelled lines make it easy to apply ICT concepts like the Power of Three (accumulation, manipulation, distribution), Optimal Trade Entry (OTE), and Fibonacci retracement aligned with key levels.

The ability to toggle history and customise colours/styles ensures traders can focus on relevant levels without chart clutter, aligning with ICT’s emphasis on simplicity and precision.

Why Use This Indicator?
ICT Alignment: Tailored for ICT traders, it plots all critical levels (session highs/lows, opens, timeframe highs/lows) in one tool, saving time and reducing manual analysis.

Customisation: Extensive options allow traders to adapt the indicator to their strategy, whether scalping (1H/4H levels) or swing trading (weekly/monthly levels).

Clarity: Lines and labels are consistently styled (right-aligned, small size) for a professional, uncluttered chart.

Flexibility: Supports various markets (forex, stocks, crypto) and timeframes, with adjustable session times for global trading hours.

Educational Value: Helps new ICT traders visualise key levels, accelerating their understanding of liquidity, manipulation, and market structure.

Settings and Customisation
Session Settings: Adjust session times, toggle visibility/history, and customise colours/styles for London, New York, Asia, and NY PM sessions.

Open Settings: Enable/disable Midnight and NY Opens, with options for history, labels, and appearance.

Timeframe Levels: Toggle 1H, 4H, daily, weekly, monthly highs/lows, midpoints (daily, weekly, monthly), and week open. Customise colours, styles, widths, and labels.

General: Abbreviate labels for brevity, adjust label size, and control session background transparency.

Notes for Traders
Chart Timeframe: The indicator works on any timeframe, but 1-minute to 15-minute charts are ideal for intraday ICT setups (e.g., 1H/4H levels, session kill zones).

Performance: Updates occur on the last confirmed bar to ensure accuracy. On lower timeframes, disable unused levels to optimise performance.

ICT Strategy Integration: Combine with ICT concepts like order blocks, fair value gaps, and market maker models

Testing: Verify session times align with your broker’s timezone (default: New York time). Adjust colours/styles to avoid overlap with other indicators.



免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。