PINE LIBRARY
已更新

VisualStructureTools

361
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).
版本注释
v2 UI Control Upgrade & Trend Vector Support

This 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.
版本注释
v3

Added:
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]

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。