Call to custom indicator suddently stopped working - page 3

 

After a lot of testing, I have good news for you all!

If you write like this

#resource "/Indicators/Original/Smaple.ex5"

if you call it like this, it seems to refer to the resource

indi_handle = iCustom(_Symbol,PERIOD_CURRENT,"Sample.ex5");

I don't know why, and I don't know where this information is located, but it worked anyway.

Do not use this traditional writing style

"::Indicators/Original/Sample.ex5"

 
しゅーれい #: After a lot of testing, I have good news for you all! If you write like this if you call it like this, it seems to refer to the resource I don't know why, and I don't know where this information is located, but it worked anyway. Do not use this traditional writing style "::Indicators/Original/Sample.ex5"

I suggest you read the documentation again. You supposed to use a double back-slash "\\" and not a forward slash "/".

Working with custom indicators included as resources

One or several custom indicators may be necessary for the operation of MQL5 applications. All of them can be included into the code of an executable MQL5 program. Inclusion of indicators as resources simplifies the distribution of applications.

Below is an example of including and using SampleIndicator.ex5 custom indicator located in terminal_data_folder\MQL5\Indicators\ directory:

//+------------------------------------------------------------------+
//|                                                     SampleEA.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#resource "\\Indicators\\SampleIndicator.ex5"
int handle_ind;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   handle_ind=iCustom(_Symbol,_Period,"::Indicators\\SampleIndicator.ex5");
   if(handle_ind==INVALID_HANDLE)
     {
      Print("Expert: iCustom call: Error code=",GetLastError());
      return(INIT_FAILED);
     }
//--- ...
   return(INIT_SUCCEEDED);
  }

Documentation on MQL5: MQL5 programs / Resources
Documentation on MQL5: MQL5 programs / Resources
  • www.mql5.com
Resources - MQL5 programs - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
mv6278 #:

Hi Davi,

I don't think this is the solution because:

1) this problem appeared after a MT5 release around October last year  (I cant' tell which one exactly as we cannot use those versions again). I have been using resource loading to load my indicators  when the EA starts up since Sept/2019 and I had no issues until those MT5 releases

2) If I remove all ex5 resources from the project (in the navigator window) and compile the project again, I'm able to start the EA and load my indicators. However, if I compile the project after this (it doesn't matter if I make changes or not to code), the error comes again. Then I have to repeat the process of removing all .ex5 files and compiling the project again to have this working again

This is the solution, i tried it myself.

Reason: