PINE LIBRARY
Aggiornato VisualStructureTools

Library "VisualStructureTools"
MTF-safe drawing library (Unix-Time). Designed for high visual discrimination and efficient debugging of complex logic without cluttering the main script.
Optimized for Pine Script® v6 to prevent runtime errors in multi-timeframe environments.
setLine(price, startTime, labelText, labelPos, is_extend, l_width, l_col, l_style)
Draws a horizontal level or a segment with an optional label.
Parameters:
price (float): Price level for the line.
startTime (int): UNIX timestamp (ms) for the starting point.
labelText (string): Text to display on the label. Use "none" to hide.
labelPos (string): Position of the label relative to the price ('above' or 'below', 'none').
is_extend (bool): If true, the line extends infinitely (extend.both).
l_width (int): Width of the line in pixels.
l_col (color): Color for the line and label text.
l_style (string): Style of the line ('solid', 'dashed', 'dotted').
setBox(top, bottom, startTime, endTime, boxText, b_col, b_width, b_style, b_transp)
Draws a filled box with an optional synchronized text label.
Parameters:
top (float): Price of the upper boundary.
bottom (float): Price of the lower boundary.
startTime (int): UNIX timestamp (ms) for the left side of the box.
endTime (int): UNIX timestamp (ms) for the right side (defaults to current 'time').
boxText (string): Optional text label for the box. Use "" to hide.
b_col (color): Border and fill color.
b_width (int): Border width.
b_style (string): Border style ('solid', 'dashed', 'dotted').
b_transp (int): Transparency for the background fill (0-100).
MTF-safe drawing library (Unix-Time). Designed for high visual discrimination and efficient debugging of complex logic without cluttering the main script.
Optimized for Pine Script® v6 to prevent runtime errors in multi-timeframe environments.
setLine(price, startTime, labelText, labelPos, is_extend, l_width, l_col, l_style)
Draws a horizontal level or a segment with an optional label.
Parameters:
price (float): Price level for the line.
startTime (int): UNIX timestamp (ms) for the starting point.
labelText (string): Text to display on the label. Use "none" to hide.
labelPos (string): Position of the label relative to the price ('above' or 'below', 'none').
is_extend (bool): If true, the line extends infinitely (extend.both).
l_width (int): Width of the line in pixels.
l_col (color): Color for the line and label text.
l_style (string): Style of the line ('solid', 'dashed', 'dotted').
setBox(top, bottom, startTime, endTime, boxText, b_col, b_width, b_style, b_transp)
Draws a filled box with an optional synchronized text label.
Parameters:
top (float): Price of the upper boundary.
bottom (float): Price of the lower boundary.
startTime (int): UNIX timestamp (ms) for the left side of the box.
endTime (int): UNIX timestamp (ms) for the right side (defaults to current 'time').
boxText (string): Optional text label for the box. Use "" to hide.
b_col (color): Border and fill color.
b_width (int): Border width.
b_style (string): Border style ('solid', 'dashed', 'dotted').
b_transp (int): Transparency for the background fill (0-100).
Note di rilascio
v2 UI Control Upgrade & Trend Vector SupportThis update focuses on better visual management of MTF objects and introduces diagonal trendline support.
Changes to existing functions:
setLine(): Updated is_extend to a string-based logic ("ext.both" or "no ext.") for better compatibility with complex MTF setups. Renamed labelPos to v_labelPos.
setBox(): Added l_pos parameter. You can now align box labels to "left", "center", or "right". This is crucial to prevent label stacking at the chart's edge during high-density price action.
New Features:
trendLine(): A new function to draw diagonal vectors using UNIX timestamps. Supports multiple extension modes ("ext.right", "ext.both", "no ext.") and includes synchronized labels at the endpoint.
Added:
trendLine(start_price, startTime, last_price, lastTime, labelText, labelPos, is_extend, l_width, l_col, l_style)
Draws a diagonal trendline (vector) between two specific points in time.
Parameters:
start_price (float): Price level at the starting point.
startTime (int): UNIX timestamp (ms) of the starting point.
last_price (float): Price level at the end point.
lastTime (int): UNIX timestamp (ms) of the end point.
labelText (string): Text to display on the label. Use "none" to hide.
labelPos (string): Vertical position of the label ('above', 'below', or 'none').
is_extend (string): Extension mode: "ext.right", "ext.both", or "no ext.".
l_width (int): Width of the line in pixels.
l_col (color): Color of the line and the label text.
l_style (string): Line style: "solid", "dashed", or "dotted".
Returns: The ID of the drawn line and label.
Updated:
setLine(price, startTime, labelText, v_labelPos, is_extend, l_width, l_col, l_style)
Draws a horizontal price level or a segment with an optional synchronized label.
Parameters:
price (float): The price level where the line will be drawn.
startTime (int): UNIX timestamp (ms) for the starting point of the line.
labelText (string): Text to be displayed on the label. Set to "none" to disable.
v_labelPos (string): Vertical position of the label relative to the price ('above', 'below', or 'none').
is_extend (string): Extension mode: "ext.both" for infinite extension, "no ext." to draw from startTime to current time.
l_width (int): Line thickness in pixels.
l_col (color): Color for both the line and the label text.
l_style (string): Visual style of the line: "solid", "dashed", or "dotted".
Returns: The ID of the updated line and label objects.
setBox(top, bottom, startTime, endTime, boxText, l_pos, b_col, b_width, b_style, b_transp)
Draws a filled box with a smart label to prevent visual clutter.
Parameters:
top (float): Price of the upper boundary.
bottom (float): Price of the lower boundary.
startTime (int): UNIX timestamp (ms) for the left side of the box.
endTime (int): UNIX timestamp (ms) for the right side (defaults to current 'time').
boxText (string): Optional text label for the box. Use "" to hide.
l_pos (string): Label alignment: "left" (start of box), "right" (current time), or "center".
b_col (color): Border and fill color.
b_width (int): Border width in pixels.
b_style (string): Border style: "solid", "dashed", or "dotted".
b_transp (int): Background transparency (0-100).
Returns: The ID of the drawn box and label.
Note di rilascio
v3Added:
colorsuite()
Provides a unified palette of cyberpunk, structural, and dashboard colors.
Returns: A tuple containing [bull_candle_color, bear_candle_color, deep_space_blue, obsidian_forest, silk_pearl, omsf_color, omsf_bulls_color, omsf_bears_color, hyper_green_hex, laser_crimson_hex]
Note di rilascio
v4Library Update: Extended Color Suite & Dynamic Contrast Utility
colorsuite() Tuple Expansion: Extended the return tuple from 10 to 18 color variables.
New Subcondition Colors: Added bears_dusk, bulls_fading, bulls_exhaustion, and bulls_dawn for micro-structural state transitions.
New Theme Alternatives: Added soft UI accents (cream, mint_cyan, ice_blue, soft_coral).
Tuple Adjustment: Replaced obsidian_forest with midnight_charcoal in slot 4.
New Utility Function auto_contrast_switch(): Automatically computes and returns the optimal high-contrast text color (midnight_charcoal, silk_pearl, or omsf_color) depending on the background/condition color. Perfect for dynamic table cells, badges, and labels.
⚠️ Note for existing users: Please update your colorsuite() destructuring assignment to the new 18-element tuple format to prevent compilation errors.
Libreria Pine
Nello spirito di TradingView, l'autore ha pubblicato questo codice Pine come libreria open source affinché altri programmatori della nostra community possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open source, ma il riutilizzo di questo codice nelle pubblicazioni è soggetto al Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Libreria Pine
Nello spirito di TradingView, l'autore ha pubblicato questo codice Pine come libreria open source affinché altri programmatori della nostra community possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open source, ma il riutilizzo di questo codice nelle pubblicazioni è soggetto al Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.