usingcAlgo.API;namespacecAlgo{// This example shows how to use the IndicatorAreaRemovedEventArgs[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]publicclassIndicatorAreaRemovedEventArgsSample:Indicator{protectedoverridevoidInitialize(){ShowIndicatorAreasCount();Chart.IndicatorAreaRemoved+=Chart_IndicatorAreaRemoved;}privatevoidChart_IndicatorAreaRemoved(IndicatorAreaRemovedEventArgsobj){Print("An indicator area has been removed");ShowIndicatorAreasCount();}privatevoidShowIndicatorAreasCount(){vartext=string.Format("Indicator Areas #: {0}",Chart.IndicatorAreas.Count);Chart.DrawStaticText("text",text,VerticalAlignment.Top,HorizontalAlignment.Right,Color.Red);}publicoverridevoidCalculate(intindex){}}}
1 2 3 4 5 6 7 8 9101112
importclrclr.AddReference("cAlgo.API")fromcAlgo.APIimport*classTest():definitialize(self):self.show_indicator_areas_count()api.Chart.IndicatorAreaRemoved+=self.on_chart_indicator_area_removeddefon_chart_indicator_area_removed(self,args):print("A new indicator area has been removed")self.show_indicator_areas_count()defshow_indicator_areas_count(self):api.Chart.DrawStaticText("text",f"Indicator Areas #: {api.Chart.IndicatorAreas.Count}",VerticalAlignment.Top,HorizontalAlignment.Right,Color.Red)