Symbols
Summary
Represents the list of all the symbols with the symbol names as string values.
Signature
| public abstract interface Symbols
|
Namespace
cAlgo.API
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)
{
}
}
}
|
Methods
GetSymbol
Summary
Gets the specific symbol.
Signature
| public abstract Symbol GetSymbol(string symbolName)
|
Parameters
Name | Type | Description |
symbolName | string | Name of the symbol you want to get |
Return Value
Symbol
GetSymbols
Summary
Get multiple symbols at once.
Signature
| public abstract Symbol[] GetSymbols(string[] symbolNames)
|
Parameters
Name | Type | Description |
symbolNames | string[] | Names of the symbols you want to get |
Return Value
Symbol[]
Exists
Summary
Defines if the specific symbol name exists in the list.
Signature
| public abstract bool Exists(string symbolName)
|
Parameters
Name | Type | Description |
symbolName | string | Name of the symbol you want to check |
Return Value
bool
Properties
Item
Signature
| public abstract string Item {get;}
|
Return Value
string
Count
Summary
Gets the total number of the symbols in the list.
Signature
| public abstract int Count {get;}
|
Return Value
int