Trendoscope

LineWrapper

Library "LineWrapper"
Wrapper Type for Line. Useful when you want to store the line details without drawing them. Can also be used in scnearios where you collect lines to be drawn and draw together towards the end.

draw(this)
  draws line as per the wrapper object contents
  Parameters:
    this: (series Line) Line object.
  Returns: current Line object

draw(this)
  draws lines as per the wrapper object array
  Parameters:
    this: (series array<Line>) Array of Line object.
  Returns: current Array of Line objects

update(this)
  updates or redraws line as per the wrapper object contents
  Parameters:
    this: (series Line) Line object.
  Returns: current Line object

update(this)
  updates or redraws lines as per the wrapper object array
  Parameters:
    this: (series array<Line>) Array of Line object.
  Returns: current Array of Line objects

get_price(this, bar)
  get line price based on bar
  Parameters:
    this: (series Line) Line object.
    bar: (series/int) bar at which line price need to be calculated
  Returns: line price at given bar.

get_x1(this)
  Returns UNIX time or bar index (depending on the last xloc value set) of the first point of the line.
  Parameters:
    this: (series Line) Line object.
  Returns: UNIX timestamp (in milliseconds) or bar index.

get_x2(this)
  Returns UNIX time or bar index (depending on the last xloc value set) of the second point of the line.
  Parameters:
    this: (series Line) Line object.
  Returns: UNIX timestamp (in milliseconds) or bar index.

get_y1(this)
  Returns price of the first point of the line.
  Parameters:
    this: (series Line) Line object.
  Returns: Price value.

get_y2(this)
  Returns price of the second point of the line.
  Parameters:
    this: (series Line) Line object.
  Returns: Price value.

set_x1(this, x, draw, update)
  Sets bar index or bar time (depending on the xloc) of the first point.
  Parameters:
    this: (series Line) Line object.
    x: (series int) Bar index or bar time. Note that objects positioned using xloc.bar_index cannot be drawn further than 500 bars into the future.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_x2(this, x, draw, update)
  Sets bar index or bar time (depending on the xloc) of the second point.
  Parameters:
    this: (series Line) Line object.
    x: (series int) Bar index or bar time. Note that objects positioned using xloc.bar_index cannot be drawn further than 500 bars into the future.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_y1(this, y, draw, update)
  Sets price of the first point
  Parameters:
    this: (series Line) Line object.
    y: (series int/float) Price.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_y2(this, y, draw, update)
  Sets price of the second point
  Parameters:
    this: (series Line) Line object.
    y: (series int/float) Price.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_color(this, color, draw, update)
  Sets the line color
  Parameters:
    this: (series Line) Line object.
    color: (series color) New line color
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_extend(this, extend, draw, update)
  Sets extending type of this line object. If extend=extend.none, draws segment starting at point (x1, y1) and ending at point (x2, y2). If extend is equal to extend.right or extend.left, draws a ray starting at point (x1, y1) or (x2, y2), respectively. If extend=extend.both, draws a straight line that goes through these points.
  Parameters:
    this: (series Line) Line object.
    extend: (series string) New extending type.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_style(this, style, draw, update)
  Sets the line style
  Parameters:
    this: (series Line) Line object.
    style: (series string) New line style.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_width(this, width, draw, update)
  Sets the line width.
  Parameters:
    this: (series Line) Line object.
    width: (series int) New line width in pixels.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_xloc(this, x1, x2, xloc, draw, update)
  Sets x-location and new bar index/time values.
  Parameters:
    this: (series Line) Line object.
    x1: (series int) Bar index or bar time of the first point.
    x2: (series int) Bar index or bar time of the second point.
    xloc: (series string) New x-location value.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_xy1(this, x, y, draw, update)
  Sets bar index/time and price of the first point.
  Parameters:
    this: (series Line) Line object.
    x: (series int) Bar index or bar time. Note that objects positioned using xloc.bar_index cannot be drawn further than 500 bars into the future.
    y: (series int/float) Price.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

set_xy2(this, x, y, draw, update)
  Sets bar index/time and price of the second point
  Parameters:
    this: (series Line) Line object.
    x: (series int) Bar index or bar time. Note that objects positioned using xloc.bar_index cannot be drawn further than 500 bars into the future.
    y: (series int/float) Price.
    draw: (series bool) draw line after setting attribute
    update: (series bool) update line instead of redraw. Only valid if draw is set.
  Returns: Current Line object

delete(this)
  Deletes the underlying line drawing object
  Parameters:
    this: (series Line) Line object.
  Returns: Current Line object

Line
  Line Wrapper object
  Fields:
    x1: (series int) Bar index (if xloc = xloc.bar_index) or bar UNIX time (if xloc = xloc.bar_time) of the first point of the line. Note that objects positioned using xloc.bar_index cannot be drawn further than 500 bars into the future.
    y1: (series int/float) Price of the first point of the line.
    x2: (series int) Bar index (if xloc = xloc.bar_index) or bar UNIX time (if xloc = xloc.bar_time) of the second point of the line. Note that objects positioned using xloc.bar_index cannot be drawn further than 500 bars into the future.
    y2: (series int/float) Price of the second point of the line.
    xloc: (series string) See description of x1 argument. Possible values: xloc.bar_index and xloc.bar_time. Default is xloc.bar_index.
    extend: (series string) If extend=extend.none, draws segment starting at point (x1, y1) and ending at point (x2, y2). If extend is equal to extend.right or extend.left, draws a ray starting at point (x1, y1) or (x2, y2), respectively. If extend=extend.both, draws a straight line that goes through these points. Default value is extend.none.
    color: (series color) Line color.
    style: (series string) Line style. Possible values: line.style_solid, line.style_dotted, line.style_dashed, line.style_arrow_left, line.style_arrow_right, line.style_arrow_both.
    width: (series int) Line width in pixels.
    obj: line object

파인 라이브러리

트레이딩뷰 정신에 따라 오써는 이 파인 코드를 오픈 소스 라이브러리로 퍼블리쉬하여 당사 커뮤니티의 다른 파인 프로그래머들이 쓸 수 있도록 하였습니다. 오써에게 찬사를! 여러분은 이 라이브러리를 프라이빗 또는 오픈 소스 퍼블리케이션에 쓸 수 있지만 퍼블리케이션에 재사용은 하우스룰을 따릅니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

이 라이브러리를 쓰시겠습니까?

텍스트를 클립보드에 카피한 뒤 님의 스크립트에 붙여 넣기.