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 אמיתית, המחבר פרסם קוד Pine זה כספריית קוד פתוח כדי שמתכנתי Pine אחרים מהקהילה שלנו יוכלו לעשות בו שימוש חוזר. כל הכבוד למחבר! אתה יכול להשתמש בספרייה זו באופן פרטי או בפרסומים אחרים בקוד פתוח, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית.
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.