{ "cells": [ { "cell_type": "markdown", "metadata": { "dotnet_interactive": { "language": "csharp" }, "polyglot_notebook": { "kernelName": "csharp" } }, "source": [ "# Quick Start\n", "\n", "In order to use this .NET Interactive Notebook and play along with QuanTAlib (outside of making your own app or plugging QuanTAlib into Quantower platform), you will need:\n", "\n", "- Installed Visual Studio Code\n", "- Installed .NET 6 SDK\n", "- Installed .NET Interactive Notebooks extension\n", "\n", "**For impatient**, here is a simple example of calculating three moving averages - SMA(data), EMA(SMA(data)) and WMA(EMA(SMA(data))) from 10 days of AAPL stock data using QuanTAlib:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "dotnet_interactive": { "language": "csharp" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "#r \"nuget:QuanTAlib;\"\n", "using QuanTAlib;\n", "\n", "Yahoo_Feed aapl = new(\"AAPL\", 10);\n", "TSeries data = aapl.Close;\n", "SMA_Series sma = new(source: data, period: 5, useNaN: false);\n", "EMA_Series ema = new(sma, period: 5); // by default, indicators expose all data, no NaN values\n", "WMA_Series wma = new(ema, 5, useNaN: true); // for the final calculation we can hide early data with NaNs\n", "\n", "Console.Write($\"index\\t data\\t\\t sma(data)\\t ema(sma(data))\\t wma(ema(sma(data)))\\n\");\n", "for (int i=0; i