usingcAlgo.API;namespacecAlgo{// This sample indicator shows how to set stack and wrap panels orientation[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]publicclassOrientationSample:Indicator{[Parameter("Orientation", DefaultValue = Orientation.Vertical)]publicOrientationOrientation{get;set;}protectedoverridevoidInitialize(){varstackPanel=newStackPanel{Orientation=Orientation,HorizontalAlignment=HorizontalAlignment.Center,VerticalAlignment=VerticalAlignment.Center,BackgroundColor=Color.Gold,Opacity=0.7,};stackPanel.AddChild(newTextBlock{Text="First TextBlock",FontWeight=FontWeight.ExtraBold,Margin=5,ForegroundColor=Color.Black});stackPanel.AddChild(newTextBlock{Text="Second TextBlock",FontWeight=FontWeight.ExtraBold,Margin=5,ForegroundColor=Color.Black});stackPanel.AddChild(newTextBlock{Text="Third TextBlock",FontWeight=FontWeight.ExtraBold,Margin=5,ForegroundColor=Color.Black});stackPanel.AddChild(newTextBlock{Text="Fourth TextBlock",FontWeight=FontWeight.ExtraBold,Margin=5,ForegroundColor=Color.Black});Chart.AddControl(stackPanel);}publicoverridevoidCalculate(intindex){}}}
1 2 3 4 5 6 7 8 910111213141516171819202122232425
importclrclr.AddReference("cAlgo.API")fromcAlgo.APIimport*classTest():defget_text_block(self,text):textBlock=TextBlock()textBlock.Text=texttextBlock.FontWeight=FontWeight.ExtraBoldtextBlock.ForegroundColor=Color.BlacktextBlock.Margin=Thickness(5)returntextBlockdefinitialize(self):stackPanel=StackPanel()# Orientation is parameter of type Orientation defined in# indicator C# filestackPanel.Orientation=api.OrientationstackPanel.HorizontalAlignment=HorizontalAlignment.CenterstackPanel.VerticalAlignment=VerticalAlignment.CenterstackPanel.BackgroundColor=Color.GoldstackPanel.Opacity=0.7stackPanel.AddChild(self.get_text_block("First TextBlock"))stackPanel.AddChild(self.get_text_block("Second TextBlock"))stackPanel.AddChild(self.get_text_block("Third TextBlock"))stackPanel.AddChild(self.get_text_block("Fourth TextBlock"))api.Chart.AddControl(stackPanel)
Fields
Horizontal
Summary
Elements in the panel layout should be horizontally oriented.
Signature
1
Orientation.Horizontal;
Return Value
Orientation
Vertical
Summary
Elements in the panel layout should be vertically oriented.