- 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
Undocking chart window
Chart windows in the terminal can be undocked from the main window, after which they can be moved to any place on the desktop, including other monitors. MQL5 allows you to find out and change this setting: the corresponding properties are included in the ENUM_CHART_PROPERTY_INTEGER enumeration.
Identifier |
Description |
Value type |
---|---|---|
CHART_IS_DOCKED |
The chart window is docked (true by default). If set to false, then the chart can be dragged outside the terminal |
bool |
CHART_FLOAT_LEFT |
The left coordinate of the undocked chart relative to the virtual screen |
int |
CHART_FLOAT_TOP |
The top coordinate of the undocked chart relative to the virtual screen |
int |
CHART_FLOAT_RIGHT |
The right coordinate of the undocked chart relative to the virtual screen |
int |
CHART_FLOAT_BOTTOM |
The bottom coordinate of the undocked chart relative to the virtual screen |
int |
Let's set the tracking of these properties in the ChartDock.mq5 script.
void OnStart()
|
If you now run the script, then undock the chart using the context menu (unpress the Docked switch command) and move or resize the chart, the corresponding logs will be added to the journal.
Initial state:
|
This section completes the description of properties managed through the ChartGet and ChartSet functions, so let's summarize the material using a common script ChartFullSet.mq5. It keeps track of the state of all properties of all types. The initialization of the flags array is done by simply filling in successive indexes in a loop. The maximum value is taken with a margin in case of new properties, and extra non-existent numbers will be automatically discarded by the check built into the ChartModeMonitorBase class (remember the detect method).
After activating the script, try changing any settings while watching the program messages in the log.