drawShapeRelative()

ICE Data Services -

drawShapeRelative()
Previous  Top  Next


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
Shape .PRESET
(new in EFS2) allows drawShapeRelative to use the location flags described in the drawText function.
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 );



Notes

It’s possible to define mouse-button handler function for figures created by drawShapeRelative. To do this you should set the parameter URL as 'EFS:functionName', where functionName is the caption of handler, which should be defined in script.

Note, starting with version 11.1 all mouse functions require the use of the Shift key when called from the chart. This change was done to avoid conflicts between EFS and chart mouse events (such as right clicking or double clicking) without compromising any backwards compatability.