- Functions for getting the basic properties of the current chart
- Chart identification
- Getting the list of charts
- Getting the symbol and timeframe of an arbitrary chart
- Overview of functions for working with the complete set of properties
- Descriptive chart properties
- Checking the status of the main window
- Getting the number and visibility of windows/subwindows
- Chart display modes
- Managing the visibility of chart elements
- Horizontal shifts
- Horizontal scale (by time)
- Vertical scale (by price and indicator readings)
- Colors
- Mouse and keyboard control
- Undocking chart window
- Getting MQL program drop coordinates on a chart
- Translation of screen coordinates to time/price and vice versa
- Scrolling charts along the time axis
- Chart redraw request
- Switching symbol and timeframe
- Managing indicators on the chart
- Opening and closing charts
- Working with tpl chart templates
- Saving a chart image
Getting the number and visibility of windows/subwindows
Using the ChartGetInteger function, an MQL program can find the number of windows on a chart (including subwindows), as well as their visibility.
Identifier |
Description |
Value type |
---|---|---|
CHART_WINDOWS_TOTAL |
Total number of chart windows, including indicator subwindows (r/o) |
int |
CHART_WINDOW_IS_VISIBLE |
Subwindow visibility, the 'window' parameter is the subwindow number (r/o) |
bool |
Some subwindows can be hidden if the indicators placed in them are disabled on the current timeframe in the Properties dialog, on the Visualization tab. It is impossible to reset all flags: due to the nature of storage of tpl templates, such a state is interpreted as the enabling of all timeframes. Therefore, if the user wants to hide the subwindow for some time, it is necessary to leave at least one enabled flag on the most rarely used timeframe.
Setting indicator visibility on different timeframes
It should be noted that there are no standard tools in MQL5 for programmatic determination of the state and switching of specific flags. The easiest way to simulate such control is to save the tpl template and analyze it, with possible subsequent editing and loading (see section Working with tpl templates).
In the new version of the script ChartList4.mq5, we output the number of subwindows (one window, which is the main one, is always present), a sign of chart activity, a sign of a chart object, and a Windows handle.
const int win = (int)ChartGetInteger(id, CHART_WINDOWS_TOTAL);
|
Here's what the result might be.
Chart List
|
On the first chart (index 0) there is one subwindow (#1). There are two subwindows (#2) on the last chart, and the second one is currently hidden. Later, in the section Managing indicators on the chart, we will present the full version of ChartList.mq5, where we include in the report information about the indicators located in the subwindows and the main window.
Attention! A chart inside a chart object always has the CHART_WINDOW_IS_VISIBLE property equal to true, even if object visualization is disabled on the current timeframe or on all timeframes.