In my indicator, I often have to remove labels, due to a setup being no longer valid.. I do this by having an object populate a list of tags for each setup. Then when that setup is no longer valid, I set a flag in the object so that the indicator can do a search for all setup objects with a flag that indicates for all the label tags to be deleted. In the following code example, I store the labellist and the flag in a struct.
Below is the code.
The reason I know its not stable is because if i click on Reload ninjascript, some of the labels for certain setups are removed and some are not. I hit the reload again, and a different set of setups have removed labels, so its rather random..
Anyway , here is code:
List<SBRSetup> Disqualified_Setup_Longs = SBrSetupCollectionLongs.SSetups.FindAll(x => x.LabelList.FlaggedtoDeleteTradeLabels_Targets == true ); foreach (SBRSetup SS_L in Disqualified_Setup_Longs) { SS_L.LabelList.FlaggedtoDeleteTradeLabels_Targets = false; foreach (string DrawObject_Tag in SS_L.LabelList.SetupInfo) { RemoveDrawObject(DrawObject_Tag); } SS_L.LabelList.TradeDisqualifyInfo.Clear(); }
Comment