Class to provide simple reading mechanism from MetaTrader set files.
//+------------------------------------------------------------------+ //| Class CSetFileReader.                                            | //| Appointment: Class to provide reading mechanism from set file.  | //+------------------------------------------------------------------+ class CSetFileReader   { public:                     CSetFileReader(void)  {  }                     ~CSetFileReader(void)  {  }   //--- method of loading a set file   bool              Load(const string file_name);   //--- methods of access to protected data   string            FileName(void)            const { return(m_name);  };   int              Count(void)              const { return(ArraySize(m_entries)); }   bool              ContainsKey(const string key) const;   //--- methods of copy data from collection   int              CopyTo(string &dst_keys[],const bool withValues=0) const;   //--- method of access to the data   template<typename T>   bool              TryGetValue(const string key, T &ReturnedValue) const;   bool              TryGetValue(const string key, string &ReturnedValue) const;   }; //+------------------------------------------------------------------+
Usage Scenario:
An Expert Advisor is to be added to multiple charts with different symbols or timeframes.
Each instances of the Expert must have its own settings different from the others, depending on the current chart symbol, in addition to some other settings which are common to all charts.
Solution:
Copy the settings files from ‘MQL5Presets’ to ‘MQL5Files’ folder, use a text editor to modify them.
Then, each instance of the expert advisor will apply its new settings upon the Init event.
To start the Init event, simply switch the current chart timeframe.
Included a test expert advisor to explain the idea.
Advantages:
Settings of multiple running instances of the Expert advisor can be changed easily by using a text editor.
You edit the .set files, then switch the chart timeframe for the new settings to take effect.
Multi-symbol Expert Advisors:
The large amount of settings for multiple symbols cannot be managed easily from the user interface.
References:
https://www.mql5.com/en/code/24777