From 9aab62fbea019d126fd1f79469b580222fde49a5 Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Sun, 19 Mar 2023 18:33:25 -0700 Subject: [PATCH 1/3] fix on JMA --- Quantower/Indicators/AAA_chart.cs | 57 ---- Quantower/Indicators/JMA_chart.cs | 77 +++-- Quantower/Quantower.csproj | 2 +- Source/QuanTAlib.csproj | 2 +- Source/Trends/DEMA_Series.cs | 70 ++-- Source/Trends/EMA_Series.cs | 13 +- Source/Trends/JMA_Series.cs | 3 +- docs/EMA.md | 49 +-- docs/SMA.md | 2 - docs/_sidebar.md | 1 + docs/getting_started.ipynb | 544 +++++++++++++++--------------- docs/img/EMA_chart.svg | 2 +- docs/indicators.md | 2 +- 13 files changed, 391 insertions(+), 433 deletions(-) delete mode 100644 Quantower/Indicators/AAA_chart.cs diff --git a/Quantower/Indicators/AAA_chart.cs b/Quantower/Indicators/AAA_chart.cs deleted file mode 100644 index d932408f..00000000 --- a/Quantower/Indicators/AAA_chart.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using TradingPlatform.BusinessLayer; -namespace QuanTAlib; - -public class AAA_chart : Indicator { - #region Parameters - - [InputParameter("Smoothing period", 0, 1, 999, 1, 1)] - private readonly int Period = 10; - - #endregion Parameters - - private TBars bars; - private JMA_Series ind_a; - private DWMA_Series ind_b; - - public override string ShortName => $"AAA ({this.Period})"; - - public AAA_chart() : base() - { - this.SeparateWindow = false; - - this.Name = "AAA - Test indicator"; - this.Description = "Test indicator"; - - this.AddLineSeries("JMA", Color.RoyalBlue, 3, LineStyle.Solid); - this.AddLineSeries("DWMA", Color.OrangeRed, 3, LineStyle.Solid); - - this.SeparateWindow = false; - } - - protected override void OnInit() - { - this.bars = new(); - - this.ind_a = new(source: bars.Close, period: this.Period, useNaN: false); - this.ind_b = new(source: bars.OHLC4, period: this.Period, useNaN: false); - } - - protected override void OnUpdate(UpdateArgs args) - { - bool update = !(args.Reason == UpdateReason.NewBar || args.Reason == UpdateReason.HistoricalBar); - - this.bars.Add(this.Time(), - this.GetPrice(PriceType.Open), - this.GetPrice(PriceType.High), - this.GetPrice(PriceType.Low), - this.GetPrice(PriceType.Close), - this.GetPrice(PriceType.Volume), - update); - - this.SetValue(this.ind_a.v.Last(), 0); - this.SetValue(this.ind_b.v.Last(), 1); - } -} diff --git a/Quantower/Indicators/JMA_chart.cs b/Quantower/Indicators/JMA_chart.cs index cf0e3ac8..208a7696 100644 --- a/Quantower/Indicators/JMA_chart.cs +++ b/Quantower/Indicators/JMA_chart.cs @@ -1,50 +1,57 @@ +using System; +using System.Diagnostics; using System.Drawing; using System.Linq; using TradingPlatform.BusinessLayer; namespace QuanTAlib; -public class JMA_chart : Indicator -{ - #region Parameters +public class JMA_chart : Indicator { + #region Parameters - [InputParameter("Smoothing period", 0, 1, 999, 1, 1)] - private int Period = 10; + [InputParameter("Smoothing period", 0, 1, 999, 1, 1)] + private int Period = 10; - [InputParameter("Data source", 1, variants: new object[] - { "Open", 0, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5, - "OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })] - private int DataSource = 3; + [InputParameter("Data source", 1, variants: new object[] + { "Open", 0, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5, + "OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })] + private int DataSource = 3 + ; + [InputParameter("Slope calc", 2, 2, 10, 1, 1)] + private int SlopePeriod = 3; - #endregion Parameters - private TBars bars ; + #endregion Parameters - /////// - private JMA_Series indicator; - /////// + private TBars bars; - public JMA_chart() - { - this.SeparateWindow = false; - this.Name = "JMA - Jurik Moving Average"; - this.Description = "Jurik Moving Average description"; - this.AddLineSeries("JMA", Color.RoyalBlue, 3, LineStyle.Solid); - } + /////// + private JMA_Series indicator; + private LINREG_Series slope; + /////// - protected override void OnInit() - { - this.bars = new(); + public JMA_chart() { + this.SeparateWindow = false; + this.Name = "JMA - Jurik Moving Avg"; + this.Description = "Jurik Moving Average description"; + this.AddLineSeries("JMA", Color.Blue, 4, LineStyle.Solid); + } + + + protected override void OnInit() { + this.bars = new(); this.indicator = new(source: bars.Select(this.DataSource), period: this.Period, useNaN: false); - } - protected override void OnUpdate(UpdateArgs args) - { - bool update = !(args.Reason == UpdateReason.NewBar || args.Reason == UpdateReason.HistoricalBar); - this.bars.Add(this.Time(), this.GetPrice(PriceType.Open), - this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low), - this.GetPrice(PriceType.Close), - this.GetPrice(PriceType.Volume), update); + this.slope = new(source: this.indicator, period: this.SlopePeriod); + } - double result = this.indicator.v.Last(); - this.SetValue(result); - } + protected override void OnUpdate(UpdateArgs args) { + bool update = !(args.Reason == UpdateReason.NewBar || args.Reason == UpdateReason.HistoricalBar); + + this.bars.Add(this.Time(), this.GetPrice(PriceType.Open), + this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low), + this.GetPrice(PriceType.Close), this.GetPrice(PriceType.Volume), update); + double result = this.indicator[this.indicator.Count - 1].v; + + this.LinesSeries[0].SetMarker(offset: 0,color: this.slope > 0 ? Color.FromArgb(0,160,0) : Color.FromArgb(255, 0, 0)); + this.SetValue(result, lineIndex: 0); + } } diff --git a/Quantower/Quantower.csproj b/Quantower/Quantower.csproj index 39ec2b10..8bc06984 100644 --- a/Quantower/Quantower.csproj +++ b/Quantower/Quantower.csproj @@ -41,7 +41,7 @@ - C:\Quantower\TradingPlatform\v1.128.20\bin\TradingPlatform.BusinessLayer.dll + C:\Quantower\TradingPlatform\v1.129.11\bin\TradingPlatform.BusinessLayer.dll \ No newline at end of file diff --git a/Source/QuanTAlib.csproj b/Source/QuanTAlib.csproj index 4c154ae8..0958204d 100644 --- a/Source/QuanTAlib.csproj +++ b/Source/QuanTAlib.csproj @@ -2,7 +2,7 @@ QuanTAlib - 0.1.27 + 0.1.28 Library of Technical Indicators for .NET Quantitative Technical Analysis library for real-time (streaming) data analysis git diff --git a/Source/Trends/DEMA_Series.cs b/Source/Trends/DEMA_Series.cs index 215c39a1..bc874e9e 100644 --- a/Source/Trends/DEMA_Series.cs +++ b/Source/Trends/DEMA_Series.cs @@ -19,51 +19,57 @@ Remark: public class DEMA_Series : Single_TSeries_Indicator { - private readonly System.Collections.Generic.List _buffer1 = new(); - private readonly System.Collections.Generic.List _buffer2 = new(); - private readonly double _k; + private readonly double _k; + private int _len; private readonly bool _useSMA; + private double _sum, _lastsum, _lastlastsum; private double _lastema1, _lastlastema1; - private double _lastema2, _lastlastema2; + private double _lastema2, _lastlastema2; public DEMA_Series(TSeries source, int period, bool useNaN = false, bool useSMA = true) : base(source, period, useNaN) { - _k = 2.0 / (_p + 1); + _k = 2.0 / (_p + 1); + _len = 0; _useSMA = useSMA; - _lastema1 = _lastema2 =0; + _sum = _lastema1 = _lastema2 =0; if (_data.Count > 0) { base.Add(_data); } } public override void Add((DateTime t, double v) TValue, bool update) { - if (update) - { - _lastema1 = _lastlastema1; - _lastema2 = _lastlastema2; - } + if (update) { + _lastsum = _lastlastsum; + _lastema1 = _lastlastema1; + _lastema2 = _lastlastema2; + } + else { + _lastlastsum = _lastsum; + _lastlastema1 = _lastema1; + _lastlastema2 = _lastema2; + _len++; + } - double _ema1, _ema2, _dema; - if (this.Count < _p && _useSMA) - { - Add_Replace_Trim(_buffer1, TValue.v, _p, update); - _ema1 = 0; - for (int i=0; i<_buffer1.Count; i++) { _ema1 += _buffer1[i]; } - _ema1 /= _buffer1.Count; - _ema2 = _ema1; - } - else - { - _ema1 = (TValue.v - _lastema1) * _k + _lastema1; - _ema2 = (_ema1 - _lastema2) * _k + _lastema2; - - } - _dema = 2*_ema1 - _ema2; + double _ema1, _ema2, _dema; + if (this.Count == 0) { + _ema1 = _ema2 = _sum = TValue.v; + } + else if (_len <= _period && _useSMA && _period != 0) { + _sum += TValue.v; + if (_period != 0 && _len > _period) { + _sum -= (_data[base.Count - _period - (update ? 1 : 0)].v); + } + _ema1 = _sum / Math.Min(_len, _period); + _ema2 = _ema1; + } + else { + _ema1 = (TValue.v - _lastema1) * _k + _lastema1; + _ema2 = (_ema1 - _lastema2) * _k + _lastema2; + } + _dema = 2*_ema1 - _ema2; - this._lastlastema1 = this._lastema1; - this._lastlastema2 = this._lastema2; - this._lastema1 = _ema1; - this._lastema2 = _ema2; + _lastema1 = _ema1; + _lastema2 = _ema2; - base.Add((TValue.t, _dema), update, _NaN); + base.Add((TValue.t, _dema), update, _NaN); } } \ No newline at end of file diff --git a/Source/Trends/EMA_Series.cs b/Source/Trends/EMA_Series.cs index 19130497..6a3011ab 100644 --- a/Source/Trends/EMA_Series.cs +++ b/Source/Trends/EMA_Series.cs @@ -24,22 +24,23 @@ public class EMA_Series : Single_TSeries_Indicator { private double _k; private double _lastema, _lastlastema; private double _sum, _oldsum; - private int _len, _oldlen; + private int _len; private readonly bool _useSMA; public EMA_Series(TSeries source, int period, bool useNaN = false, bool useSMA = true) : base(source, period, useNaN) { - this._k = 2.0 / (this._p + 1); + _k = 2.0 / (_p + 1); _sum = _oldsum = _lastema = _lastlastema = 0; - _len = _oldlen = 0; + _len = 0; _useSMA = useSMA; if (this._data.Count > 0) { base.Add(this._data); } } public override void Add((DateTime t, double v) TValue, bool update) { - double _ema = 0; + if (update) { _lastema = _lastlastema; _sum = _oldsum; } else { _lastlastema = _lastema; _oldsum = _sum; _len++; } + double _ema = 0; // when period = 0, create cumulative/additive series where _k is progressively larger if (_period == 0) { _k = 2.0 / (_len + 1); } @@ -48,7 +49,7 @@ public class EMA_Series : Single_TSeries_Indicator { _ema = _sum = TValue.v; } // if SMA is used for seeding, calculate SMA within period - else if (_len <= _period && _useSMA && _p != 0) { + else if (_len <= _period && _useSMA && _period != 0) { _sum += TValue.v; if (_period != 0 && _len > _period) { _sum -= (_data[base.Count - _period - (update ? 1 : 0)].v); @@ -65,6 +66,6 @@ public class EMA_Series : Single_TSeries_Indicator { } public void Reset() { _sum = _oldsum = _lastema = _lastlastema = 0; - _len = _oldlen = 0; + _len = 0; } } \ No newline at end of file diff --git a/Source/Trends/JMA_Series.cs b/Source/Trends/JMA_Series.cs index 96e5bb0e..855306b4 100644 --- a/Source/Trends/JMA_Series.cs +++ b/Source/Trends/JMA_Series.cs @@ -45,7 +45,7 @@ public class JMA_Series : Single_TSeries_Indicator { } public override void Add((System.DateTime t, double v) TValue, bool update) { - if (this.Count == 0) { prev_ma1 = TValue.v; } + if (this.Count == 0) { prev_ma1 = prev_jma = TValue.v; } if (update) { upperBand = p_upperBand; lowerBand = p_lowerBand; @@ -81,6 +81,7 @@ public class JMA_Series : Single_TSeries_Indicator { else { volty_10.Add(volty); } if (volty_10.Count > 10) { volty_10.RemoveAt(0); } vsum = prev_vsum + 0.1 * (volty - volty_10.First()); + prev_vsum = vsum; if (update) { vsum_buff[vsum_buff.Count - 1] = vsum; } else { vsum_buff.Add(vsum); } if (vsum_buff.Count > (10 * _p)) { vsum_buff.RemoveAt(0); } diff --git a/docs/EMA.md b/docs/EMA.md index f685351f..8c0c934f 100644 --- a/docs/EMA.md +++ b/docs/EMA.md @@ -1,22 +1,23 @@ # EMA: Exponential Moving Average -period = 10 -![Alt text](./img/EMA_chart.svg) - -EMA needs very short history buffer and calculates the EMA value using just the previous EMA value. The weight of the new datapoint (k) is k = 2 / (period-1) +Also known as exponentially weighted moving average, as it places greater weight on the most recent data points. +EMA reacts more agressively to recent data changes and calculates the current value using just the previous EMA value and current data point. The weight applied to the new value is typically $k = 2 / (period-1)$ ## Calculation -There is an adopted practice to calculate $SMA$ when $n < period$. +EMA is a rolling calculation requiring only one historical data point to calculate the current value and is denoted as ${EMA}_{p}{(data)}$ where $p$ represents the period and $data$ represents the list of data points. + +Some implementations of EMA calculate a seeding value of $EMA$ as a ${SMA}_{p}$ when $n < period$ - and start the $EMA$ calculation only after the warm-up period. QuanTAlib offers an option to enable/disable SMA warm-up. $$ EMA_n = \left\{ \begin{array}{cl} \frac{1}{p}\left( data_{n}-data_{n-p}\right)+SMA_{n-1} & : \ n \leq period \\ -{k}\times ({data_{n}} - EMA_{n-1}) + EMA_{n-1} & : \ x > period +{k}\times ({data_{n}} - EMA_{n-1}) + EMA_{n-1} & : \ n > period \end{array} \right. $$ - +## Behavior +![Alt text](./img/EMA_chart.svg) ## Reference Calculation period = 5 @@ -27,23 +28,23 @@ EMA_Series ema_nan = new(data, 5, useNaN: true); for (int i=0; i< data.Count; i++) Console.WriteLine($"{i}\t{data[i].v,7:f2}\t{ema_nan[i].v,7:f3}\t{ema[i].v,7:f3}"); ``` -|#|input|ema_NaN|ema| -|--|:--:|:--:|:--:| -|0| 81.59| NaN| 81.590| -|1| 81.06| NaN| 81.325| -|2| 82.87| NaN| 81.840| -|3| 83.00| NaN| 82.130| -|4| 83.61| 82.426| 82.426| -|5| 83.15| 82.667| 82.667| -|6| 82.84| 82.725| 82.725| -|7| 83.99| 83.147| 83.147| -|8| 84.55| 83.614| 83.614| -|9| 84.36| 83.863| 83.863| -|10| 85.53| 84.419| 84.419| -|11| 86.54| 85.126| 85.126| -|12| 86.89| 85.714| 85.714| -|13| 87.77| 86.399| 86.399| -|14| 87.29| 86.696| 86.696| +| #| Input | **QuanTAlib** | _TA-LIB_ | _Skender_ | _Pandas-TA_ | _Tulip_ | +|--|:--:|:--:|:--:|:--:|:--:|:--:| +|0| 81.59| **81.590**| _NaN_| _NaN_| _NaN_| _NaN_| +|1| 81.06| **81.840**| _NaN_| _NaN_| _NaN_| _NaN_| +|2| 82.87| **81.840**| _NaN_| _NaN_| _NaN_| _NaN_| +|3| 83.00| **82.130**| _NaN_| _NaN_| _NaN_| _NaN_| +|4| 83.61| **82.426**| _82.426_| _82.426_| _82.426_| _82.426_| +|5| 83.15| **82.667**| _82.667_| _82.667_| _82.667_|_82.667_| +|6| 82.84| **82.725**| _82.725_| _82.725_| _82.725_|_82.725_| +|7| 83.99| **83.147**| _83.147_| _83.147_| _83.147_|_83.147_| +|8| 84.55| **83.614**| _83.614_| _83.614_| _83.614_|_83.614_| +|9| 84.36| **83.863**| _83.863_| _83.863_| _83.863_|_83.863_| +|10| 85.53| **84.419**| _84.419_| _84.419_| _84.419_|_84.419_| +|11| 86.54| **85.126**| _85.126_| _85.126_| _85.126_|_85.126_| +|12| 86.89| **85.714**| _85.714_| _85.714_| _85.714_|_85.714_| +|13| 87.77| **86.399**| _86.399_| _86.399_| _86.399_|_86.399_| +|14| 87.29| **86.696**| _86.696_| _86.696_| _86.696_|_86.696_| ## References - https://en.wikipedia.org/wiki/Exponential_smoothing \ No newline at end of file diff --git a/docs/SMA.md b/docs/SMA.md index 94b1da1d..df069915 100644 --- a/docs/SMA.md +++ b/docs/SMA.md @@ -21,8 +21,6 @@ $$ - `period`: optional size of a lookback window; if set to 0, SMA calculates cumulative average across the whole source - `useNaN`: if set to _true_, SMA_Series will hide values within the initial period with NaN (for compatibility with other libraries) -[Link to source](..\Source\Trends\SMA_Series.cs) - ## Behavior ![Alt text](./img/SMA_chart.svg) ## Reference Calculation & Validation diff --git a/docs/_sidebar.md b/docs/_sidebar.md index a2bf563e..6266971c 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,4 +1,5 @@ * [Home](/) + * [FAQ - Frequently asked questions answered](QA.md) * [List of all Indicators](indicators.md "Indicators coverage") diff --git a/docs/getting_started.ipynb b/docs/getting_started.ipynb index f8700ccb..bf8c469c 100644 --- a/docs/getting_started.ipynb +++ b/docs/getting_started.ipynb @@ -1,272 +1,272 @@ -{ - "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; iVisual 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; i020406000.20.40.60.81020406000.20.40.60.8102040600102030020406001020300204060−1−0.500.510204060−1−0.500.510204060−1−0.500.510204060−0.4−0.200.20.40204060−1−0.500.50204060−1−0.500.510204060−1−0.500.51020406000.51020406001020300204060−1010204060−1010204060170172174176178 \ No newline at end of file +020406000.20.40.60.81020406000.20.40.60.8102040600102030020406001020300204060−1−0.500.510204060−1−0.500.510204060−1−0.500.510204060−0.4−0.200.20.40204060−1−0.500.50204060−1−0.500.510204060−1−0.500.51020406000.51020406001020300204060−1010204060−1010204060170172174176178 \ No newline at end of file diff --git a/docs/indicators.md b/docs/indicators.md index df76b040..13d2a95c 100644 --- a/docs/indicators.md +++ b/docs/indicators.md @@ -54,7 +54,7 @@ |ALMA - Arnaud Legoux Moving Average|`ALMA_Series`||✔️GetAlma|alma| |DEMA - Double EMA Average|`DEMA_Series`|✔️DEMA|✔️GetDema|✔️dema|✔️dema| |DWMA - Double WMA Average|`DWMA_Series`||||| -|⭐EMA - Exponential Moving Average|`EMA_Series`|✔️EMA|✔️GetEma|✔️ema|✔️ema| +|⭐[EMA - Exponential Moving Average](EMA.md)|`EMA_Series`|✔️EMA|✔️GetEma|✔️ema|✔️ema| |EPMA - Endpoint Moving Average|||GetEpma|| |FRAMA - Fractal Adaptive Moving Average||||| |FMA - Fibonacci's Weighted Moving Average|`FMA_Series`|||fwma| From f898407e73de02635b01a6fb00c7dfb1b1e8fe1e Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Mon, 20 Mar 2023 07:12:34 -0700 Subject: [PATCH 2/3] adding .NET 4 Framework compile to Nuget --- Quantower/Quantower.csproj | 2 ++ Source/Feeds/Alphavantage_Feed.cs | 3 ++- Source/Feeds/Yahoo_Feed.cs | 5 +++-- Source/QuanTAlib.csproj | 2 +- Source/Trends/SMA_Series.cs | 6 +++--- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Quantower/Quantower.csproj b/Quantower/Quantower.csproj index 8bc06984..c7a4148a 100644 --- a/Quantower/Quantower.csproj +++ b/Quantower/Quantower.csproj @@ -21,6 +21,7 @@ True anycpu full + C:\Quantower\TradingPlatform\v1.129.11\..\..\Settings\Scripts\Indicators\Quantower embedded @@ -28,6 +29,7 @@ 3 True anycpu + C:\Quantower\TradingPlatform\v1.129.11\..\..\Settings\Scripts\Indicators\Quantower diff --git a/Source/Feeds/Alphavantage_Feed.cs b/Source/Feeds/Alphavantage_Feed.cs index d4f76fc7..2f521ae2 100644 --- a/Source/Feeds/Alphavantage_Feed.cs +++ b/Source/Feeds/Alphavantage_Feed.cs @@ -9,7 +9,7 @@ Alphavantage - Free API to collect 100 recent daily quotes. It requires a (free) Symbol: stock ("AAPL"), APIkey: unique Alphavantage API key - */ + public class Alphavantage_Feed : TBars { @@ -53,3 +53,4 @@ public class Alphavantage_Feed : TBars return (date, o, h, l, c, v); } } +*/ \ No newline at end of file diff --git a/Source/Feeds/Yahoo_Feed.cs b/Source/Feeds/Yahoo_Feed.cs index 4808d888..4df7d380 100644 --- a/Source/Feeds/Yahoo_Feed.cs +++ b/Source/Feeds/Yahoo_Feed.cs @@ -10,7 +10,7 @@ Yahoo Finance - Free API feed to collect daily market quotes Usage: Yahoo_Feed ticker = new("MSFT", 20) - */ + public class Yahoo_Feed : TBars { @@ -45,4 +45,5 @@ public class Yahoo_Feed : TBars base.Add(d, o, h, l, c, v); } } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/Source/QuanTAlib.csproj b/Source/QuanTAlib.csproj index 0958204d..5fdd2c23 100644 --- a/Source/QuanTAlib.csproj +++ b/Source/QuanTAlib.csproj @@ -11,7 +11,7 @@ Miha Kralj Miha Kralj readme.md - net7.0;net6.0;netstandard2.1 + net7.0;net6.0;netstandard2.1;net48 disable preview disable diff --git a/Source/Trends/SMA_Series.cs b/Source/Trends/SMA_Series.cs index 7b383961..9c23f298 100644 --- a/Source/Trends/SMA_Series.cs +++ b/Source/Trends/SMA_Series.cs @@ -18,11 +18,11 @@ Remark: public class SMA_Series : Single_TSeries_Indicator { private double _sum, _oldsum; - private int _len, _oldlen; + private int _len; public SMA_Series(TSeries source, int period = 0, bool useNaN = false) : base(source, period, false) { _sum = _oldsum = 0; - _len = _oldlen = 0; + _len = 0; if (this._data.Count > 0) { base.Add(this._data); } } @@ -39,6 +39,6 @@ public class SMA_Series : Single_TSeries_Indicator { } public void Reset() { _sum = _oldsum = 0; - _len = _oldlen = 0; + _len = 0; } } From 614df7129f85f8fb3be1721841a0fce7e7b9a8d8 Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Mon, 20 Mar 2023 07:14:32 -0700 Subject: [PATCH 3/3] csproj update --- Source/QuanTAlib.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/QuanTAlib.csproj b/Source/QuanTAlib.csproj index 5fdd2c23..72b8b03e 100644 --- a/Source/QuanTAlib.csproj +++ b/Source/QuanTAlib.csproj @@ -2,7 +2,7 @@ QuanTAlib - 0.1.28 + 0.1.29 Library of Technical Indicators for .NET Quantitative Technical Analysis library for real-time (streaming) data analysis git