PINE LIBRARY

SimpleTrendlines

Library "SimpleTrendlines"
An accessible and semi-effortless way to draw trendlines with automatic slope and angle calculation.

new(x_axis, offset, strictMode, strictType)
  Creates an instance of the trendline library, accepting parameters that allow the library to function accordingly.
  Parameters:
    x_axis (int): The x-axis distance between point A and point B.
    offset (int): The offset from x2 and the current bar_index. Used in situations where conditions execute ahead of where the x2 location is, such as pivot events.
    strictMode (bool): Strict mode works in the backend of things to ensure that price hasn't closed below the trendline before the trendline is drawn.
    strictType (int): 0 ensures that price during slope calculation is above line, 1 ensures that price during slope calculation is below line.

method drawLine(this, condition, y1, y2, src)
  Draws a new line from the given y-value parameters based on a condition.
  Namespace types: Trendline
  Parameters:
    this (Trendline)
    condition (bool): The condition in order to draw a new line.
    y1 (float): The y-value of point A.
    y2 (float): the y-value of point B.
    src (float): Determines which value strict mode will actively check for leakage before a trendline is drawn.

method drawTrendline(this, condition)
  Draws a trendline from the line generated from the drawLine() method.
  Namespace types: Trendline
  Parameters:
    this (Trendline)
    condition (bool): The conditon to maintain the trendline.

TrendlineSettings
  The object containing the essential values for proper library execution.
  Fields:
    x_axis (series int): The x-axis provided by the user to determine the distance between point A and point B
    offset (series int): The offset from x2 and the current bar_index. Used in situations where conditions execute ahead of where the x2 location is, such as pivot events.
    strictMode (series bool): Strict mode works in the backend to ensure that price hasn't closed below or above the trendline before the trendline is drawn.
    strictType (series int): 0 if price is above line, 1 if price is below line.

TrendlineData
  The object containing values that the user can use for further calculation.
  Fields:
    slope (series float): The slope of the initial line.
    x1 (series int): The bar_index value of point A.
    x2 (series int): The bar_index value of point B.
    y1 (series float)
    y2 (series float)
    changeInX (series int): How many bars since the bar_index value of point B.

TrendlineLines
  The object containing both the start line and trend line for manipulation.
  Fields:
    startline (series line): The initial line that gets drawn when instantiating the drawLine() method.
    trendline (series line): The trendline that gets drawn when instantiating the drawTrendline() method.

Trendline
  The object that serves as the class of the library. Inherits all properties and methods.
  Fields:
    info (TrendlineSettings): Contains properties inside the TrendlineSettings object.
    values (TrendlineData): Contains properties inside the TrendlineData object.
    lines (TrendlineLines): Contains properties inside the TrendlineLines object.

Feragatname