Referencing .NET Libraries/Packages
Referencing Local .NET Libraries (DLL Files)¶
cTrader Automate API allows users to reference .NET libraries from cBots and Custom Indicators.
In order to add a reference to .NET library you need to open Reference Manager window.
You can open Reference Manager window by clicking “Manage References” button in the top of cAlgo editor or by executing “Manage References” command from context menu of your cBot or Custom Indicator.
In Reference Manager open Libraries page and click on the Browse button:
In open file dialog you need to select a .NET dll and click on the Open button.
Click on the Apply button in Reference Manager to apply the changes.
Then you need to import namespaces from the Library. Example:
Finally, you can use classes from the Library in your code:
Referencing Other Custom Indicators¶
You can reference and use other cTrader custom indicators on your cBots/Indicators.
For referencing a custom indicator you can use the cTrader Automate Reference manager window or reference the indicator project file from your cTrader indicator/cBot project file:
1 2 3 4 5 6 7 8 9 10 11 12
The recommend approach is to use the cTrader Automate reference manager window as it shows all custom installed indicators on a separate tab:
Once you referenced an indicator you can use it by using
1 2 3 4 5 6 7 8
Using Nuget packages¶
You can use the rich library of .NET Nuget packages on your indicators/cBots, you can install a Nuget package on your cTrader indicators/cBots like any other .NET project.
You can use Nuget package manger install command, Visual Studio Nuget manager GUI, or .NET CLI.
Referencing with Visual Studio¶
You can also use Visual Studio for referencing other .NET libraries or Nuget packages.