Skip to content

Referencing .NET Libraries/Packages

.NET Libraries

cTrader allows for referencing .NET libraries inside the code of 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();
}

Nuget Packages

You can also reference custom Nuget packages in your cTrader algos. For a detailed example of how to use and install Nuget packages, check out o**ur article on working with external 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.
  • The .NET CLI.