|
EventChartCustom
The function generates a custom event for the specified chart.
bool EventChartCustom(
|
Parameters
chart_id
[in] Chart identifier. 0 means the current chart.
custom_event_id
[in] ID of the user events. This identifier is automatically added to the value CHARTEVENT_CUSTOM and converted to the integer type.
lparam
[in] Event parameter of the long type passed to the OnChartEvent function.
dparam
[in] Event parameter of the double type passed to the OnChartEvent function.
sparam
[in] Event parameter of the string type passed to the OnChartEvent function. If the string is longer than 63 characters, it is truncated.
Return Value
Returns true if a custom event has been successfully placed in the events queue of the chart that receives the events. In case of failure, it returns false. Use GetLastError() to get an error code.
Note
An Expert Advisor or indicator attached to the specified chart handles the event using the function OnChartEvent(int event_id, long& lparam, double& dparam, string& sparam).
For each type of event, the input parameters of the OnChartEvent() function have definite values that are required for the processing of this event. The events and values passed through this parameters are listed in the below table.
Event |
Value of the id parameter |
Value of the lparam parameter |
Value of the dparam parameter |
Value of the sparam parameter |
---|---|---|---|---|
Event of a keystroke |
CHARTEVENT_KEYDOWN |
code of a pressed key |
Repeat count (the number of times the keystroke is repeated as a result of the user holding down the key) |
The string value of a bit mask describing the status of keyboard buttons |
Mouse event (if property CHART_EVENT_MOUSE_MOVE=true is set for the chart) |
CHARTEVENT_MOUSE_MOVE |
the X coordinate |
the Y coordinate |
The string value of a bit mask describing the status of mouse buttons |
Event of graphical object creation (if CHART_EVENT_OBJECT_CREATE=true is set for the chart) |
CHARTEVENT_OBJECT_CREATE |
— |
— |
Name of the created graphical object |
Event of change of an object property via the properties dialog |
CHARTEVENT_OBJECT_CHANGE |
— |
— |
Name of the modified graphical object |
Event of graphical object deletion (if CHART_EVENT_OBJECT_DELETE=true is set for the chart) |
CHARTEVENT_OBJECT_DELETE |
— |
— |
Name of the deleted graphical object |
Event of a mouse click on the chart |
CHARTEVENT_CLICK |
the X coordinate |
the Y coordinate |
— |
Event of a mouse click in a graphical object belonging to the chart |
CHARTEVENT_OBJECT_CLICK |
the X coordinate |
the Y coordinate |
Name of the graphical object, on which the event occurred |
Event of a graphical object dragging using the mouse |
CHARTEVENT_OBJECT_DRAG |
— |
— |
Name of the moved graphical object |
Event of the finished text editing in the entry box of the LabelEdit graphical object |
CHARTEVENT_OBJECT_ENDEDIT |
— |
— |
Name of the LabelEdit graphical object, in which text editing has completed |
Event of changes on a chart |
CHARTEVENT_CHART_CHANGE |
— |
— |
— |
ID of the user event under the N number |
CHARTEVENT_CUSTOM+N |
Value set by the EventChartCustom() function |
Value set by the EventChartCustom() function |
Value set by the EventChartCustom() function |
Example:
//+------------------------------------------------------------------+
|
See also