Clone our Wealth-Lab 8 Extension Demo project on GitHub to get a head start in developing your own Extensions!

Strategy Library API

A Strategy Library Extension is a compiled .NET assembly containing one or more WealthLab 9 Strategies. WealthLab displays each Strategy Library as a separate node in the Strategies tree. Each Strategy in the assembly is represented by a class derived from UserStrategyBase. If a compiled Strategy exposes Parameters, WealthLab displays them in the Strategy Settings tab just as it does for C# Coded and Building Block Strategies.

Build Environment

You can create a Compiled Strategy in a .NET development tool such as Visual Studio 2026. Create a class library project that targets .NET10, then reference the WealthLab.Core library DLL that you'll find in the WL9 installation folder.

Your Compiled Strategy will be a class in this library that descends from UserStrategyBase, which is defined in the WealthLab.Core library, in the WealthLab.Backtest namespace. After you implement and build your library, simply copy the resulting assembly DLL into the WL9 installation folder. The next time WL9 starts up, it will discover your Compiled Strategy, making it available in appropriate locations of the WL9 user interface.

Visual Studio 2026 Build Environment

Accessing the Host (WL9) Environment

The IHost interface provides access to the current WealthLab environment. Extensions can use it to retrieve application-level information and services, such as the location of the user's WealthLab data folder or the DataSets defined by the user.

You can access the current IHost instance from anywhere in your extension through the WLHost singleton and its Instance property. For example, the following code retrieves the path to the user's WealthLab data folder:

string folder = WLHost.Instance.DataFolder;

Use WLHost.Instance whenever your extension needs access to functionality exposed by the IHost interface.

UserStrategyBase

Compiled Strategies derive from:

UserStrategyBase

Consult the UserStrategyBase class reference for details about implementing Strategy logic, including initialization, execution, trading methods, Parameters, plotting, and other Strategy functionality. A Strategy Library can contain any number of UserStrategyBase-derived classes. For example:

using WealthLab.Backtest;
using WealthLab.Core;

namespace MyStrategies
{
    public class MyStrategy : UserStrategyBase
    {
        public override void Initialize(
            BarHistory bars)
        {
            // Strategy initialization.
        }

        public override void Execute(
            BarHistory bars,
            int idx)
        {
            // Strategy logic.
        }
    }
}

Descriptive Properties

Override the following properties to provide descriptive information about each Strategy.

StrategyName

public virtual string StrategyName

Return the descriptive name WealthLab should display for the Strategy. The default implementation returns the Strategy's .NET class name. For example:

public override string StrategyName =>
    "My Momentum Strategy";

Author

public virtual string Author

Return the name or organization that should be credited as the Strategy's author. For example:

public override string Author =>
    "My Company";

Description

public virtual string Description

Return a short description of the Strategy. For example:

public override string Description =>
    "Uses momentum and trend filters to generate entries.";

CreationDate

public virtual DateTime CreationDate

Return the date the Strategy was created. For example:

public override DateTime CreationDate =>
    new DateTime(2026, 8, 18);

Exposing Strategy Parameters

Compiled Strategies can expose configurable Parameters in the same way as C# Coded Strategies. When a Strategy defines Parameters, WealthLab displays them in the Strategy Settings tab. For example:

public MyStrategy()
{
    AddParameter(
        "Period",
        ParameterType.Int32,
        20);
}

Your Strategy can then access the configured value during execution. This allows a compiled Strategy to remain configurable and optimizable while still being distributed as part of a Strategy Library.

Debugging a Strategy Library in Visual Studio

During development, you can configure Visual Studio so that pressing F5 launches WealthLab directly with your Strategy Library available for debugging. This lets you set breakpoints in the Strategy Library and debug the compiled Strategy while it runs inside WealthLab. A convenient setup is to configure the project to build its DLL directly into the WealthLab installation folder and launch the WealthLab executable as the debug target.

Disable Framework-Specific Output Subfolders

By default, .NET projects may append the target framework and runtime identifier to the output path. You can disable this behavior in the project file:

<PropertyGroup>
    <AppendTargetFrameworkToOutputPath>
        false
    </AppendTargetFrameworkToOutputPath>

    <AppendRuntimeIdentifierToOutputPath>
        false
    </AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>

This allows the compiled DLL to be written directly to the configured output directory instead of a framework-specific subfolder.

Configure the Build Output

In Visual Studio, open the project properties and configure the output path so the Strategy Library DLL is built directly into the WealthLab 9 installation folder. For example:

C:\Program Files\Quantacula, LLC\WealthLab 9\

Because this location is under Program Files, Visual Studio may need to run with Administrator privileges to write the compiled DLL there.

Configure WealthLab as the Debug Executable

Configure the project's Debug launch profile to start the WealthLab 9 executable. For example:

C:\Program Files\Quantacula, LLC\WealthLab 9\WealthLab9.exe

In current versions of Visual Studio, you can configure this from:

Project Properties
    Debug
        General
            Open Debug Launch Profiles UI

Create an Executable launch profile and select the WealthLab executable. A launch profile will generally resemble:

{
  "profiles": {
    "WealthLab": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files\\Quantacula, LLC\\WealthLab 9\\WealthLab9.exe"
    }
  }
}

Debugging Workflow

With the project configured this way:

  1. Build or press F5 in Visual Studio.
  2. Visual Studio builds the Strategy Library into the WealthLab installation folder.
  3. WealthLab 9 launches automatically.
  4. Open and run the compiled Strategy.
  5. Visual Studio stops at any breakpoints reached in your Strategy code.

You can then inspect variables, step through code, and use Visual Studio's supported debugging and Edit and Continue capabilities without manually copying the Strategy Library after each build. This setup can significantly streamline development of compiled Strategy Libraries.