Skip to content

Access Rights

The 'AccessRights' Class Property

To protect users from malware code, we run every cBot or indicator in a sandboxed environment.

As a result, cBots and indicators must declare their required access rights via the AccessRights class property as shown below.

1
2
[Robot(AccessRights = AccessRights.None)]
public class SampleSARTrailingStop : Robot
1
2
[Indicator(AccessRights = AccessRights.FullAccess)]
public class SampleEMA :

The two possible values for the AccessRights property are as follows.

  • None. The extension only has access to the platform-provided API data. It will not be able to access anything outside the platform.
  • FullAccess. The extension has unlimited access rights. It can access the Internet, read/write files, and run other executables, etc. It can also import WinApi functions, use .NET reflection, and create windows.

API Features

There exist several API features that still allow algos to perform various actions even when AccessRights.None is declared.

In case AccessRights.FullAccess is declared, the following window will be shown when running an instance of the cBot/indicator in question.

Image title

Security Exception

If your cBot/indicator attempts to perform a restricted action, the code will throw a security exception.

For example, if a cBot with AccessRights.None tries to read from a text file (without using the file access feature), it will be stopped and the following message will appear in the log.

Crashed in OnStart with SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

The surest way to avoid this exception is to declare AccessRights.None for all your extension unless you plan on distributing them to other traders.