- 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
Descriptive chart properties
The ChartSetString/ChartGetString functions enable the reading and setting of the following string properties of the charts.
Identifier |
Description |
---|---|
CHART_COMMENT |
Chart comment text |
CHART_EXPERT_NAME |
Name of the Expert Advisor running on the chart (r/o) |
CHART_SCRIPT_NAME |
Name of the script running on the chart (r/o) |
In chapter Displaying messages in the chart window, we learned about the Comment function which displays a text message in the upper left corner of the chart. The CHART_COMMENT property allows you to read the current chart comment: ChartGetString(0, CHART_COMMENT). It is also possible to access comments on other charts by passing their identifiers to the function. By using ChartSetString, you can change comments on the current and other charts, if you know their ID: ChartSetString(ID, CHART_COMMENT, "text").
If an Expert Advisor or/and a script is running in any chart, we can find out their names using these calls: ChartGetString(ID, CHART_EXPERT_NAME) and ChartGetString(ID, CHART_SCRIPT_NAME).
The script ChartList3.mq5, similar to ChartList2.mq5, supplements the list of charts with information about Expert Advisors and scripts. Later we will add to it information about indicators.
void ChartList()
|
This is an example of the output of this script.
Chart List
|
Here you can see that only one script is being executed.