MQL4 Reference Chart Operations ChartWindowFind
|
ChartWindowFindThe function returns the number of a subwindow where an indicator is drawn. There are 2 variants of the function. 1. The function searches in the indicated chart for the subwindow with the specified "short name" of the indicator (the short name is displayed in the left top part of the subwindow), and it returns the subwindow number in case of success.
2. The function must be called from a custom indicator. It returns the number of the subwindow where the indicator is working.
Parameters chart_id [in] Chart ID. 0 denotes the current chart. indicator_shortname [in] Short name of the indicator. Return Value Subwindow number in case of success. In case of failure the function returns -1. Note If the second variant of the function (without parameters) is called from a script or Expert Advisor, the function returns -1. Don't mix up the short name of an indicator and a file name, which is specified when an indicator is created using iCustom() function. If the indicator's short name is not set explicitly, then the name of the file containing the source code of the indicator, is specified in it during compilation. It is important to correctly form the short name of an indicator, which is recorded in the INDICATOR_SHORTNAME property using the IndicatorSetString() function. It is recommended that the short name contains values of the indicator's input parameters, because the indicator deleted from a chart in the ChartIndicatorDelete() function is identified by its short name. Example:
See also |