Watch how to download trading robots for free
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

ChartBrowser - expert for MetaTrader 5

Stanislav Korotky

Views:
1740
Rating:
votes: 22
Published:
2021.03.02 19:46
\MQL5\ \MQL5\Include\Layouts\png\
size6.csv (1.05 KB) view
size10.csv (1.05 KB) view

This utility allows you to view lists of all open charts, running expert advisers, indicators, and scripts. All the lists are sorted in alphabetic order (case-sensitive). In any list you may select an item (either chart or MQL-program) and click the button Go to switch to corresponding chart instantly. The lists provide 2-way binding of the charts and MQL-programs.

All lists contain primary and secondary elements. Primary elements are shown without padding and enumerate the tab's major content (for example, in the chart list each primary element is a chart name in the form "symbol timeframe"; in the indicator list each element is an indicator name, etc).

Secondary elements are shown with a padding. Each secondary element is bound to previous primary element. For example, in the chart list there can be multiple secondary elements under specific chart, representing expert adviser (marked by "[E]"), indicators (marked by "[I]"), or script (marked by "[S]"), running on that chart. If a chart has no programs attached, there are no secondary elements for it. 

In the tabs which provide lists of MQL-programs the secondary elements are charts. Each primary element (expert, indicator, or script) is always followed by a row with its chart name (secondary element).

If a chart has subwindows, their number is also displayed after the chart name.

Indicator name is appended with a tuple "<n;m>", where n is an index of window/subwindow where the indicator is placed (0 means the main window), and m is an index (0-based) of the indicator in that window/subwindow.

Number of primary elements on the current tab is displayed in the dialog title.

THE FILE ChartBrowser.bundle.mq5 IS GENERATED BY MQL5 PACKER UTILITY TO PASS THE CODEBASE VALIDATION PROCESS, WHICH DOES NOT SUPPORT MORE THAN 32 SOURCE FILES IN ONE PROGRAM! TO GET ACTUAL SOURCE CODES WITH SEPARATE HEADER FILES PLEASE EXTRACT THEM FROM THE ATTACHED ARCHIVE ChartBrowser.mq5.zip, PRESERVING FOLDER HIERARCHY.


Animated screenshot is provided below.

MetaTrader 5 ChartBrowser GUI animation

The utility is implemented as a non-trading expert adviser with a graphical user interface (GUI) based on a special MQL-driven layout declaration described in the articles: 1, 2, 3. Updated versions of ControlsPlus and Layouts are included.

You don't need to read and understand everything in the articles to get it working. It can be helpful only if you're going to develop GUI for your own program.

Here is how the declarative part of this GUI looks like in MQL (can be used as an example of GUI layout for MQL developers):

  StdLayoutBase::setCache(cache);
  {
    // GUI Layout for MQL app (using ControlsPlus - patched standard controls library)

    _layout<ChartBrowserForm> dialog(this, name, x1, y1, x2, y2);
    
    {
      _layout<CBoxV> main("main", ClientAreaWidth(), ClientAreaHeight(), WND_ALIGN_CLIENT);
      main <= PackedRect(0, 0, 0, 0);
      {
        {
          _layout<CBoxH> Controls("Controls", 192, 30, (ENUM_WND_ALIGN_FLAGS)(WND_ALIGN_CONTENT|(ENUM_WND_ALIGN_FLAGS)(WND_ALIGN_WIDTH|WND_ALIGN_TOP)));
          Controls <= PackedRect(5, 0, 5, 0) <= HORIZONTAL_ALIGN_STACK;
          {
            {
              _layout<TabButton> ChartsButton("ChartsButton", 64, 20, (ENUM_WND_ALIGN_FLAGS)WND_ALIGN_BOTTOM);
              ChartsButton <= "Charts" <= PackedRect(0, 0, 0, 0);
              ChartsButton["enable"] <= false;
              cache.registerGroupButton(ChartsButton.get());
            }
            {
              _layout<TabButton> IndicatorsButton("IndicatorsButton", 64, 20, (ENUM_WND_ALIGN_FLAGS)WND_ALIGN_BOTTOM);
              IndicatorsButton <= "Indicators" <= PackedRect(0, 0, 0, 0);
              cache.registerGroupButton(IndicatorsButton.get());
            }
            {
              _layout<TabButton> ExpertsButton("ExpertsButton", 64, 20, (ENUM_WND_ALIGN_FLAGS)WND_ALIGN_BOTTOM);
              ExpertsButton <= "Experts" <= PackedRect(0, 0, 0, 0);
              cache.registerGroupButton(ExpertsButton.get());
            }
            {
              _layout<TabButton> ScriptsButton("ScriptsButton", 64, 20, (ENUM_WND_ALIGN_FLAGS)WND_ALIGN_BOTTOM);
              ScriptsButton <= "Scripts" <= PackedRect(0, 0, 0, 0);
              cache.registerGroupButton(ScriptsButton.get());
            }

            {
              _layout<CButton> GoButton("GoButton", 50, 20, (ENUM_WND_ALIGN_FLAGS)WND_ALIGN_RIGHT);
              GoButton <= "Go" <= PackedRect(0, 0, 0, 0) <= clrWhite;
              GoButton["background"] <= clrDodgerBlue;
              GoButton["font"] <= "Arial Black";
            }
          }
          
        }
        {
          _layout<CBoxH> listContainer("listContainer", 192, 304, (ENUM_WND_ALIGN_FLAGS)(WND_ALIGN_CONTENT|WND_ALIGN_CLIENT));
          listContainer <= PackedRect(0, 30, 0, 0);
          {
            {
              _layout<ListViewResizable> list("list", 190, 304, WND_ALIGN_HEIGHT);
              list <= PackedRect(0, 0, 0, 0);
              cache.registerList(list.get());
              cache.fillList(0);
            }
          }
        }
      }
    }
  }


The tabbed control is simulated by 4 customized buttons (TabButton class).


    Licensing class and script with 256bit Encryption Licensing class and script with 256bit Encryption

    This is a Script and Class for creating, evaluating and adding accounts to an encrypted license file for licensing an MQL EA or Indicator.

    Stable Damiani Volatmeter Stable Damiani Volatmeter

    Volume/Volatility Indicator

    DR Caco Maia DR Caco Maia

    Double breakage of MA8 and MA20 means with stochastic and trix filters, as described by Caco Maia.

    Display open positions total stoploss and takeprofit value MT5 Display open positions total stoploss and takeprofit value MT5

    This is a MT5 expert advisor which displays the total stoploss and takeprofit value for open positions.