Chart "Name" - where can I get it?

 

Getting the ChartID is easy. You'd think there would be a corresponding human-readable name or description or at least that little readout at the top left corner of every chart:


Anything would be better than nothing.

How can I get that info out of a function or the terminal given the ChartID?

 
Millard Melnyk:

Getting the ChartID is easy. You'd think there would be a corresponding human-readable name or description or at least that little readout at the top left corner of every chart:


Anything would be better than nothing.

How can I get that info out of a function or the terminal given the ChartID?

for timeframe: https://www.mql5.com/en/docs/chart_operations/chartperiod

for symbol: https://www.mql5.com/en/docs/chart_operations/chartsymbol

for symbol description: https://www.mql5.com/en/docs/marketinformation/symbolinfostring and https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_string

Documentation on MQL5: Chart Operations / ChartPeriod
Documentation on MQL5: Chart Operations / ChartPeriod
  • www.mql5.com
Returns the timeframe period of specified chart. Parameters chart_id=0 [in]  Chart ID. 0 means the current chart. Return Value The function...
 
Millard Melnyk:

Getting the ChartID is easy. You'd think there would be a corresponding human-readable name or description or at least that little readout at the top left corner of every chart:


Anything would be better than nothing.

How can I get that info out of a function or the terminal given the ChartID?

In MetaTrader, there isn't a built-in function to directly retrieve the human-readable name or description of a chart given its ChartID. However, you can achieve this by using a combination of functions to gather information about the chart.

One way to approach this is to use the ChartGetSymbol() function to get the symbol name associated with the chart, and then you can use SymbolInfoString() function to retrieve additional information about the symbol, such as its description.

Use it like this...

void GetChartInfo(int chartID)
{
    string symbol = ChartGetSymbol(chartID);
    string description = SymbolInfoString(symbol, SYMBOL_DESCRIPTION);

    Print("Chart ID: ", chartID);
    Print("Symbol: ", symbol);
    Print("Description: ", description);
}

You can call this function with the ChartID of the chart you're interested in, and it will print out the ChartID, symbol name, and description associated with that chart.

The description may not always be available or may not be set for all symbols, as it depends on the broker's data feed and configuration. Additionally, if you need additional information about the chart, such as its timeframe or template name, you can explore other functions like ChartPeriod() and ChartGetInteger() to retrieve that information that works as well. I hope it helps

 
Nardus Van Staden #:

In MetaTrader, there isn't a built-in function to directly retrieve the human-readable name or description of a chart given its ChartID. However, you can achieve this by using a combination of functions to gather information about the chart.

One way to approach this is to use the ChartGetSymbol() function to get the symbol name associated with the chart, and then you can use SymbolInfoString() function to retrieve additional information about the symbol, such as its description.

Use it like this...

You can call this function with the ChartID of the chart you're interested in, and it will print out the ChartID, symbol name, and description associated with that chart.

The description may not always be available or may not be set for all symbols, as it depends on the broker's data feed and configuration. Additionally, if you need additional information about the chart, such as its timeframe or template name, you can explore other functions like ChartPeriod() and ChartGetInteger() to retrieve that information that works as well. I hope it helps

Thanks man, I'll look into that.