drawShapeRelative( barIndex, yValue, shape, url, color, Flags [, tagID] )
The drawShapeRelative function allows you to draw shape objects at any location on your chart. Any shape object created with drawShapeRelative will 'stick' to the location where it was originally anchored. So, a shape object originally created at a bar index of -10 will be at a bar index of -20 after 10 new bars come in.
Parameters
barIndex
|
the bar index where the shape object will be anchored (x-axis)
|
yValue
|
the series value where the shape object will be anchored (y-axis)
|
shape
|
see Shape Objects below
|
url
|
a url to be launched if shape is clicked, or null if not used
|
Color
|
the color for the shape object
|
Flags
|
see Shape Flags below
|
tagID
|
optional. a unique identifier for this shape object or null
|
Shape Objects
Shape.CIRCLE
|
draws a circle
|
Shape.SQUARE
|
draws a square
|
Shape.TRIANGLE
|
draws a triangle
|
Shape.DIAMOND
|
draws a diamond
|
Shape.LEFTARROW
|
draws a left arrow
|
Shape.RIGHTARROW
|
draws a right arrow
|
Shape.UPARROW
|
draws a up arrow
|
Shape.DOWNARROW
|
draws a down arrow
|
Shape.LEFTTRIANGLE
|
draws a left-pointing triangle
|
Shape.RIGHTTRIANGLE
|
draws a right-pointing triangle
|
Shape.UPTRIANGLE
|
draws an upward-pointing triangle
|
Shape.DOWNTRIANGLE
|
draws a downward-pointing triangle
|
Shape Flags
Shape.LEFT
|
align the shape to the left
|
Shape.RIGHT
|
align the shape to the right
|
Shape.TOP
|
align the shape to the top
|
Shape.BOTTOM
|
align the shape to the bottom
|
Shape.ONTOP
|
draw the shape on top of the study
|
Note: Shape flags can be ORed together to combine various attributes (e.g., Shape.ONTOP | Shape.LEFT )
|
Usage
//draw a circle over the high of the bar 5 bars back and color it red
drawShapeRelative( -5, high(-5), Shape.CIRCLE, null, Color.red, Shape.TOP | Shape.ONTOP );
|