You have indicator that does not call any indicator handle, so when the EA call that indicator through OnInit(), the call for that indicator is success, not the call for the indicator inside OnInit().
Say we have indicator A that call indikator B in A's OnInit(), and we comment out indikator B like this :
int OnInit() //--- OnInit of indicator A { handle = 0; //handle = indikator_B(...); //--- create handle of the indicator //if(handle==INVALID_HANDLE) //--- if the handle is not created // { Print("Failed to create a handle of indikator B); return(-1); // } return (0); }
An iCustom call to indicator A from EA will tell that the call of indicator A is success, that because the EA/MT detect that there's no other indicator except indicator A itself (read there is no indikator B).
If we remove all comments, the call will be also for indikator B. So if iCustom call indicator A and indikator B if failed, iCustom will return INVALID_HANDLE.
You can try that, say we deliberately miscalculate Moving Average indicator so it will return INVALID_HANDLE. Then create another indicator (indicator A) that call that MA indicator. An iCustom from EA call indicator A will fail because MA indicator is failed inside indicator A.
I hope you get that, coz I have problem explaining more in English :)

- www.mql5.com

- 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 have an indicator:
And EA:
And although indicator gives an alert and fails with return (-1),
iCustom() gives a regular handle, and alerts about success.
so i just lost another 2 hours on nothing. and i will lose another hour on bypassing this behaviour.
and ... INIT_FAILED and INIT_AGENT_NOT_SUITABLE should have negative values.
this way i don't see a reason to use this values. Oh, never mind.