SquidEyes.TechAnalysis 1.1.2

dotnet add package SquidEyes.TechAnalysis --version 1.1.2                
NuGet\Install-Package SquidEyes.TechAnalysis -Version 1.1.2                
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="SquidEyes.TechAnalysis" Version="1.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SquidEyes.TechAnalysis --version 1.1.2                
#r "nuget: SquidEyes.TechAnalysis, 1.1.2"                
#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.
// Install SquidEyes.TechAnalysis as a Cake Addin
#addin nuget:?package=SquidEyes.TechAnalysis&version=1.1.2

// Install SquidEyes.TechAnalysis as a Cake Tool
#tool nuget:?package=SquidEyes.TechAnalysis&version=1.1.2                

NuGet Version Downloads License

SquidEyes.TechAnalysis is a collection of high-performance C#/.NET 7.0 technical indicators with a hand-curated set of matching unit-tests.

Code Name Indicator Kind
ATR Average True Range AtrIndicator Statistics
BBAND Bollinger Bands BollingerBandsIndicator Channels
CCI Commodity Channel Index CciIndicator Oscillator
DEMA Double Exponential Moving Average DemaIndicator Moving Average
EMA Exponential Moving Average EmaIndicator Moving Average
KAMA Kaufman's Adaptive Moving Average KamaIndicator Moving Average
KLTNR Keltner Channel KelnerChannelIndicator Channels
LINREG Linear Regression LinRegIndicator Regression
MACD Moving Average Convergence Divergence MacdIndicator Statistics
SMA Simple Moving Average SmaIndicator Moving Average
SMMA Smoothed Moving Average SmmaIndicator Moving Average
STDDEV Standard Deviation StdDevIndicator Statistics
STOCH Stochastics Oscillator StochasticsIndicator Oscillator
TEMA Triple Exponential Moving Average TemaIndicator Moving Average
WMA Weighted Moving Average WmaIndicator Moving Average

To be clear, there are a good number of C#-based technical indicator libraries (i.e. Trady, Stock Indicators, TA-Lib.NETCore, and NetTrader, just to name a few), but the author found each of these to be objectionable for one or more reasons:

  • Poor performance (whether from use of decimals or otherwise)
  • Poor standardization
  • No provision for float-based candles
  • Reliance upon inflexible and inbuilt result-persistence layers

To take a rather simple example, an EmaIndicator might be used as follows:

// Add the result to a chart, perform a calculation, etc.
static void PrintResult(BasicResult result) =>
    Debug.WriteLine($"{result.CloseOn} ={result.Value}");

// CloseOn,Open,High,Low,Close data in CSV multi-line format
const string CSV = """
    05/15/2023 14:36:00,12872.75,12873.75,12866,12870.75
    05/15/2023 14:37:00,12871.25,12871.5,12864.75,12869.5
    05/15/2023 14:38:00,12869.25,12871.75,12867.5,12871.25
    05/15/2023 14:39:00,12871,12873.75,12869.5,12872.75
    05/15/2023 14:40:00,12872.75,12873.75,12867.75,12870.5 
    """;

// Most of the indicators return BasicResult, but a few return
// custom results (BollingerIndicator, MacddIndicator, etc.)
var indicator = new EmaIndicator(period: 3,
    priceToUse: PriceToUse.Close, maxResults: 10000);

// Parse the data then 
foreach (var fields in new CsvEnumerator(CSV.ToStream(), 5))
{
    var candle = new TestCandle()
    {
        CloseOn = DateTime.Parse(fields[0]),
        Open = float.Parse(fields[1]),
        High = float.Parse(fields[2]),
        Low = float.Parse(fields[3]),
        Close = float.Parse(fields[4])
    };

    // Adds the current result to the indicator's results
    // collection (a reversed SlidingBuffer) then returns 
    // that result directly
    _ = indicator.AddAndCalc(candle);

    if (!indicator.IsPrimed)
        continue;

    // A result may also be obtained via a [0..maxResults - 1]
    // index on the indicator, with zero being the most recent
    PrintResult(indicator[2]);
}

Contributions are always welcome (see CONTRIBUTING.md for details)

Supper-Duper Extra-Important Caveat: THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

FINAL WARNING: The use of this code may (literally!) lead to your losing thousands of dollars or more. Caveat Emptor!!

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

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.1.2 175 6/3/2023
1.1.1 136 6/2/2023
1.1.0 138 6/2/2023
1.0.5 410 10/1/2021
1.0.4 324 10/1/2021
1.0.0 331 10/1/2021