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

Strategy Library API

This document details the API for building Compiled Strategies for Wealth-Lab 8. A Strategy Library is simply a collection of Wealth-Lab 8 Strategies packaged and compiled in a .NET library assembly. WL8 displays these libraries as separate nodes in the Strategies tree. If your Strategy exposes Parameters, these will be exposed as sliders in the Strategy Settings tab, just like they are for a C#-Coded or a Building Block Strategy.

Build Environment

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

Note: If you are using Visual Studio 2022, it will need to be updated to at least version 17.8.6 to use .NET8.

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 WL8 installation folder. The next time WL8 starts up, it will discover your Compiled Strategy, making it available in appropriate locations of the WL8 user interface.

Visual Studio 2022 Build Environment

Accessing the Host (WL8) Environment

The IHost interface allows your extension to access information about the user's WealthLab environment. For example, the location of the user data folder, or obtaining a list of DataSets defined by the user. At any point in your extension's code base, you can access an instance of the IHost interface using the singleton class WLHost and its Instance property. Example:

//get user data folder
string folder = WLHost.Instance.DataFolder;


Since custom Strategies are classes that descend from the UserStrategyBase class, consult the UserStrategyBase class reference for more information about coding a Strategy.

Descriptive Properties

You should override the following descriptive properties in your Strategy classes.

public virtual string StrategyName

Return a descriptive name for the Strategy. The default implementation returns the .NET class name.

public virtual string Author

Return a name that indicates how you'd like to see the Strategy attributed in WL8.

public virtual string Description

Return a short description of your Strategy.

public virtual DateTime CreationDate

Return the date that you created the Strategy.

Enabling your Strategy Library to use "Edit and Continue" feature of Visual Studio

As an alternative to having to copy the resulting assembly DLL every time it gets rebuilt you can set up your project so that...

  • the file is copied to the proper folder and
  • ability to edit your code on-the-fly when a breakpoint gets hit is enabled, freeing up from having to close WL8.

Step by step:

  1. Suppose your project is called ''Strategies''. Close solution in Visual Studio, find ''Strategies.csproj'' in the solution directory and modify the header, adding the two lines:

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>

The beginning of the file now looks like this:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
  1. Launch Visual Studio as admin: right-click on the shortcut as choose "Run as administrator".
  2. Reopen your project and go to Project > Properties. There make two changes:
  • On Build tab, set Output path to: "C:\Program Files\Quantacula, LLC\WealthLab 8"
  • On Debug tab, set Executable to: "C:\Program Files\Quantacula, LLC\WealthLab 8\WealthLab8.exe"

With regard to latest versions of VS, to be able to enter the WL executable you may have to take additional steps:

  1. Go to Project Properties > Debug > General, click on "Open Debug Launch Profile UI",
  2. Click "Create New Profile" (of type Executable),
  3. Change the Launch Profile to the new one that you've created.

Provided you tweaked the properties correctly, the Strategies.dll file will get copied (or overwritten) into the WL8 folder when you click "Start Debugging" (F5 key) and then Wealth-Lab 8 will automatically start. If a breakpoint is hit in your code you can evaluate variables and even edit your code on-the-fly to the extent allowed by VS.