usingcAlgo.API;namespacecAlgo{// This sample shows how to work with data series[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]publicclassDataSeriesSample:Indicator{privateTextBlock_lastValueTextBlock;privateTextBlock_lastClosedValueTextBlock;privateTextBlock_countTextBlock;[Parameter()]publicDataSeriesSource{get;set;}protectedoverridevoidInitialize(){vargrid=newGrid(3,2){BackgroundColor=Color.DarkGoldenrod,HorizontalAlignment=HorizontalAlignment.Left,VerticalAlignment=VerticalAlignment.Bottom,Opacity=0.5};grid.AddChild(newTextBlock{Text="Last Value",Margin=5},0,0);_lastValueTextBlock=newTextBlock{Text=Source.LastValue.ToString(),Margin=5};grid.AddChild(_lastValueTextBlock,0,1);grid.AddChild(newTextBlock{Text="Last Closed Value",Margin=5},1,0);_lastClosedValueTextBlock=newTextBlock{Text=Source.Last(1).ToString(),Margin=5};grid.AddChild(_lastClosedValueTextBlock,1,1);grid.AddChild(newTextBlock{Text="Values Count",Margin=5},2,0);_countTextBlock=newTextBlock{Text=Source.Count.ToString(),Margin=5};grid.AddChild(_countTextBlock,2,1);Chart.AddControl(grid);}publicoverridevoidCalculate(intindex){// You can also use "LastValue" property if you don't have index_lastValueTextBlock.Text=Source[index].ToString();// You can also use "Last(1)" property if you don't have index_lastClosedValueTextBlock.Text=Source[index-1].ToString();_countTextBlock.Text=Source.Count.ToString();}}}