drawLineRelative()

ICE Data Services -

drawLineRelative()

 

drawLineRelative(x1, y1, x2, y2, Style, Thickness, Color, TagName)

 

This function is used to draw lines on the chart. Unlike the drawLineAbsolute() function, the line will 'stick' to the x-axis position that it was originally written to. As new bars come in, the line will shift to the left along with the bars. The TagName parameter must be unique for each line object that is drawn on the chart. If, for example, you call the drawLine() functions repeatedly in your script but you always use a TagName of "1", then only one line object will appear on your chart (the last one drawn).

 

  • x1:  Starting x coordinate (bar offset)
  • y1:  Starting y coordinate (price value)
  • x2:  Ending x coordinate (bar offset)
  • y2:  Ending y coordinate (price value)
  • Style: Valid line style.
  • Thickness: Thickness in pixels.
  • Color: Valid color value.
  • TagName: A unique identifier for this text object.

 

Example:

 

//This will draw vertical lines through the most recent 10 bars from the $55 level to the $95 level

//When new bars come in, these lines will then shift to the left and remain in position with the

//10 bars they were originally displayed with.

 

for (x=0; x<10; x++) {

 drawLineRelative( -x, 55.0, -x, 95.0, PS_SOLID, 1, Color.blue, x);

}

 

Colors

Pen Styles

drawLineAbsolute()

clearLines()

removeLine()