drawImageRelative()
Previous Top Next
drawImageRelative( barIndex, yValue, image, url, Flags [, tagID] )
The drawImageRelative function allows you to draw image objects at any location on your chart. Any image object created with drawImageRelative will 'stick' to the location where it was originally anchored. So, a image 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 image object will be anchored (x-axis) |
yValue |
the series value where the image object will be anchored (y-axis) |
image |
see Image Objects below (must be a string) |
url |
a url to be launched if image is clicked, or null if not used |
Flags |
see Image Flags below |
tagID |
optional. a unique identifier for this image object or null |
Image Objects
SystemHappyFace |
SystemNotHappy |
SystemSadFace |
SystemReallyHappyFace |
SystemCheckMarkRed |
SystemCheckMarkGreen |
SystemCheckMarkYellow |
SystemCheckMarkBlue |
SystemCheckMarkBlack |
SystemCheckMarkWhite |
SystemLightOn |
SystemLightOff |
SystemCircleRed |
SystemCircleGreen |
SystemCircleYellow |
SystemCircleBlue |
SystemCircleBlack |
SystemCircleWhite |
SystemCircleButtonRed |
SystemCircleButtonGreen |
SystemCircleButtonYellow |
SystemCircleButtonBlue |
SystemCircleButtonBlack |
SystemCircleButtonWhite |
SystemQuestionRed |
SystemQuestionGreen |
SystemQuestionYellow |
SystemQuestionBlue |
SystemQuestionBlack |
SystemQuestionWhite |
SystemExclamationRed |
SystemExclamationGreen |
SystemExclamationYellow |
SystemExclamationBlue |
SystemExclamationBlack |
SystemExclamationWhite |
SystemInfoRed |
SystemInfoGreen |
SystemInfoYellow |
SystemInfoBlue |
SystemInfoBlack |
SystemInfoWhite |
SystemStopRed |
SystemStopGreen |
SystemStopYellow |
SystemStopBlue |
SystemStopBlack |
SystemStopWhite |
SystemLightning |
SystemSnowflake |
SystemSun |
Image Flags
Image.LEFT |
align the image to the left |
Image.RIGHT |
align the image to the right |
Image.TOP |
align the image to the top |
Image.BOTTOM |
align the image to the bottom |
Image.ONTOP |
draw the image on top of the study |
Note: Image flags can be ORed together to combine various attributes (e.g., Image.ONTOP | Image.LEFT ) |
Usage
//draw a happy face over the high of the bar 5 bars back and color it red
drawImageRelative( -5, high(-5), "SystemHappyFace", null, Image.TOP | Image.ONTOP );
Notes
It’s possible to define mouse-button handler function for figures created by drawImageRelative. 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.