Bug in Standard Library (\Include\Controls\Dialog.mqh)

 

The implementation of bool CAppDialog::CreateIndicator(const int x1,const int y1,const int x2,const int y2) method has the following two lines:

   int total=ChartIndicatorsTotal(m_chart.ChartId(),m_subwin);
   m_indicator_name=ChartIndicatorName(m_chart.ChartId(),m_subwin,total-1);

Unfortunately, this method of detecting the indicator's name is flawed. It works fine when the indicator has been just added to the chart or when it is the only indicator in the given subwindow, but it starts detecting the wrong indicator's name once you add more indicators to the subwindow and change timeframe or restart the platform (or otherwise cause re-initialization).

As this name is used in Ini-file saving and loading by the IniFileSave() and IniFileLoad() functions of the same class, the result is that the dialog window can no longer save and load its parameters correctly.