diff --git a/.github/workflows/main_automation.yml b/.github/workflows/main_automation.yml index d709839a..0b08acd9 100644 --- a/.github/workflows/main_automation.yml +++ b/.github/workflows/main_automation.yml @@ -50,12 +50,12 @@ jobs: /d:sonar.cs.dotcover.reportsPaths=./coveragereport.html - name: Build Core DLL - run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Debug --nologo + run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Release --nologo - name: Build Quantower DLL - run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Debug --nologo + run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Release --nologo - name: dotnet Test - run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Debug --nologo + run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Release --nologo - name: DotCover Test XML run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml - name: DotCover Test HTML @@ -99,4 +99,4 @@ jobs: run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg' --api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }} --source https://api.nuget.org/v3/index.json - --skip-duplicate \ No newline at end of file +# --skip-duplicate \ No newline at end of file diff --git a/Docs/coverage.md b/Docs/coverage.md index fbd725dd..665c170e 100644 --- a/Docs/coverage.md +++ b/Docs/coverage.md @@ -1,156 +1,157 @@ -# Coverage of indicators - -| Indicator | QuanTAlib | TA-LIB | Skender | Pandas-TA | -|--|:--:|:--:|:--:|:--:| -| **Basics** ||||| -| OC2 - (Open+Close)/2 |✔️|||✔️| -| HL2 - (High+Low)/2 |✔️|||✔️| -| HLC3 - Typical Price |✔️|||✔️| -| OHL3 - (Open+High+Low)/3 |✔️|||✔️| -| OHLC4 - (O+H+L+C)/4 |✔️|||✔️| -| HLCC4 - Weighted Price |✔️||✔️|✔️| -| ADD - Addition |✔️|✔️||| -| SUB - Subtraction |✔️|✔️||| -| MUL - Multiplication |✔️|✔️||| -| DIV - Division |✔️|✔️||| -|||||| -| **Statistics** ||||| -| BETA - Beta coefficient |||✔️|| -| BIAS - Bias |✔️|||✔️| -| ENTR - Entropy |✔️|||✔️| -| KUR - Kurtosis |✔️|||✔️| -| LINREG - Linear Regression ||✔️|✔️|| -| MAD - Mean Absolute Deviation |✔️||✔️|✔️| -| MAPE - Mean Absolute Percent Error |✔️||✔️|| -| MAX - Max value |✔️|✔️||| -| MIN - Min value |✔️|✔️||| -| MED - Median value |✔️|✔️||✔️| -| MSE - Mean Squared Error |✔️||✔️|| -| PSDEV - Population Standard Deviation |✔️|||| -| PVAR - Population Variance |✔️|||| -| QUANTILE ||||✔️| -| RS - R-Squared Coefficient |||✔️|| -| SKEW - Skewness ||||✔️| -| SLOPE - Slope |||✔️|| -| SMAPE - Symmetric Mean Absolute Percent Error |✔️|||| -| SDEV - Sample Standard Deviation |✔️|✔️|✔️|✔️| -| VAR - Sample Variance |✔️|||✔️| -| WMAPE - Weighted Mean Absolute Percent Error |✔️|||| -| ZSCORE |||✔️|✔️| -|||||| -| **Moving Averages** ||||| -| AFIRMA - Autoregressive Finite Impulse Response Moving Average ||||| -| ALMA - Arnaud Legoux Moving Average |||✔️|✔️| -| ARIMA - Autoregressive Integrated Moving Average ||||| -| ATR - Average True Range |✔️|✔️|✔️|✔️| -| ATRP - Average True Range Percent |✔️||✔️|| -| DEMA - Double EMA |✔️|✔️|✔️|✔️| -| EMA - Exponential Moving Average |✔️|✔️|✔️|✔️| -| EPMA - Endpoint Moving Average |||✔️|| -| FWMA - Fibonacci's Weighted Moving Average ||||✔️| -| HEMA - Hull Exponential Moving Average |✔️|||| -| HMA - Hull Moving Average |✔️||✔️|✔️| -| HWMA - Holt-Winter Moving Average ||||✔️| -| JMA - Jurik Moving Average |✔️|||✔️| -| KAMA - Kaufman's Adaptive Moving Average |✔️|✔️|✔️|✔️| -| LSMA - Least Squares Moving Average |||✔️|| -| MACD - Moving Average Convergence/Divergence ||✔️|✔️|✔️| -| MAMA - MESA Adaptive Moving Average ||✔️|✔️|| -| MMA - Modified Moving Average |||✔️|| -| NATR - Normalized Average True Range ||✔️|✔️|✔️| -| PPMA - Pivot Point Moving Average |||✔️|| -| PWMA - Pascal's Weighted Moving Average ||||✔️| -| RMA - WildeR's Moving Average |✔️|||✔️| -| SINWMA - Sine Weighted Moving Average ||||✔️| -| SMA - Simple Moving Average |✔️|✔️|✔️|✔️| -| SMMA - Smoothed Moving Average |✔️||✔️|| -| STOCH - Stochastic Oscillator ||✔️|✔️|✔️| -| SSF - Ehler's Super Smoother Filter ||||✔️| -| SUP - Supertrend |||✔️|✔️| -| SWMA - Symmetric Weighted Moving Average ||||✔️| -| T3 - Tillson T3 Moving Average ||✔️|✔️|✔️| -| TEMA - Triple EMA |✔️|✔️|✔️|✔️| -| TRIMA - Triangular Moving Average ||✔️||✔️| -| VIDYA - Variable Index Dynamic Average ||||✔️| -| VWAP - Volume Weighted Average Price |||✔️|✔️| -| VWMA - Volume Weighted Moving Average |||✔️|✔️| -| WMA - Weighted Moving Average |✔️|✔️|✔️|✔️| -| ZLEMA - Zero Lag EMA |✔️|||✔️| -|||||| -| **Oscillators and Indices** ||||| -| AC - Acceleration Oscillator ||||✔️| -| AD - Chaikin Accumulation Distribution ||✔️|✔️|✔️| -| ADOSC - Chaikin Accumulation Distribution Oscillator ||✔️|✔️|| -| ADX - Average Directional Movement Index ||✔️|✔️|✔️| -| ADXR - Average Directional Movement Index Rating ||✔️|✔️|| -| AO - Awesome Oscillator |||✔️|✔️| -| APO - Absolute Price Oscillator ||✔️||✔️| -| AROON - Aroon oscillator ||✔️|✔️|✔️| -| BBANDS - Bollinger Bands ||✔️|✔️|✔️| -| BOP - Balance of Power ||✔️|✔️|✔️| -| CCI - Commodity Channel Index ||✔️|✔️|✔️| -| CFO - Chande Forcast Oscillator ||||✔️| -| CMF - Chaikin Money Flow |||✔️|✔️| -| CMO - Chande Momentum Oscillator ||✔️||✔️| -| COG - Center of Gravity ||||✔️| -| CRSI - Connor RSI |||✔️|| -| CTI - Ehler's Correlation Trend Indicator ||||✔️| -| DMI - Directional Movement Index ||✔️|✔️|✔️| -| EFI - Elder Ray's Force Index |||✔️|✔️| -| GAT - Alligator oscillator |||✔️|| -| KRI - Kairi Relative Index ||||| -| KVO - Klinger Volume Oscillator |||✔️|✔️| -| MFI - Money Flow Index ||✔️|✔️|✔️| -| MOM - Momentum |||✔️|✔️| -| NVI - Negative Volume Index ||||✔️| -| PO - Price Oscillator ||||✔️| -| PPO - Percentage Price Oscillator ||✔️||✔️| -| PVI - Positive Volume Index ||||✔️| -| RSI - Relative Strength Index ||✔️|✔️|✔️| -| RVGI - Relative Vigor Index ||||✔️| -| SRSI - Stochastic RSI |||✔️|✔️| -| TRIX - 1-day ROC of TEMA ||✔️|✔️|✔️| -| TSI - True Strength Index |||✔️|✔️| -| UI - Ulcer Index |||✔️|✔️| -| UO - Ultimate Oscillator ||✔️|✔️|✔️| -| WGAT - Williams Alligator |||✔️|| -|||||| -| **Volume** ||||| -| AOBV - Archer On-Balance Volume ||||✔️| -| OBV - On-Balance Volume ||✔️|✔️|✔️| -| PRS - Price Relative Strength |||✔️|| -| PVOL - Price-Volume ||||| -| PVR - Price Volume Rank ||||✔️| -| PVT - Price Volume Trend ||||✔️| -| VP - Volume Profile ||||✔️| -|||||| -|**Unsorted**||||| -| CHN - Price Channel |||✔️|| -| COPPOCK - Coppock Curve ||||✔️| -| CORREL - Pearson's Correlation Coefficient ||✔️|✔️|| -| EOM - Ease of Movement ||||✔️| -| HILO - Gann High-Low Activator ||||✔️| -| HV - Historical Volatility |||✔️|| -| HT - HT Trendline |||✔️|| -| ICH - Ichimoku |||✔️|✔️| -| MCGD - McGinley Dynamic ||||✔️| -| ROC - Rate of Change ||✔️|✔️|✔️| -| SAR - Parabolic Stop and Reverse ||✔️|✔️|✔️| -| STC - Schaff Trend Cycle |||✔️|✔️| -| TR - True Range ||✔️|✔️|✔️| -| WILLR - Larry Williams' %R ||✔️|✔️|✔️| -| HURST - Hurst Exponent |||✔️|| -| VOR - Vortex Indicator |||✔️|✔️| -| DON - Donchian Channels |||✔️|✔️| -| FCB - Fractal Chaos Bands |||✔️|| -| KEL - Keltner Channels |||✔️|✔️| -| PVT - Pivot Points |||✔️|| -| STARC - Starc Bands |||✔️|| -| DPO - De-trended Price Oscillator |||✔️|✔️| -| KDJ - KDJ Index |||✔️|✔️| -| SMI - Stochastic Momentum Index |||✔️|✔️| -| CHAND - Chandelier Exit |||✔️|| -| VSTOP - Volatility Stop |||✔️|| -| PVO - Percentage Volume Oscillator |||✔️|✔️| -| Hilbert Transform Instantaneous Trendline ||||| -| PMO - Price Momentum Oscillator |||✔️|| +# Coverage of indicators + +| Indicator | QuanTAlib | TA-LIB | Skender | Pandas-TA | +|--|:--:|:--:|:--:|:--:| +| **Basics** ||||| +| OC2 - (Open+Close)/2 |✔️|||✔️| +| HL2 - (High+Low)/2 |✔️|||✔️| +| HLC3 - Typical Price |✔️|||✔️| +| OHL3 - (Open+High+Low)/3 |✔️|||✔️| +| OHLC4 - (O+H+L+C)/4 |✔️|||✔️| +| HLCC4 - Weighted Price |✔️||✔️|✔️| +| ZL - Zero Lag - De-lagged price |✔️|||✔️| +| ADD - Addition |✔️|✔️||| +| SUB - Subtraction |✔️|✔️||| +| MUL - Multiplication |✔️|✔️||| +| DIV - Division |✔️|✔️||| +|||||| +| **Statistics** ||||| +| BETA - Beta coefficient |||✔️|| +| BIAS - Bias |✔️|||✔️| +| ENTR - Entropy |✔️|||✔️| +| KUR - Kurtosis |✔️|||✔️| +| LINREG - Linear Regression ||✔️|✔️|| +| MAD - Mean Absolute Deviation |✔️||✔️|✔️| +| MAPE - Mean Absolute Percent Error |✔️||✔️|| +| MAX - Max value |✔️|✔️||| +| MIN - Min value |✔️|✔️||| +| MED - Median value |✔️|✔️||✔️| +| MSE - Mean Squared Error |✔️||✔️|| +| PSDEV - Population Standard Deviation |✔️|||| +| PVAR - Population Variance |✔️|||| +| QUANTILE ||||✔️| +| RS - R-Squared Coefficient |||✔️|| +| SKEW - Skewness ||||✔️| +| SLOPE - Slope |||✔️|| +| SMAPE - Symmetric Mean Absolute Percent Error |✔️|||| +| SDEV - Sample Standard Deviation |✔️|✔️|✔️|✔️| +| VAR - Sample Variance |✔️|||✔️| +| WMAPE - Weighted Mean Absolute Percent Error |✔️|||| +| ZSCORE |||✔️|✔️| +|||||| +| **Moving Averages** ||||| +| AFIRMA - Autoregressive Finite Impulse Response Moving Average ||||| +| ALMA - Arnaud Legoux Moving Average |||✔️|✔️| +| ARIMA - Autoregressive Integrated Moving Average ||||| +| ATR - Average True Range |✔️|✔️|✔️|✔️| +| ATRP - Average True Range Percent |✔️||✔️|| +| DEMA - Double EMA |✔️|✔️|✔️|✔️| +| EMA - Exponential Moving Average |✔️|✔️|✔️|✔️| +| EPMA - Endpoint Moving Average |||✔️|| +| FWMA - Fibonacci's Weighted Moving Average ||||✔️| +| HEMA - Hull Exponential Moving Average |✔️|||| +| HMA - Hull Moving Average |✔️||✔️|✔️| +| HWMA - Holt-Winter Moving Average ||||✔️| +| JMA - Jurik Moving Average |✔️|||✔️| +| KAMA - Kaufman's Adaptive Moving Average |✔️|✔️|✔️|✔️| +| LSMA - Least Squares Moving Average |||✔️|| +| MACD - Moving Average Convergence/Divergence ||✔️|✔️|✔️| +| MAMA - MESA Adaptive Moving Average ||✔️|✔️|| +| MMA - Modified Moving Average |||✔️|| +| NATR - Normalized Average True Range ||✔️|✔️|✔️| +| PPMA - Pivot Point Moving Average |||✔️|| +| PWMA - Pascal's Weighted Moving Average ||||✔️| +| RMA - WildeR's Moving Average |✔️|||✔️| +| SINWMA - Sine Weighted Moving Average ||||✔️| +| SMA - Simple Moving Average |✔️|✔️|✔️|✔️| +| SMMA - Smoothed Moving Average |✔️||✔️|| +| STOCH - Stochastic Oscillator ||✔️|✔️|✔️| +| SSF - Ehler's Super Smoother Filter ||||✔️| +| SUP - Supertrend |||✔️|✔️| +| SWMA - Symmetric Weighted Moving Average ||||✔️| +| T3 - Tillson T3 Moving Average ||✔️|✔️|✔️| +| TEMA - Triple EMA |✔️|✔️|✔️|✔️| +| TRIMA - Triangular Moving Average ||✔️||✔️| +| VIDYA - Variable Index Dynamic Average ||||✔️| +| VWAP - Volume Weighted Average Price |||✔️|✔️| +| VWMA - Volume Weighted Moving Average |||✔️|✔️| +| WMA - Weighted Moving Average |✔️|✔️|✔️|✔️| +| ZLEMA - Zero Lag EMA |✔️|||✔️| +|||||| +| **Oscillators and Indices** ||||| +| AC - Acceleration Oscillator ||||✔️| +| AD - Chaikin Accumulation Distribution ||✔️|✔️|✔️| +| ADOSC - Chaikin Accumulation Distribution Oscillator ||✔️|✔️|| +| ADX - Average Directional Movement Index ||✔️|✔️|✔️| +| ADXR - Average Directional Movement Index Rating ||✔️|✔️|| +| AO - Awesome Oscillator |||✔️|✔️| +| APO - Absolute Price Oscillator ||✔️||✔️| +| AROON - Aroon oscillator ||✔️|✔️|✔️| +| BBANDS - Bollinger Bands ||✔️|✔️|✔️| +| BOP - Balance of Power ||✔️|✔️|✔️| +| CCI - Commodity Channel Index ||✔️|✔️|✔️| +| CFO - Chande Forcast Oscillator ||||✔️| +| CMF - Chaikin Money Flow |||✔️|✔️| +| CMO - Chande Momentum Oscillator ||✔️||✔️| +| COG - Center of Gravity ||||✔️| +| CRSI - Connor RSI |||✔️|| +| CTI - Ehler's Correlation Trend Indicator ||||✔️| +| DMI - Directional Movement Index ||✔️|✔️|✔️| +| EFI - Elder Ray's Force Index |||✔️|✔️| +| GAT - Alligator oscillator |||✔️|| +| KRI - Kairi Relative Index ||||| +| KVO - Klinger Volume Oscillator |||✔️|✔️| +| MFI - Money Flow Index ||✔️|✔️|✔️| +| MOM - Momentum |||✔️|✔️| +| NVI - Negative Volume Index ||||✔️| +| PO - Price Oscillator ||||✔️| +| PPO - Percentage Price Oscillator ||✔️||✔️| +| PVI - Positive Volume Index ||||✔️| +| RSI - Relative Strength Index ||✔️|✔️|✔️| +| RVGI - Relative Vigor Index ||||✔️| +| SRSI - Stochastic RSI |||✔️|✔️| +| TRIX - 1-day ROC of TEMA ||✔️|✔️|✔️| +| TSI - True Strength Index |||✔️|✔️| +| UI - Ulcer Index |||✔️|✔️| +| UO - Ultimate Oscillator ||✔️|✔️|✔️| +| WGAT - Williams Alligator |||✔️|| +|||||| +| **Volume** ||||| +| AOBV - Archer On-Balance Volume ||||✔️| +| OBV - On-Balance Volume ||✔️|✔️|✔️| +| PRS - Price Relative Strength |||✔️|| +| PVOL - Price-Volume ||||| +| PVR - Price Volume Rank ||||✔️| +| PVT - Price Volume Trend ||||✔️| +| VP - Volume Profile ||||✔️| +|||||| +|**Unsorted**||||| +| CHN - Price Channel |||✔️|| +| COPPOCK - Coppock Curve ||||✔️| +| CORREL - Pearson's Correlation Coefficient ||✔️|✔️|| +| EOM - Ease of Movement ||||✔️| +| HILO - Gann High-Low Activator ||||✔️| +| HV - Historical Volatility |||✔️|| +| HT - HT Trendline |||✔️|| +| ICH - Ichimoku |||✔️|✔️| +| MCGD - McGinley Dynamic ||||✔️| +| ROC - Rate of Change ||✔️|✔️|✔️| +| SAR - Parabolic Stop and Reverse ||✔️|✔️|✔️| +| STC - Schaff Trend Cycle |||✔️|✔️| +| TR - True Range ||✔️|✔️|✔️| +| WILLR - Larry Williams' %R ||✔️|✔️|✔️| +| HURST - Hurst Exponent |||✔️|| +| VOR - Vortex Indicator |||✔️|✔️| +| DON - Donchian Channels |||✔️|✔️| +| FCB - Fractal Chaos Bands |||✔️|| +| KEL - Keltner Channels |||✔️|✔️| +| PVT - Pivot Points |||✔️|| +| STARC - Starc Bands |||✔️|| +| DPO - De-trended Price Oscillator |||✔️|✔️| +| KDJ - KDJ Index |||✔️|✔️| +| SMI - Stochastic Momentum Index |||✔️|✔️| +| CHAND - Chandelier Exit |||✔️|| +| VSTOP - Volatility Stop |||✔️|| +| PVO - Percentage Volume Oscillator |||✔️|✔️| +| Hilbert Transform Instantaneous Trendline ||||| +| PMO - Price Momentum Oscillator |||✔️|| diff --git a/Quantower/Indicators/ZLMA_chart.cs b/Quantower/Indicators/ZLMA_chart.cs index 0b556b0a..61020e38 100644 --- a/Quantower/Indicators/ZLMA_chart.cs +++ b/Quantower/Indicators/ZLMA_chart.cs @@ -62,7 +62,7 @@ public class ZLMA_chart : Indicator }; this.ShortName = "ZLMA (" + maname + ", " + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")"; - this.zerolag = new(source: bars.Select(this.DataSource), period: this.Period, useNaN: false); + ZL_Series zerolag = new(source: bars.Select(this.DataSource), period: this.Period, useNaN: false); this.indicator = matype switch { 0 => new SMA_Series(source: zerolag, period: this.Period, useNaN: false), diff --git a/Source/Indicators/JMA_Series.cs b/Source/Indicators/JMA_Series.cs index d1639a09..dfe2bf9a 100644 --- a/Source/Indicators/JMA_Series.cs +++ b/Source/Indicators/JMA_Series.cs @@ -27,7 +27,7 @@ public class JMA_Series : Single_TSeries_Indicator private double prev_ma1, prev_det0, prev_det1, prev_jma, bsmax, bsmin; private double o_prev_ma1, o_prev_det0, o_prev_det1, o_prev_jma, o_bsmax, o_bsmin; - private readonly double pr, pow1, len2, beta, rvolty, _l; + private readonly double pr, pow1, len2, beta, rvolty; public JMA_Series(TSeries source, int period, double phase = 0.0, bool useNaN = false) : base(source, period, useNaN) { diff --git a/Source/Indicators/KAMA_Series.cs b/Source/Indicators/KAMA_Series.cs index 20c49714..2f46e25d 100644 --- a/Source/Indicators/KAMA_Series.cs +++ b/Source/Indicators/KAMA_Series.cs @@ -25,7 +25,7 @@ Remark: public class KAMA_Series : Single_TSeries_Indicator { - private static double _scFast, _scSlow; + private readonly double _scFast, _scSlow; private readonly System.Collections.Generic.List _buffer = new(); private double _lastkama = double.NaN; private double _lastlastkama; diff --git a/Source/Statistics/ENTP_Series.cs b/Source/Statistics/ENTP_Series.cs index d39c58cd..a75af82f 100644 --- a/Source/Statistics/ENTP_Series.cs +++ b/Source/Statistics/ENTP_Series.cs @@ -23,7 +23,7 @@ public class ENTP_Series : Single_TSeries_Indicator this._logbase = logbase; if (base._data.Count > 0) { base.Add(base._data); } } - private readonly double _logbase = 2.0; + private readonly double _logbase; private readonly System.Collections.Generic.List _buffer = new(); private readonly System.Collections.Generic.List _buff2 = new(); diff --git a/Source/Statistics/KURT_Series.cs b/Source/Statistics/KURT_Series.cs index c6fb3c8a..be84dabe 100644 --- a/Source/Statistics/KURT_Series.cs +++ b/Source/Statistics/KURT_Series.cs @@ -20,7 +20,7 @@ Calculation: Sources: https://en.wikipedia.org/wiki/Kurtosis https://stats.oarc.ucla.edu/other/mult-pkg/faq/general/faq-whats-with-the-different-formulas-for-kurtosis/ - + */ public class KURT_Series : Single_TSeries_Indicator @@ -30,7 +30,7 @@ public class KURT_Series : Single_TSeries_Indicator this._logbase = logbase; if (base._data.Count > 0) { base.Add(base._data); } } - protected double _logbase = 2.0; + protected double _logbase; private readonly System.Collections.Generic.List _buffer = new(); public override void Add((System.DateTime t, double v) TValue, bool update)