Download MetaTrader 5
To add comments, please log in or register
Publish your application in the Market - 7 million potential clients will see it
Ivan
120
Ivan 2011.06.30 11:06 

I am stuck with this error 4802.

When I try to get value of the custom indicator handle

 CustomIndicatorHandle=iCustom(...);

it says in the Experts tab: cannot load custom indicator (... )[4802]

The indicator is put into  C:\Program Files\MetaTrader 5\MQL5\Indicators

Please help!

Thanks. 

Alexey Da
Moderator
6613
Alexey Da 2011.06.30 13:44  

Please check that:

  1. Indicator are successfully compiled and placed into folder TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL5\\Indicators"
  2. The name of indicator and all input parameters of indicator are properly passed in iCustom function
If the problem is still exist you better write to service desk and provide following information:

  1. Which OS do you use?
  2. Is UAC enabled? 
  3. Build number of client terminal.
  4. Source code of your EA and indicator.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Client Terminal Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Client Terminal Properties - Documentation on MQL5
Ivan
120
Ivan 2011.06.30 19:06  
alexvd:

Please check that:

  1. Indicator are successfully compiled and placed into folder TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL5\\Indicators"
  2. The name of indicator and all input parameters of indicator are properly passed in iCustom function
If the problem is still exist you better write to service desk and provide following information:

  1. Which OS do you use?
  2. Is UAC enabled? 
  3. Build number of client terminal.
  4. Source code of your EA and indicator.

thanks alexvd. It is successfully compiled and works good. 

What you mean by TerminalInfoString(TERMINAL_DATA_PATH)+?

the indicator is very simple

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
#property indicator_type1   DRAW_LINE
#property indicator_width1  1
#property indicator_color1  Blue
#property indicator_label1  "A Line"

double Array_1[];

input double a = 0.1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,Array_1,INDICATOR_DATA);
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,//size of the bars array
                const int prev_calculated,//calculated bars on previous call
                const datetime &time[],//number of bars
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],//tick volume
                const long &volume[],//real volume or maybe lots
                const int &spread[])
{
  int bars=Bars(Symbol(),0);
  //Print("Bars = ",bars,", rates_total = ",rates_total,",  prev_calculated = ",prev_calculated);
  //Print("time[0] = ",time[0]," time[rates_total-1] = ",time[rates_total-1]);
  
  ArraySetAsSeries(high,true);
  
  for(int r=0;r<bars && !IsStopped();r++)
     Array_1[r]=high[r];
    
  //Comment("high[1] ", high[1]); 
 // 
   return(rates_total);
}

 

 I try to get value by an EA using

int OnInit()
  {
    CustomIndicatorHandle=iCustom(Symbol(),0,"IndicatorExample",a);//input parameters of the indicator separated by commas
    Print("CustomIndicatorHandle ", CustomIndicatorHandle);
    Comment("GetLastError() ",GetLastError() );

    return(0);
  }

When I try to get handle (buffer) value, it shows -1. I think for an expert everything is clear her.

Thanks a lot for the help. 

Andrei Moraru
1147
Andrei Moraru 2011.06.30 19:14  
Is your indicator file name "IndicatorExample.ex5"? Perhaps it is located in some subfolder inside MQL5/Indicators/?
Ivan
120
Ivan 2011.06.30 19:56  
enivid:
Is your indicator file name "IndicatorExample.ex5"? Perhaps it is located in some subfolder inside MQL5/Indica
//+------------------------------------------------------------------+
//|                                            Indicator Example.mq5 |
Ivan
120
Ivan 2011.06.30 19:57  

and is located here.

C:\Program Files\MetaTrader 5\MQL5\Indicators

 

Ivan
120
Ivan 2011.07.01 03:05  
  1. Which OS do you use? ====Windows XP
  2. Is UAC enabled? ======== not sure what is this
  3. Build number of client terminal. ======= 470
  4. Source code of your EA and indicator. ==== pasted above
Thank you.
Robert Simon
44
Robert Simon 2011.07.01 03:21  
User Account Control - Wikipedia, the free encyclopedia
  • en.wikipedia.org
To reduce the possibility of lower-privilege applications communicating with higher-privilege ones, another new technology, User Interface Privilege Isolation is used in conjunction with User Account Control to isolate these processes from each other.2 One prominent use of this is Internet Explorer 7's "Protected Mode".3 Operating systems on...
Ivan
120
Ivan 2011.07.01 06:02  
Robert Simon
44
Robert Simon 2011.07.01 10:55  
Learner21:
How to enable it?

Enable - C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f

Disable - C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

Alexey Da
Moderator
6613
Alexey Da 2011.07.01 17:21  

I've copied your code and tried to reproduce your situation.

I'm getting a valid handle to indicator without any errors.

2011.01.07 16:58:38     TmpExp (EURUSD,M1)      CustomIndicatorHandle 10

 

 My OnInit function in EA

int OnInit()
  {
   CustomIndicatorHandle=iCustom(Symbol(),PERIOD_CURRENT,"tmp",a);//input parameters of the indicator separated by commas
   Print("CustomIndicatorHandle ",CustomIndicatorHandle);
   Comment("GetLastError() ",GetLastError());

   return(0);
  }

 Indicator was saved (tmp.mq5) and compiled (tmp.ex5). All files (mq5 and ex5) placed in MQL5\Indicators\

 

Please, write to service desk.

 

/ /12
To add comments, please log in or register