Discussion of article "Use of Resources in MQL5"

 

New article Use of Resources in MQL5 is published:

MQL5 programs not only automate routine calculations, but also can create a full-featured graphical environment. The functions for creating truly interactive controls are now virtually the same rich, as those in classical programming languages. If you want to write a full-fledged stand-alone program in MQL5, use resources in them. Programs with resources are easier to maintain and distribute.

Author: MetaQuotes

 

Now including resources into your MQL5 programs became even easier. To do this, MetaEditor 5 has the special Insert Resources command.


Resources Inserting

To make using of resource files in developed applications easier, the "Insert Resources Insert Resources" command is implemented in the "Tools" menu. This command allows declaring resource files from a selected folder in the current file using the #resource directive.

Once this command is executed, the standard dialog window of your operating system appears. In it you should select one or several resource files to be declared in the file.

  • Resource files can be located only within the /MQL5 directory of the client terminal. Files outside that directory cannot be used.
  • Only *.wav and *.bmp files can be used as resource files.

Once the above actions are performed, the corresponding directives will be added to the beginning of the file. For example:

#resource "\Images\example.bmp"
or
#resource "resources\example.bmp"

The path to resource files can be specified in two ways:

  • Relatively to the current file (without the "\" symbol at the beginning of path)
    This way is used in case the resource files are located in the same directory as the current file or in one of its subfolders.
  • Relatively to the /MQL5 directory of the client terminal (the "\" symbol is specified at the beginning of path)
    This way is used in all other cases.
 

MetaTrader 5 Client Terminal build 730
MQL5: Added support for storing indicators in EX5 resources. 

#resource "Examples\Fractals.ex5"

Could someone please give an example of how to use the indicator.

 
is it possible to include resources in ex4 (mt4) products?  Or is this 'resources' thing exclusively an ex5 (mt5) feature?
 
FinGeR:

Could someone please give an example of how to use the indicator.

Example: https://www.mql5.com/ru/forum/3409#comment_408123

#resource "\\Indicators\\Examples\\CHO.EX5"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   int handle=iCustom(Symbol(),Period(),"::Indicators\\Examples\\CHO.EX5");
   if(handle!=INVALID_HANDLE)
     {
      Print("Indicator created!");
      IndicatorRelease(handle);
     }
//---
   return(0);
  }
void OnDeinit(const int reason)
  {
  }
void OnTick()
  {
  }
Обсуждение статьи "Использование ресурсов в MQL5"
  • www.mql5.com
Программы на MQL5 позволяют не только автоматизировать рутинные вычисления, но и создавать полноценную графическую оболочку.
 
4evermaat:
is it possible to include resources in ex4 (mt4) products?  Or is this 'resources' thing exclusively an ex5 (mt5) feature?
Only for MQL5.
 
thanks.
 

i can't add any products to Market, every time i try to add ex4 file 

this warning appears :

Please recompile your product with new compiler

 --------------------------

 and i did Compile it with the latest MetaEditor ? so what is wrong ? 

 

Happy New Year :)

any answers? 

 
yousef hammad:

i can't add any products to Market, every time i try to add ex4 file 

this warning appears :

Please recompile your product with new compiler

 --------------------------

 and i did Compile it with the latest MetaEditor ? so what is wrong ? 

What metaeditor version you use? The latest version is 5.00 build 1241 (22 Dec 2015).
 
Since the "resource" technology is only available in mt5, how do I post a MT4 product consisting of an EA and a Custom Indicator (the EA calls the CustomIndicator) ?