Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

CSetFileReader - library for MetaTrader 5

Views:
3284
Rating:
(12)
Published:
2020.01.27 10:10
Updated:
2020.01.27 15:12
\MQL5\Include\ \MQL5\Experts\ \MQL5\Files\
audusd.set (0.46 KB)
eurusd.set (0.46 KB)
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

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 'MQL5\Presets' to 'MQL5\Files' 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/articles/650

https://www.mql5.com/en/code/24777

https://www.mql5.com/en/docs/standardlibrary/generic/chashmap

https://github.com/EA31337/EA31337-classes/blob/eddf613bd81fbf9e001f5622c358ac1e76aeb2b3/SetFile.mqh

    3D Moving Average 3D Moving Average

    The first really 3D indicator "Moving Average".

    CHistoryPositionInfo Class CHistoryPositionInfo Class

    A class for easy access to the closed position properties.

    Trade Copier - Open Source - Multiplatform - Transmitter Side Trade Copier - Open Source - Multiplatform - Transmitter Side

    Trade Transmitter will Transmit Trades from MT5 Demo or Real accounts using CSV Files. Each trade request created manually or by other EAs on MT5 terminal will be automatically transmitted. Positions and orders summaries are also transmitted, so the receiver on the other platform can catch up, in case it misses any of the trade request transmissions. This Code will save your time if you are working on a bridge to copy trades between MT5 and any other platform.

    Forex_Market_Hours_GMT_v4.0 Forex_Market_Hours_GMT_v4.0

    The good old MT4 indicator! Now for MetaTrader 5.