Is it possible for an indicator to know if it was dropped on a chart vs. created by iCustom() from another indicator?

 

Hello all,

I have an indicator #1 that uses iCustom() to call another indicator #2.

Indicator #2 as part of its operation puts labels on the chart.

I can use ChartIndicatorsGet() within indicator #2 to test if it actually exists on a chart and if not, then not draw the labels.  No problem.

However, indicator #1 will be running while indicator #2 actually does exist on the chart, therefore, the instance of indicator #2 called from iCustom() in indicator #1 will still try to draw the labels, which creates weird flashing etc on screen because default values of fonts and font sizes might have been changed when indicator #2 was physically dropped on the chart.

Is there a way for indicator #2 to know "Regardless of whether or not I'm on the chart, was I actually put on the chart or was I called by iCustom() from somewhere else?"

Obviously I could add another parameter to the indicator #2, "dontDrawLabels", but I'm wondering if I can just determine the situation from the environment.

Any ideas? 

Thanks!!

 
Christian Berrigan:

Hello all,

I have an indicator #1 that uses iCustom() to call another indicator #2.

Indicator #2 as part of its operation puts labels on the chart.

I can use ChartIndicatorsGet() within indicator #2 to test if it actually exists on a chart and if not, then not draw the labels.  No problem.

However, indicator #1 will be running while indicator #2 actually does exist on the chart, therefore, the instance of indicator #2 called from iCustom() in indicator #1 will still try to draw the labels, which creates weird flashing etc on screen because default values of fonts and font sizes might have been changed when indicator #2 was physically dropped on the chart.

Is there a way for indicator #2 to know "Regardless of whether or not I'm on the chart, was I actually put on the chart or was I called by iCustom() from somewhere else?"

Yes, why should this be a problem? You should look into how to get the two indicators to communicate whether number one called number two or the other way around.