This line uses the `index` field from each point for its x-coordinates. Draw a basic line with a `width` of 5 connecting the `firstPoint` to the `secondPoint`. Contains `index` and `time` information.įirstPoint = The `chart.point` for the end of the line. This script draws a new vertical line connecting theĪt the horizontal center of each chart lines demo", overlay = The `chart.point` for the start of the line. The example below demonstrates how one can draw lines in their simplest form. width Controls the width of the line, in pixels. style Specifies the line’s style, which can be any of the options listed in this page’s color Specifies the color of the line drawing. extend Determines whether the drawn line will infinitely extend beyond its defined start and end coordinates. For larger offsets, one can use xloc.bar_time. When the specified x-coordinates represent bar index values, it’s important to note that the minimum x-coordinate allowed isīar_index - 9999. To treat the x1 and x2 arguments as bar index values. When calling the second overload, an xloc value of To use the index fields of the first_point and second_point, and a value of When calling the first overload, using an xloc value of Whether the line considers the x values as bar indices or timestamps depends on the xloc value in the function call.īoth overloads share the same additional parameters: xlocĬontrols whether the x-coordinates of the new line use bar index or time values. The second overload specifies x1, y1, x2, and y2 values independently, where x1 and x2Īre int values representing the starting andĮnding x-coordinates of the line, and y1 and y2 areįloat values representing the y-coordinates. Whether it uses the index or time fields from the first_pointĪnd second_point as x-coordinates depends on the function’s xloc value. The function copies the information from these chart points Representing the start of the line, and the second_point is a The first overload of this function contains the first_point and second_point parameters. Line.new(x1, y1, x2, y2, xloc, extend, color, style, width) → series line Line.new(first_point, second_point, xloc, extend, color, style, width) → series line Garbage collection mechanism that deletes the oldest objects on the chart when the total number of drawings exceeds the script’s limit. As with labelĪnd table types, lines, boxes, and polylines utilize a Max_lines_count, max_boxes_count, and max_polylines_count parameters of the script’s Users can specify the maximum number allowed for each type via the A single script instance canĭisplay up to 500 lines, 500 boxes, and 100 polylines. There are limits on the number of these objects that a script can reference and display on the chart.Scripts can call the functions that manage these objects from within the scopes of loops andĬonditional structures, allowing iterative and conditional control of their drawings.Each object can have one of multiple predefined line styles. The x-coordinates of each object can be bar index or time values, depending on their specified xloc property.Objects of these types can use chart.point.Although all of these drawing types haveĭifferent characteristics, they do have some things in common:Ĭan have coordinates at any available location on the chart, including ones at future times beyond the last chart bar. Polylines sequentiallyĬonnect multiple vertical, horizontal, angled, or curved line segments. Lines drawn by a script may be vertical, horizontal, or angled. We therefore recommend you become familiar with arrays to make the most of Using the types we discuss on this page often involves arrays, especially when working
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |