OoplesFinance.StockIndicators 1.0.50

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
.NET 5.0 .NET Core 3.1 .NET Standard 2.0 .NET Framework 4.6.1
dotnet add package OoplesFinance.StockIndicators --version 1.0.50
NuGet\Install-Package OoplesFinance.StockIndicators -Version 1.0.50
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="OoplesFinance.StockIndicators" Version="1.0.50" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OoplesFinance.StockIndicators --version 1.0.50
#r "nuget: OoplesFinance.StockIndicators, 1.0.50"
#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 OoplesFinance.StockIndicators as a Cake Addin
#addin nuget:?package=OoplesFinance.StockIndicators&version=1.0.50

// Install OoplesFinance.StockIndicators as a Cake Tool
#tool nuget:?package=OoplesFinance.StockIndicators&version=1.0.50

Nuget Nuget (with prereleases) GitHub

.Net Stock Indicator Library

This is a stock indicator library that is completely open source (Apache 2.0 license) and very easy to use. Current version contains 763 stock indicators and I will add more as I get requests for them!

How to use this library

Here is an example to show how easy it is to create indicators using other indicators

var stockData = new StockData(openPrices, highPrices, lowPrices, closePrices, volumes);
var results = stockData.CalculateRelativeStrengthIndex().CalculateMovingAverageConvergenceDivergence();

Here is a simple example calculating default bollinger bands to get you started using the Alpaca C# Api

using Alpaca.Markets;
using OoplesFinance.StockIndicators.Models;
using static OoplesFinance.StockIndicators.Calculations;

const string paperApiKey = "REPLACEME";
const string paperApiSecret = "REPLACEME";
const string symbol = "AAPL";
var startDate = new DateTime(2021, 01, 01);
var endDate = new DateTime(2021, 12, 31);

var client = Environments.Paper.GetAlpacaDataClient(new SecretKey(paperApiKey, paperApiSecret));
var bars = (await client.ListHistoricalBarsAsync(new HistoricalBarsRequest(symbol, startDate, endDate, BarTimeFrame.Day)).ConfigureAwait(false)).Items;
var stockData = new StockData(bars.Select(x => x.Open), bars.Select(x => x.High), bars.Select(x => x.Low), bars.Select(x => x.Close), bars.Select(x => x.Volume), bars.Select(x => x.TimeUtc));

var results = stockData.CalculateBollingerBands();
var upperBandList = results.OutputValues["UpperBand"];
var middleBandList = results.OutputValues["MiddleBand"];
var lowerBandList = results.OutputValues["LowerBand"];

Here is a more advanced example showing how to calculate bollinger bands with full customization and using a custom input of high rather than the default close

var stockData = new StockData(bars.Select(x => x.Open), bars.Select(x => x.High), bars.Select(x => x.Low), 
bars.Select(x => x.Close), bars.Select(x => x.Volume), bars.Select(x => x.TimeUtc), InputName.High);

var results = stockData.CalculateBollingerBands(MovingAvgType.EhlersMesaAdaptiveMovingAverage, 15, 2.5m);
var upperBandList = results.OutputValues["UpperBand"];
var middleBandList = results.OutputValues["MiddleBand"];
var lowerBandList = results.OutputValues["LowerBand"];

It is extremely important to remember that if you use the same data source to calculate different indicators without using the chaining method then you need to clear the data in between each call. We have a great example for this below:

var stockData = new StockData(bars.Select(x => x.Open), bars.Select(x => x.High), bars.Select(x => x.Low), 
bars.Select(x => x.Close), bars.Select(x => x.Volume), bars.Select(x => x.TimeUtc), InputName.High);

var sma = stockData.CalculateSimpleMovingAverage(14);

// if you don't perform this clear method in between then your ema result will be calculated using the sma results
stockData.Clear();

var ema = stockData.CalculateExponentialMovingAverage(14);

For more detailed Alpaca examples then check out my more advanced Alpaca example code

Support This Project

BTC: 36DRmZefJNW82q9pHY1kWYSZhLUWQkpgGq

ETH: 0x7D6e58754476189ffF736B63b6159D2647f74f34

DOGE: DF1nsK1nLASzmwHNAfNengBGS4w7bNyJ1e

SHIB: 0xCDe2355212764218355c9393FbE121Ae49B43382

Paypal: https://www.paypal.me/cheatcountry

Patreon: https://patreon.com/cheatcountry

Support or Contact

Email me at cheatcountry@gmail.com for any help or support or to let me know of ways to further improve this library.

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on OoplesFinance.StockIndicators:

Repository Stars
alpacahq/alpaca-trade-api-csharp
C# SDK for Alpaca Trade API https://docs.alpaca.markets/
ooples/OoplesFinance.StockIndicators
Largest C# stock indicator library with over 750 to choose from and easiest to use with abilities such as making an indicator out of any other indicator or using any moving average with any indicator.
Version Downloads Last updated
1.0.50 386 1/2/2023
1.0.49 194 12/19/2022
1.0.48 209 12/7/2022
1.0.47 386 10/10/2022
1.0.46 497 7/26/2022
1.0.45 340 7/19/2022
1.0.44 795 4/21/2022
1.0.43 399 4/3/2022
1.0.42 376 3/17/2022
1.0.41 292 3/17/2022
1.0.40 391 3/3/2022
1.0.39 296 2/26/2022
1.0.38 307 2/23/2022
1.0.37 296 2/23/2022
1.0.36 340 2/19/2022
1.0.35 283 2/19/2022
1.0.34 291 2/12/2022
1.0.33 291 2/11/2022
1.0.32 281 2/10/2022
1.0.31 285 2/10/2022
1.0.30 278 2/10/2022
1.0.29 289 2/8/2022
1.0.28 295 2/7/2022
1.0.27 304 2/5/2022
1.0.26 304 2/4/2022
1.0.25 295 2/2/2022
1.0.24 312 1/31/2022
1.0.23 318 1/29/2022
1.0.22 312 1/27/2022
1.0.21 302 1/26/2022
1.0.20 308 1/25/2022
1.0.19 302 1/21/2022
1.0.18 296 1/20/2022
0.0.17 303 1/18/2022
0.0.16 308 1/17/2022
0.0.15 179 1/16/2022
0.0.14 161 1/15/2022
0.0.13 310 1/14/2022
0.0.12 309 1/13/2022
0.0.11 307 1/12/2022
0.0.10 305 1/11/2022
0.0.9 169 1/10/2022
0.0.8 177 1/9/2022
0.0.7 184 1/9/2022
0.0.6 163 1/8/2022
0.0.5 173 1/7/2022
0.0.4 172 1/6/2022
0.0.3 175 1/6/2022
0.0.2 182 1/5/2022
0.0.1 171 1/3/2022
0.0.1-alpha3 101 12/28/2021
0.0.1-alpha2 95 12/28/2021
0.0.1-alpha1 108 12/21/2021