This Pine Script script defines a TradingView indicator named "Daily High/Low Levels" designed to track and display the daily high and low levels of a trading session, with added functionality for marking levels as mitigated when certain conditions are met. Here's a breakdown of its functionality:
Key Features Session Start Time: The script allows you to specify a custom session start time in 24-hour format. This ensures the levels align with your trading session preferences.
Daily Highs and Lows:
Tracks the high and low levels for each session. Retains the highs and lows for a configurable number of previous days. Visualization:
Creates horizontal lines for each session's high and low levels. Supports customization of line colors and styles. Mitigation Tracking:
Monitors whether a high or low level has been "mitigated" (touched or exceeded by subsequent price action). Changes the line style and color to indicate mitigation. Provides an alert when mitigation occurs. Configurable Extensions:
Lines can be extended beyond mitigation or stopped at the bar index where mitigation occurs, depending on user preference. Efficient Array Management:
Uses arrays to manage daily highs, lows, their respective indices, and lines. Ensures the size of stored data does not exceed the configured limit (daysToTrack). Alerts:
Sends alerts when high or low levels are mitigated, which can be used for trading decisions. Inputs Session Start Hour/Minute: Defines when a new session starts. Days to Track: Sets the number of previous days to display high/low levels. Colors: Allows customization of line colors for unmitigated and mitigated levels. Extend Lines: Toggles whether lines should extend past the mitigation point. Code Highlights New Session Detection: The script detects the start of a new session based on the configured session start time and resets daily highs/lows.
Line Management: Horizontal rays are created for highs and lows, and mitigated lines are updated with a dashed style and faded color.
Mitigation Logic: The script checks whether current price action exceeds stored high or low levels and updates their status and appearance accordingly.
Memory Management: Ensures the size of the arrays (highs, lows, lines) does not exceed the configured daysToTrack, deleting the oldest elements as necessary.
This indicator is highly customizable and useful for traders who want to track and analyze daily support and resistance levels, incorporating mitigation as a dynamic feature.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
차트에서 빠르게 액세스하려면 이 스크립트를 즐겨찾기에 추가하세요 — 여기에서 자세히 알아보기.