thanks, andrew.
I would add a new external parameter to the indicator which by default means "attached", and when you call it through iCustom set this parameter to "called".
The indi needs to be modified to skip the part where the objects are created when this parameter is "called".
this parameter may be any type you like, "attached", "called" are only example, it may be 0, 1 as well.
hi ydrol, that might just work! thanks. i will give it a try and let you know!
Returns name of the executed expert, script, custom indicator, or library, depending on the MQL4 program, from which this function has been called.
just following up, because my response was incomplete: if i run WindowFind() within the start() function of my indicator i get -1 regardless of whether the indicator is attached to a chart or if it is called through iCustom().
#property indicator_chart_window
int init() { IndicatorShortName("EP"); return (0); } int start() { int win_idx = WindowFind("EP"); Print("ON WINDOW ", win_idx); }
hi szgy74,
thanks for the response. however, i am not sure that i understand you.
for the bare-bones indicator code below:
#property indicator_chart_window int init() { IndicatorShortName("EP"); return(0); } int start() { Print("on window ", WindowFind("EP")); return(0); }
if i attach this to a chart then it outputs "on window -1" in the Experts tab of the terminal. this is not what i would have expected. the indicator is attached to the main chart, so i would have thought that WindowFind() would return 0. i naively thought that in the case that the indicator were not actually attached to anything [for example, if it were called through iCustom()] only then would it return -1.
have i got the wrong end of the stick here?
thanks, andrew.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi!
i have an indicator which draws quite a lot of objects onto a chart when it is attached. these objects are in addition to the lines associated with the indicator buffers. when i call this indicator from within an EA obviously the latter lines do not show up on the chart BUT all of the other objects that are drawn by the indicator do get drawn on the chart. is it possible to tell from within the indicator whether it is actually attached to a chart or if it is being called through iCustom?
thanks, andrew.