Need help with indicator count.

 

Greetings all. I'm just learning to code and have few questions. Can someone tell me please how to do this thing;


1- How to prevent my custom indicator being duplicated? If it's already on the chart and I will drop it on to the chart again, I want it to detect the first one and abort launching the second one with the same name.

something like this: but working :)

int OnInit()
  {
   int indicators_total = ChartIndicatorsTotal(0,0);
   for(int i = 0; indicators_total > i; i++)
     {
      if(ChartIndicatorName(0,0,i)==IndicatorName)
      return(INIT_FAILED);
     }
  }



2 - How do I detect if there is more than one indicator with the same name on the chart?



3 - How to write an "if" statement to do something if indicator "x" is not present on the chart?

Something like this: but working :)

 if(IndicatorName==0)
        {
         Print("INDI ",IndicatorName, " NOT DETECTED");
        }



4 - Is there a way to put keyboard event (F11 - full screen) into code? To make my custom indicator be able to detect when full screen is on just like with "chart scale" ChartGetInteger(0,CHART_SCALEFIX); ?

Reason: