onLButtonDown()

ICE Data Services -

onLButtonDown() Mouse Functions

A user-defined function that executes when the left mouse button is pressed down.

Syntax
function onLButtonDown( [ nBarIndex][, nYValue][, nXPixel ][, nYPixel ] ) {

} 

 


Parameters
Parameter: Description:Default:
nBarIndex [Optional]  Bar Index on mouse event.

 

n/anYValue[Optional]  Price value (or Y-axis) on mouse event.

 

n/anXPixel [Optional]  X-axis pixel coordinate from top left corner of study window on mouse event (7.9.1 and later).

 

n/anYPixel [Optional]  Y-axis pixel coordinate from top left corner of study window on mouse event (7.9.1 and later).

 

n/a
Return Value(s)
N/A

Notes
The optional parameters listed above are used to pass the corresponding data to the onLButtonDown() user-defined function.  This function must be added to the formula outside of main() as in the following code example.

The nXPixel and nYPixel parameters on only available in version 7.9.1 and later.

Be aware that onLButtonDown() and onLButtonUp() also get called on the left double-click event.

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 compatibility.


Code Examples
7.9.1 or later
function main() {

}

function onLButtonDownbarIndex, yValue, x, y) {
   debugPrintln("LButton Down: " + barIndex + ", " + yValue + "  x: " 
        + x + "  y: " + y);
   var text = "Left Button Down " + barIndex + " at " + yValue.toFixed(2) 
        + "  x: " + x + "  y: " + y;
   drawTextAbsolute(5, 35, text, Color.white, Color.navy, 
        Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.BOLD,
        null, 14, "ClickInfo");
}

7.9 or earlier
function main() {

}

function onLButtonDownbarIndex, yValue) {
   debugPrintln("LButton Down: " + barIndex + ", " + yValue );
   var text = "Left Button Down " + barIndex + " at " + yValue.toFixed(2);
   drawTextAbsolute(5, 35, text, Color.white, Color.navy, 
        Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.BOLD,
        null, 14, "ClickInfo");
}



See Also
Mouse Functions
eSignal Bulletin Board Search Engine
Help Guides and Tutorials