drawLineRelative()
Previous Top Next
drawLineRelative( x1, y1, x2, y2, style, thickness, color, tagID )
The drawLineRelative function allows you to draw line objects at any location on your chart. Any line object created with drawlineRelative will 'stick' to the location where it was originally anchored. So, a line object originally created at a bar index of -10 will be at a bar index of -20 after 10 new bars come in.
Parameters
x1 |
the starting bar index for the line |
y1 |
the starting series value for the line |
x2 |
the ending bar index for the line |
y2 |
the ending series value for the line |
style |
see Pen Styles below |
thickness |
integer value assigning line thickness |
color |
color to use when drawing the line |
tagID |
a unique identifier for this line object or null |
Pen Styles
PS_SOLID |
draw a solid line |
PS_DOT |
draw a dotted line |
PS_DASH |
draw a dashed line |
PS_DASHDOT |
draw a dash-dot line |
PS_DASHDOTDOT |
draw a dash-dot-dot line |
Usage
//draw a line from the high 20 bars ago to the high 5 bars ago. draw it as a solid
//line with a thickness of 2 and a color of teal. assign a tagID of 105 so we can
//identify it later if we need to remove it.
drawLineRelative( -20, high(-20), -5, high(-5), PS_SOLID, 2, Color.teal, 105 );