Skip to content

Referencing .NET Libraries/Packages

How Do I Reference Local .NET Libraries (DLL Files)?

cTrader Automate API allows for referencing .NET libraries from cBots and custom indicators. To do so, open the 'Reference Manager' window by clicking on the 'Manage References' button at the top of the code editor.

Image title

In the newly opened window, select the 'Browse' tab.

Image title

Click on 'Browse', select a locally stored .dll file and press 'Open'. Afterward, click on 'Apply' to save your changes.

To use your newly imported library, reference the related namespace in your code.

1
2
3
using System;
using cAlgo.API;
using CustomLibrary.CustomNamespace;

This will enable you to use classes from your library directly in your code.

1
2
3
4
5
protected override void OnStart()
{
  var instance = new ClassFromCustomLibrary();
  instance.CustomMethod();
}

Can I Use Nuget Packages?

In brief, yes, you can. For a detailed example of how to use and install Nuget packages, please, check out our article on working with IDEs.

Remember that to install Nuget packages you can use the following tools.

  • The Install-Package command available in the Nuget package manager console.
  • The Visual Studio Nuget package manager GUI.
  • .NET CLI.

Last update: September 29, 2023