Skip to content

Symbols

Summary

Represents the list of all the symbols with the symbol names as string values.

Signature

1
public abstract interface Symbols

Namespace

cAlgo.API

Methods

Name Description
GetSymbolInfo Gets the symbol info with no realtime changes.
GetSymbolInfos Gets the required symbol info like symbol IDs, Symbol Names, etc.
GetSymbol Gets the symbol info with no realtime changes.
GetSymbols Get multiple symbols at once.
Exists Defines if the specific symbol name exists in the list.

Properties

Name Description
Item { get; }
Count { get; } Gets the total number of the symbols in the list.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to use Symbols collection to get symbols data
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class SymbolsSample : Indicator
     {
         protected override void Initialize()
         {
             var scrollViewer = new ScrollViewer
             {
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 BackgroundColor = Color.Gold,
                 Opacity = 0.7,
                 HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                 VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
                 Height = 300
             };
             var grid = new Grid(Symbols.Count + 1, 2)
             {
                 BackgroundColor = Color.Gold,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
             };
             scrollViewer.Content = grid;
             grid.AddChild(new TextBlock
             {
                 Text = "Name",
                 Margin = 5,
                 ForegroundColor = Color.Black,
                 FontWeight = FontWeight.ExtraBold
             }, 0, 0);
             grid.AddChild(new TextBlock
             {
                 Text = "Description",
                 Margin = 5,
                 ForegroundColor = Color.Black,
                 FontWeight = FontWeight.ExtraBold
             }, 0, 1);
             for (int iSymbol = 1; iSymbol < Symbols.Count + 1; iSymbol++)
             {
                 var symbolName = Symbols[iSymbol];
                 var symbol = Symbols.GetSymbol(symbolName);
                 if (!symbol.MarketHours.IsOpened()) continue;
                 grid.AddChild(new TextBlock
                 {
                     Text = symbolName,
                     Margin = 5,
                     ForegroundColor = Color.Black,
                     FontWeight = FontWeight.ExtraBold
                 }, iSymbol, 0);
                 grid.AddChild(new Button
                 {
                     Text = symbol.Description,
                     Margin = 5,
                     ForegroundColor = Color.Black,
                     FontWeight = FontWeight.ExtraBold
                 }, iSymbol, 1);
             }
             Chart.AddControl(scrollViewer);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

Last update: March 23, 2023