Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1361

 
Dmitriy VC #:

It's understandable. It's done that way.

The question is how to place it in the Marketplace. When publishing the Expert, is it possible to specify the resource file as well...

To paraphrase:

- if in the Expert Advisor's code there is a link to a resource that contains a custom indicator, will the system offer to download it, too?

The resource is inserted by command #resource "<resource file path>".

#resource "<путь_к_файлу_ресурса>"
The length of the constant string <resource_file_path> must not exceed 63 characters.

Names of all files and directories included in resources must be in English.

The compiler searches the resource by the specified path in the following sequence:

  • if there is a backslash separator "\" (spelled "\\") at the beginning of the path, the resource is searched relative to terminal_data_directory\MQL4\,
  • if there is no backslash, the resource is searched relative to the location of the source file, in which this resource is written.
 

here is the connection of the indicator as a resource at the bottom

https://www.mql5.com/ru/docs/runtime/resources

Документация по MQL5: Программы MQL5 / Ресурсы
Документация по MQL5: Программы MQL5 / Ресурсы
  • www.mql5.com
Ресурсы - Программы MQL5 - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
The idea is that if you connect the indicator to the EA via a resource, the compilation will produce one file that you can place in the Marketplace.
 
Aleksei Stepanenko #:
In idea, when you connect the indicator to the Expert Advisor through a resource, the compilation results in a single file that you can place in the Market.

Alas. An indicator is an indicator and when connected through a resource, the Expert Advisor only refers to it. They work differently, don't they? You get one file even when the sounds and pictures are in the resource...

 
Fast235 #:

here is the connection of the indicator as a resource at the bottom

https://www.mql5.com/ru/docs/runtime/resources

Guys, I don't have many posts here, but I know the "plain truth".

And the question is not how to connect it as a resource, but how to upload one product consisting of two files to Market...

Does anyone have such experience?

 
All indicators are included in one file (EA), how else can you talk about two files?
 
Fast235 #:
into one file and pack everything

No. The Indicator can process events that the Expert cannot and vice versa. Therefore there is no way to have one file. They are different programs.

For example, Indicator handles OnCalculate() and cannot handle OnTrade(). How can I combine all these features in one eche? Please teach me!

Документация по MQL5: Программы MQL5 / Выполнение программ
Документация по MQL5: Программы MQL5 / Выполнение программ
  • www.mql5.com
Выполнение программ - Программы MQL5 - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Dmitriy VC #:

No. The Indicator can process events that the Expert cannot and vice versa. Therefore there is no way to have one file. They are different programs.

You can continue to think so)

 
Документация по MQL5: Программы MQL5 / Выполнение программ
Документация по MQL5: Программы MQL5 / Выполнение программ
  • www.mql5.com
Выполнение программ - Программы MQL5 - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 

Here's the indicator:

#property version   "1.00"
#property strict
#property indicator_chart_window

int OnInit()
   {
   
   return(INIT_SUCCEEDED);
   }

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
   {
   printf("preved medved!");
   return(rates_total);
   }

Here's the expert:

#property version   "1.00"
#property strict
#resource "\\Indicators\\Res_Ind.ex4"

int OnInit()
   {
   return(INIT_SUCCEEDED);
   }

void OnDeinit(const int reason)
   {
   
   }

void OnTick()
   {
   double val=iCustom(Symbol(),0,"::Indicators\\Res_Ind.ex4",0,0);
   }

Here's everything in one file:

Four is true, but so is five.
Files:
Res_Exp.ex4  12 kb