news text with "/" not considered OBJ_EVENT

 

Hi

I am trying to remove the news event flags using the code below, which fails to remove object with the "/" in their text. Is this a bug? And how would you delete all the news flags at the button of the chart? Thanks

void deleteNewsFlags(){
  // delete event objects
  for (int i = 1; i <= ObjectsTotal(0); i++) {
    string objName = ObjectName(0, i);
    if(ObjectGetInteger(0, objName, OBJPROP_TYPE) == OBJ_EVENT) {
      Print("OBJ_EVENT: ", objName);
      Print(ObjectGetInteger(0, objName, OBJPROP_TYPE));
      ObjectDelete(0, objName);
    } else {
      Print("not OBJ_EVENT: ", objName);
      Print(ObjectGetInteger(0, objName, OBJPROP_TYPE));
    }
  }
  ChartRedraw();  
}
Files:
Capture.PNG  15 kb