Please check that:
- Indicator are successfully compiled and placed into folder TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL5\\Indicators"
- The name of indicator and all input parameters of indicator are properly passed in iCustom function
- Which OS do you use?
- Is UAC enabled?
- Build number of client terminal.
- Source code of your EA and indicator.
- www.mql5.com
Please check that:
- Indicator are successfully compiled and placed into folder TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL5\\Indicators"
- The name of indicator and all input parameters of indicator are properly passed in iCustom function
- Which OS do you use?
- Is UAC enabled?
- Build number of client terminal.
- 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.
Is your indicator file name "IndicatorExample.ex5"? Perhaps it is located in some subfolder inside MQL5/Indica
//+------------------------------------------------------------------+ //| Indicator Example.mq5 |
and is located here.
C:\Program Files\MetaTrader 5\MQL5\Indicators
- Which OS do you use? ====Windows XP
- Is UAC enabled? ======== not sure what is this
- Build number of client terminal. ======= 470
- Source code of your EA and indicator. ==== pasted above
- en.wikipedia.org
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
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.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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.