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

Strategy Library API

Updated for WL8 This document details the API for building Strategy Library extensions 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.

You can create a Strategy Library in a .NET development tool such as Visual Studio, or Visual Studio Code. Create a class library project that targets .NET Core 6, then add the following references to your project:

  • WealthLab.Core
  • WealthLab.Backtest

Add one or more classes to the project that descend from WealthLab.Backtest's UserStrategyBase. You can even copy the code out of the C# Editor from a WL8 Strategy window. After you implement and build your library, simply copy the resulting assembly DLL into the WL8 program folder. The next time WL8 starts up, it should find your Strategy Library, and add a node for it in the Strategies tree.

Create Class Library in Visual Studio

Accessing the WL8 Host Environment

Use the WLHost.Instance property to access various aspects of the WL8 environment from within Strategy code. See the API reference for the IHost interface for details.


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.