Eyemaginative

Gap Trend Lines by @eyemaginative

Eyemaginative Zaktualizowano   
Summary:
The "Gap Trend Lines" script is designed to identify and visualize gaps between the close of one candle and the opening of the next on a TradingView chart. It draws extended trend lines to visually connect these gaps, helping traders to identify significant price movements between consecutive candles.

Functionality:
Indicator Setup:
The script is set as an overlay indicator on the main chart.
It includes settings for maximum line and label counts, ensuring efficient performance.
Parameter Customization:
Gap Threshold: Defines the minimum gap size considered significant.
Line Colors: Allows customization of colors for small and large gaps.
Line Thickness and Style: Provides options to adjust the thickness and style (solid, dotted, dashed) of the trend lines.

Drawing Extended Trend Lines:

For each bar (candlestick) on the chart, the script checks if there is a gap between the previous candle's close and the current candle's open.
If a gap is detected (i.e., close != open), it determines the size of the gap.
Depending on the size relative to the defined threshold, it selects the appropriate color (small or large gap).
It then draws an extended trend line that starts from the close of the previous candle (bar_index, close) and extends to the open of the current candle (bar_index, open).
The trend line is drawn with the specified thickness, color, and style.

Dynamic Line Attribute Changes:

The script includes a function (changeLineAttributes()) that periodically changes the color and style of the trend lines.
By default, it changes the color every 4 hours (adjustable), alternating between green and the original color.

Enhanced Functionality:

Handles both small and large gaps with different visual cues (colors).
Supports extended trend lines that span both past and future directions (extend=extend.both), ensuring visibility across the entire chart.

Usage:

Traders can use the "Gap Trend Lines" script to:
Identify and analyze gaps between candlesticks.
Visualize significant price movements or breaks in continuity.
Customize the appearance of trend lines for better clarity and analysis.

By utilizing this script, traders can gain insights into price gap dynamics directly on TradingView charts, aiding in decision-making and strategy development.
Informacje o Wersji:
Update: This script now includes input parameters for customizing the color and style of lines that change every 4 hours. The default values for these parameters are green for color and dotted for style, but you can customize them as needed.

Summary:
The "Gap Trend Lines" script is designed to identify and visualize gaps between the close of one candle and the opening of the next on a TradingView chart. It draws extended trend lines to visually connect these gaps, helping traders to identify significant price movements between consecutive candles.

Functionality:
Indicator Setup:
The script is set as an overlay indicator on the main chart.
It includes settings for maximum line and label counts, ensuring efficient performance.
Parameter Customization:
Gap Threshold: Defines the minimum gap size considered significant.
Line Colors: Allows customization of colors for small and large gaps.
Line Thickness and Style: Provides options to adjust the thickness and style (solid, dotted, dashed) of the trend lines.

Drawing Extended Trend Lines:

For each bar (candlestick) on the chart, the script checks if there is a gap between the previous candle's close and the current candle's open.
If a gap is detected (i.e., close != open), it determines the size of the gap.
Depending on the size relative to the defined threshold, it selects the appropriate color (small or large gap).
It then draws an extended trend line that starts from the close of the previous candle (bar_index, close) and extends to the open of the current candle (bar_index, open).
The trend line is drawn with the specified thickness, color, and style.

Dynamic Line Attribute Changes:

The script includes a function (changeLineAttributes()) that periodically changes the color and style of the trend lines.
By default, it changes the color every 4 hours (adjustable), alternating between green and the original color.

Enhanced Functionality:

Handles both small and large gaps with different visual cues (colors).
Supports extended trend lines that span both past and future directions (extend=extend.both), ensuring visibility across the entire chart.

Usage:

Traders can use the "Gap Trend Lines" script to:
Identify and analyze gaps between candlesticks.
Visualize significant price movements or breaks in continuity.
Customize the appearance of trend lines for better clarity and analysis.

By utilizing this script, traders can gain insights into price gap dynamics directly on TradingView charts, aiding in decision-making and strategy development.
Informacje o Wersji:
Updated Indicator Image, No Script Update
Informacje o Wersji:
Changed Sample Image, No Script Change
Informacje o Wersji:
NOTE: There still exists an issue when refreshing browser where the script will need removed and readded due to a compile error. It compiles initially and will function until a refresh. I will resolve this in a future update.

Changes Made in this Release:
Added Independent Customization:

Added separate customization for small and large gaps, including line thickness and style.
Parameters for old gap customization included color, thickness, and style.
Dynamic Deletion of Lines:

Ensured delete_all_lines() function only deletes lines when necessary to avoid compilation issues upon refresh.
Error Handling:

Checked if trendLines array is empty before performing operations on it, preventing out-of-bounds errors.
Refined Periodic Change Function:

Added more granular control over the appearance of lines older than 4 hours, allowing customization from the input parameters.

This version ensures the script dynamically updates on changes and prevents issues with array bounds, providing robust functionality for identifying and visualizing price gaps.

Key Features:
Gap Detection: Identifies gaps where the close price of one candle is different from the open price of the next.

Line Drawing: Draws extended trend lines between these gaps, with customizable colors, thicknesses, and styles based on the gap size.

Periodic Change: Changes the color and style of lines that are older than 4 hours, with customizable parameters.

Dynamic Updates: Ensures the script updates dynamically when the gap threshold changes.

Customization Parameters:
Gap Threshold: Determines the size of gaps to be considered.

Small Gaps: Customizable color, thickness, and style for lines representing small gaps.
Large Gaps: Customizable color, thickness, and style for lines representing large gaps.
Old Gaps: Customizable color, thickness, and style for lines older than 4 hours.

Functions:
get_line_style(): Converts string input to the corresponding line style.
delete_all_lines(): Deletes all existing lines to prevent accumulation on parameter changes.
changeLineAttributes(): Changes the appearance of lines older than 4 hours based on specified intervals.
Informacje o Wersji:
Preventing Large Gap Lines from Becoming Old Gap Lines:

Initially, the script was treating all gap lines that persisted beyond a certain age as old gap lines. This included both small and large gap lines.

To differentiate between large and old gap lines, we modified the condition in the changeLineAttributes function. Now, only lines categorized as small gaps are allowed to age into old gap lines. Large gap lines retain their original attributes without turning into old gap lines.

Adding Hidden Line Options in Input Settings:

Three checkboxes were added to the input settings: Hide Small Gaps, Hide Large Gaps, and Hide Old Gaps.

Each checkbox allows the user to toggle the visibility of specific types of gap trend lines independently.

The update_visibility function was updated to read these settings and adjust the visibility of lines accordingly. Lines are hidden based on their type (small, large, or old) and whether the respective checkbox is checked.

These changes enable more flexible control over which types of gap trend lines are displayed on the chart, improving usability and customization options for the indicator.
Informacje o Wersji:
Summary of Changes to the Gap Trend Lines Script
1. Added Below Threshold Gap Lines:

Implemented logic to identify and plot gap trend lines that are below the defined gap threshold.

Added input parameters for customization of these below threshold gap lines, including color, line thickness, and line style.

2. Renamed Gap Lines:

Renamed the line types for better clarity:
Large gap lines are now referred to as Above Threshold lines.
Small gap lines are now referred to as Threshold lines.
New lines are introduced for Below Threshold gaps.

3. Customization Parameters for All Line Types:

Added input parameters for each type of gap line:

Above Threshold Gaps:
line_color_above_threshold
line_thickness_above_threshold
line_style_above_threshold

Threshold Gaps:
line_color_threshold
line_thickness_threshold
line_style_threshold
Below Threshold Gaps:

line_color_below_threshold
line_thickness_below_threshold
line_style_below_threshold
Old Gaps:

line_color_old_gap
line_thickness_old_gap
line_style_old_gap

4. Input Parameters for Hiding Lines:

Added options to hide specific types of gap lines:
hide_threshold_gaps
hide_above_threshold_gaps
hide_below_threshold_gaps
hide_old_gaps

5. Debugging Labels:

Implemented debugging labels to show gap sizes and threshold values on the chart.
Added an input parameter hide_debug_labels to toggle the visibility of these debugging labels.

6. Note on 30-Minute Timescale Loading Issue:

There is an outstanding issue where the script fails to load on the 30-minute timescale due to execution timeouts. This issue needs to be addressed, but the focus should be on other functionalities for now.
Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?