Balsam.Examples 1.0.3

dotnet add package Balsam.Examples --version 1.0.3
                    
NuGet\Install-Package Balsam.Examples -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Balsam.Examples" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Balsam.Examples" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Balsam.Examples" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Balsam.Examples --version 1.0.3
                    
#r "nuget: Balsam.Examples, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Balsam.Examples@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Balsam.Examples&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Balsam.Examples&version=1.0.3
                    
Install as a Cake Tool

alternate text is missing from this package README image Balsam Examples

This repository contains source code for example strategies that can be run by the Balsam Backtester by referencing the NuGet package Balsam.Examples.

The following sample strategies demonstrate a few core principles:

  • In OnStrategyStart(), indicators are calculated and assigned to built-in TimeSeries column variables Col1, Col2, etc. Think of these like a spreadsheet column. This is also where charting can be configured by calls to Plot.
  • Trading logic is implemented in OnBarClose(). The backtester will step through each bar of the data being tested, automatically synchronizing dates across all series. A call to Col1.Last from within OnBarClose() returns the value of the current date being tested, not the last date in the series. Orders submitted from OnBarClose are valid for execution on the next bar.

These strategies are primarily expository, do not represent a complete investment strategy, and should not be relied upon for investment decisions. Do your own research and due diligence or consult an investment professional.

Strategies

Channel Breakout

ChannelBreakout is a classic Donchian style breakout model that places an entry stop above new highs and trails an exit stop below lows (for longs; shorts are the opposite). It only trades in the direction of a longer-term moving average.

CPI Release

CPIRelease is an example of an event study. Instead of coding buy and sell rules, we are simply interested in quantifying the market's subsequent reaction to a particular setup, in this case when the 10 Year Treasury Note closes near the lows of its 10 day range on the same day CPI was released.

Keltner Band Breakout

KeltnerBandBreakout is an intermediate trend-following model that uses ATR bands to quantify extreme momentum. It exits on a cross through the middle band or a fixed horizon.

Max Positions Money Manager

MaxPositionsMoneyManager shows how to implement a custom money manager. MoneyManagers are responsible for taking trades generated by a Strategy, sizing the positions and creating a backtest report. In this example, we implement a simple fixed fractional position sizing algorithm using Average True Range as our risk measure subject to an optional maximum open position constraint.

RSI2

Rsi2 is a Larry Connors style shorter-term counter-trend trading model. This implemention can enter on the close of the signal bar or on a limit below the market depending on the EntryCoefficient parameter. It also demonstrates how to implement stops and targets.

Triple MA

TripleMA is simple intermediate-term trend following model using three separate moving averages trading crossovers in the direction of the long-term trend.

Usage

The example below shows how to load data, create a new ChannelBreakout strategy and run a portfolio simulation across all the data using the MaxPositionsMoneyManager. See the Balsam.Demo project on GitHub for more in-depth code examples and sample historical futures data.

using Balsam.Examples;
using Balsam.DataServers;
var server = new AsciiBarServer(@"C:\Data");
var data = server.LoadAll();
var strat = new ChannelBreakout();
strat.MoneyManager = new MaxPositionsMoneyManager { MaxPositions = 10};
strat.RunSimulation(data);

About

The Balsam.Backtester is a suite of tools designed for rapid prototyping and testing of systematic trading strategies. It can run simple event studies to quantify market "edges" all the way to full blown multi-currency, multi-timeframe, multi-strategy portfolio simulations. Check out the documentation here.

Balsam Research, LLC

Balsam Research is an independent consulting firm offering custom solutions for systematic investors. We have extensive experience automating investment processes and running real-time systematic investment programs including fully automated futures trading systems. Contact us to learn more.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 121 8/15/2025