Skip to content

Symbols

interface cAlgo.API

DesktopCLICloud

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

Definition

public interface Symbols

Namespace: cAlgo.API · Group: Symbols

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use Symbols collection to get symbols data
    public partial class Test : 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 - 1];
                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)
        {
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        scrollViewer = ScrollViewer()
        scrollViewer.HorizontalAlignment = HorizontalAlignment.Center
        scrollViewer.VerticalAlignment = VerticalAlignment.Center
        scrollViewer.BackgroundColor = Color.Gold
        scrollViewer.Opacity = 0.7
        scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto
        scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible
        scrollViewer.Height = 300

        grid = Grid(api.Symbols.Count, 2)
        grid.BackgroundColor = Color.Gold
        grid.HorizontalAlignment = HorizontalAlignment.Center
        grid.VerticalAlignment = VerticalAlignment.Center

        scrollViewer.Content = grid

        for iSymbol in range(api.Symbols.Count):
            symbolName = api.Symbols[iSymbol]
            symbol = api.Symbols.GetSymbol(symbolName)

            if symbol.MarketHours.IsOpened() == False:
                continue

            symbolNameTextBlock = TextBlock()
            symbolNameTextBlock.Text = symbolName
            symbolNameTextBlock.Margin = Thickness(5)
            symbolNameTextBlock.ForegroundColor = Color.Black
            symbolNameTextBlock.FontWeight = FontWeight.ExtraBold

            grid.AddChild(symbolNameTextBlock, iSymbol, 0)

            symbolDescriptionTextBlock = TextBlock()
            symbolDescriptionTextBlock.Text = symbol.Description
            symbolDescriptionTextBlock.Margin = Thickness(5)
            symbolDescriptionTextBlock.ForegroundColor = Color.Black
            symbolDescriptionTextBlock.FontWeight = FontWeight.ExtraBold

            grid.AddChild(symbolDescriptionTextBlock, iSymbol, 1)

        api.Chart.AddControl(scrollViewer)
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}

Methods

Name Description
ExistsDesktopCLICloudbool Defines if the specific symbol name exists in the list.
GetSymbolDesktopCLICloudSymbol Gets the specific symbol.
GetSymbolsDesktopCLICloudSymbol[] Get multiple symbols at once.

Properties

Name Description
ArchivedDesktopCLICloudIReadOnlySet<string> Gets the set of only archived symbol names.
CountDesktopCLICloudint Gets the total number of the symbols in the list.
CustomDesktopCLICloudIReadOnlySet<string> Gets the set of only custom symbol names.
EnabledDesktopCLICloudIReadOnlySet<string> Gets the set of only enabled symbol names.
ItemDesktopCLICloudstring Gets the desired symbol.

Events

Name Description
AddedDesktopCLICloudAction<SymbolAddedEventArgs> Occurs when a symbol is added.
RemovedDesktopCLICloudAction<SymbolRemovedEventArgs> Occurs when a symbol is removed.
UpdatedDesktopCLICloudAction<SymbolUpdatedEventArgs> Occurs when a symbol is updated.
Deprecated members (2)
  • SymbolInfo GetSymbolInfo(string symbolName) — Use 'GetSymbol' instead
  • SymbolInfo[] GetSymbolInfos(string[] symbolNames) — Use 'GetSymbols' instead