Skip to content

Algo

class cAlgo.API.Internals

DesktopCLICloud

The container class for the main cAlgo.API Interfaces.

Definition

public class Algo

Namespace: cAlgo.API.Internals · Group: General

Examples

public partial class AlgoSample : Robot
{
    protected override void OnStart()
    {
        Print("Symbol: {0}, TimeFrame: {1}, Server time: {2}", SymbolName, TimeFrame, Server.Time);
        Print("Open positions: {0}, Pending orders: {1}", Positions.Count, PendingOrders.Count);
    }
}
class AlgoSample():
    def on_start(self):
        api.Print(f"Symbol: {api.SymbolName}, TimeFrame: {api.TimeFrame}, Server time: {api.Server.Time}")
        api.Print(f"Open positions: {api.Positions.Count}, Pending orders: {api.PendingOrders.Count}")
{
  "AccessRights": "None"
}

Methods

Name Description
BeginInvokeOnMainThreadDesktopCLICloudvoid Invokes asynchronously the specified code on the main cBot or Indicator thread.
CreateDataSeriesDesktopCLICloudIndicatorDataSeries Initialization of an IndicatorDataSeries.
OnExceptionDesktopCLICloudvoid Called on each unhandled exception.
OnTimerDesktopCLICloudvoid Called when the timer interval has elapsed.
Print 3 overloadsDesktopCLICloudvoid Prints text representation of the specified object to the log.
RefreshDataDesktopCLICloudvoid Updates Bars, Positions, PendingOrders, History, etc. And sends postponed events after Thread sleep call. If you put the main thread on sleep by calling Thread sleep method then you have to call RefreshData after Thread wakes up to send the postponed events while thread was sleeping.
Sleep 3 overloadsDesktopCLICloudvoid Suspends the algorithm until the specified timespan elapses.

Properties

Name Description
AlgoRegistryDesktopCLICloudAlgoRegistry Provides access to installed Algorithms.
ApplicationDesktopCLICloudApplication Represents the application.
AskDesktopCLIClouddouble Gets the symbol ask price.
AssetConverterDesktopCLICloudIAssetConverter Converts an asset to another asset.
AssetsDesktopCLICloudAssets Returns list of all available assets.
BarsDesktopCLICloudBars The collection of Bar objects.
BidDesktopCLIClouddouble Gets the symbol bid price.
ChartDesktopCLICloudChart Represents the chart where cBot or Indicator is launched.
ChartIndicatorsDesktopCLICloudChartIndicators Gets the ChartIndicators of an algorithm.
ChartRobotsDesktopCLICloudChartRobots Gets the ChartRobots of an algorithm.
ChartTemplatesDesktopCLICloudChartTemplates Provides access to Chart Templates.
ClipboardDesktopCLICloudClipboard Provides access to system Clipboard.
CompilerDesktopCLICloudCompiler Provides access to algo compiler.
HistoricalOrdersDesktopCLICloudHistoricalOrders Provides access to historical orders.
HistoryDesktopCLICloudHistory Represents the collection of all historical trades of the account.
HttpDesktopCLICloudHttp Send HTTP requests.
IndicatorsDesktopCLICloudIIndicatorsAccessor Access to the built-in Indicators.
InstanceIdDesktopCLICloudstring Returns unique ID of current running instance.
InstanceTitleDesktopCLICloudstring Gets or sets instance title.
IsBacktestingDesktopCLICloudbool True if a cBot is in the Backtesting mode, otherwise False.
LocalStorageDesktopCLICloudLocalStorage Access the local storage API.
MarketDataDesktopCLICloudMarketData Provides access to the Depth of Market Data.
MarketSessionsDesktopCLICloudMarketSession Returns current market sessions.
MessagesDesktopCLICloudMessages Access the messaging API.
NotificationsDesktopCLICloudINotifications Represents the notifications, such as sounds and email.
PendingOrdersDesktopCLICloudPendingOrders The array of all Pending Orders of the account.
PositionsDesktopCLICloudPositions The list of all open positions of the account.
PriceAlertsDesktopCLICloudPriceAlerts Provides access to Price Alerts.
RunningModeDesktopCLICloudRunningMode Defines if a cBot is running in real time, in the silent backtesting mode, in the visual backtesting mode, or in the optimization mode.
ServerDesktopCLICloudIServer Server related information.
SymbolDesktopCLICloudSymbol Represents the current symbol provides access to its properties and certain methods
SymbolNameDesktopCLICloudstring Gets or sets the symbol name.
SymbolsDesktopCLICloudSymbols Gets the symbol names.
TimeDesktopCLICloudDateTime Returns the current server time. The shortcut to the Server.Time property.
TimeFrameDesktopCLICloudTimeFrame Access to the TimeFrame values.
TimeFramesDesktopCLICloudTimeFrames Gets collection of available TimeFrames.
TimeInUtcDesktopCLICloudDateTime Returns the current server time in UTC. The shortcut to the Server.TimeInUtc property.
TimeZoneDesktopCLICloudTimeZoneInfo TimeZone of a cBot or an Indicator.
TimerDesktopCLICloudTimer Access to the Timer object.
TransactionsDesktopCLICloudTransactions Access account transactions.
WatchlistsDesktopCLICloudWatchlists Gets the watchlist.

Events

Name Description
MarketSessionsChangedDesktopCLICloudAction<MarketSessionChangedEventArgs> Occurs when market sessions change.
Deprecated members (2)
  • public ChartObjects ChartObjects {get;} — Use Chart instead.
  • public MarketSeries MarketSeries {get;} — Deprecated.