drawShapeAbsolute() |
Previous Top Next |
drawShapeAbsolute( barIndex, yValue, shape, url, color, Flags [, tagID] )
The drawShapeAbsolute function allows you to draw shape objects at any location on your chart. Any shape object created with drawShapeAbsolute will remain at its designated relative offset from the most current bar. So, a shape object drawn with drawShapeAbsolute at a bar index of -10 will always remain 10 bars back from the most current bar.
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 drawShapeAbsolute 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. Since we are using
//drawShapeAbsolute, the circle will always remain at an offset of 5 bars back
drawShapeAbsolute( -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 drawShapeAbsolute. 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.