||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.
||the bar index where the shape object will be anchored (x-axis)
||the series value where the shape object will be anchored (y-axis)
||see Shape Objects below
||a url to be launched if shape is clicked, or null if not used
the color for the shape object
||see Shape Flags below
||optional. a unique identifier for this shape object or null
||draws a circle
||draws a square
||draws a triangle
||draws a diamond
||draws a left arrow
||draws a right arrow
||draws a up arrow
||draws a down arrow
||draws a left-pointing triangle
||draws a right-pointing triangle
||draws an upward-pointing triangle
||draws a downward-pointing triangle
||align the shape to the left
||align the shape to the right
||align the shape to the top
||align the shape to the bottom
||draw the shape on top of the study
(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 )
//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 );
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.