Skender.Stock.Indicators is a multi-targeting .NET framework library that produces stock indicators. Send in historical stock price quotes and get back desired technical indicators (such as moving average, relative strength, parabolic SAR, etc). Nothing more.
It can be used in any kind of stock analysis software. We had private trading algorithms and charts in mind when originally creating this open library.
Find and install the Skender.Stock.Indicators NuGet package into your Project. See more help for installing packages.
# dotnet CLI example
dotnet add package Skender.Stock.Indicators
# PowerShell example
Install-Package Skender.Stock.Indicators
using Skender.Stock.Indicators;
[..]
// example: get 20-period simple moving average
IEnumerable<SmaResult> results = Indicator.GetSma(history,20);
- Acumulation Distribution Line (ADL)
- Aroon Oscillator
- Average Directional Index (ADX)
- Average True Range (ATR)
- Beta Coefficient
- Bollinger Bands
- Chaikin Money Flow (CMF)
- Chaikin Oscillator
- Chandelier Exit
- Commodity Channel Index (CCI)
- ConnorsRSI
- Correlation Coefficient
- Donchian Channel
- Double Exponential Moving Average (DEMA)
- Exponential Moving Average (EMA)
- Heikin-Ashi
- Keltner Channel
- Moving Average Convergence/Divergence (MACD)
- On-balance Volume (OBV)
- Parabolic SAR
- Rate of Change (ROC)
- Relative Strength Index (RSI)
- R-Squared (Coefficient of Determination)
- Simple Moving Average (SMA)
- Standard Deviation
- Stochastic Oscillator
- Stochastic RSI
- Ulcer Index
- William %R
- Documentation
- Demo site (a stock chart that uses this library)
- Contributing guidelines
- Guide and Pro Tips
Most indicators require that you provide historical quote data and additional configuration parameters.
You can get historical quotes from your favorite stock data provider.
Historical data is an IEnumerable
of the Quote
class. More info...
For additional configuration parameters, default values are provided when there is an industry standard. You can, of course, override these and provide your own values.
- .NET Core 3.1
- .NET Standard 2.0, 2.1
- .NET Framework 4.6.1
Where can I get historical data?
There are many places to get stock market data. Check with your brokerage or other commercial sites. If you're looking for a free developer API, try Alpha Vantage.
How much historical data do I need?
Each indicator will need different amounts to calculate. You can find guidance on the individual indicator documentation pages. As a general rule of thumb, you will be safe if you provide 750 points of historical quote data (e.g. 3 years of daily data). A BadHistoryException
will be thrown if you do not provide enough history.
Note that some indicators, especially those that are derived from Exponential Moving Average, use a smoothing technique where there is convergence over time. While you can calculate these with the minimum amount of data, the precision to two decimal points often requires 250 or more preceding historical records. For example, if you are using daily data and want one year of precise EMA(250) data, you need to provide 3 years of total historical quotes (1 extra year for the lookback period and 1 extra year for convergence); thereafter, you would discard or not use the first two years of results.
Do you have any documentation?
Yes. The documentation site is a GitHub Pages site here: https://daveskender.github.io/Stock.Indicators. It is automatically generated from the README.md files in this repository, so you can navigate from the above Indicators links too.
More questions? Contact us through the NuGet Contact Owners method or submit an Issue with your question if it is publicly relevant.
This NuGet package is an open-source project. If you want to report or contribute bug fixes, new indicators, or feature requests, please review our contributing guidelines.