Delete News Flags at bottom of chart

 

Hi

What is the best way to delete all the news flags at the bottom of the chart.

This code works but I have to change the time frame few times so that the code runs in the Oninit function then it deletes few of the news flags at a each time. any suggestions? thanks

for (int i = 1; i <= ObjectsTotal(0); i++) {
      string objName = ObjectName(0, i);
      if(ObjectGetInteger(0, objName, OBJPROP_TYPE) == OBJ_EVENT) {
        ObjectDelete(0, objName);
      }
    }
    ChartRedraw();