diff --git a/Directory.Build.props b/Directory.Build.props index df85d4db..311a99e7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -51,9 +51,7 @@ - - - + D:\Quantower $([System.IO.Directory]::GetDirectories("$(QuantowerRoot)\TradingPlatform", "v1*")[0]) diff --git a/Tests/test_eventing.cs b/Tests/test_eventing.cs index 9a61defd..57f519ca 100644 --- a/Tests/test_eventing.cs +++ b/Tests/test_eventing.cs @@ -51,6 +51,12 @@ public class EventingTests ("Tema", new Tema(p), new Tema(input, p)), ("Kama", new Kama(2, 30, 6), new Kama(input, 2, 30, 6)), ("Zlema", new Zlema(p), new Zlema(input, p)), + // oscillators + ("Rsi", new Rsi(p), new Rsi(input, p)), + ("Rsx", new Rsx(p), new Rsx(input, p)), + ("Cmo", new Cmo(p), new Cmo(input, p)), + // volatility + ("Rv", new Rv(p), new Rv(input, p)), // error classes ("Mae", new Mae(p), new Mae(input, p)), ("Mapd", new Mapd(p), new Mapd(input, p)), @@ -67,7 +73,7 @@ public class EventingTests ("Rse", new Rse(p), new Rse(input, p)), ("Smape", new Smape(p), new Smape(input, p)), ("Rsquared", new Rsquared(p), new Rsquared(input, p)), - ("Huberloss", new Huberloss(p), new Huberloss(input, p)) + ("Huber", new Huber(p), new Huber(input, p)) }; // Generate 200 random values and feed them to both direct and event-based indicators diff --git a/Tests/test_updates_errors.cs b/Tests/test_updates_errors.cs index 67db6037..13641eb8 100644 --- a/Tests/test_updates_errors.cs +++ b/Tests/test_updates_errors.cs @@ -20,7 +20,7 @@ public class UpdateTests [Fact] public void Huberloss_Update() { - var indicator = new Huberloss(period: 14); + var indicator = new Huber(period: 14); double initialValue = indicator.Calc(new TValue(DateTime.Now, ReferenceValue, IsNew: true)); for (int i = 0; i < RandomUpdates; i++) diff --git a/Tests/test_updates_volatility.cs b/Tests/test_updates_volatility.cs index ba7976ee..5a041c26 100644 --- a/Tests/test_updates_volatility.cs +++ b/Tests/test_updates_volatility.cs @@ -45,7 +45,7 @@ public class VolatilityUpdateTests [Fact] public void Historical_Update() { - var indicator = new Historical(period: 14); + var indicator = new Hv(period: 14); double initialValue = indicator.Calc(new TBar(DateTime.Now, ReferenceValue, ReferenceValue, ReferenceValue, ReferenceValue, 1000, IsNew: true)); for (int i = 0; i < RandomUpdates; i++) @@ -60,7 +60,7 @@ public class VolatilityUpdateTests [Fact] public void Realized_Update() { - var indicator = new Realized(period: 14); + var indicator = new Rv(period: 14); double initialValue = indicator.Calc(new TBar(DateTime.Now, ReferenceValue, ReferenceValue, ReferenceValue, ReferenceValue, 1000, IsNew: true)); for (int i = 0; i < RandomUpdates; i++) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 5df2cf71..1d6e0c3e 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,5 +1,8 @@ * [Home](/) + +[JMA](indicators/averages/jma/calc.md) + * Introduction * [Overview]() * [Features]() diff --git a/docs/indicators/averages/jma/calc.md b/docs/indicators/averages/jma/calc.md new file mode 100644 index 00000000..86c9c3f4 --- /dev/null +++ b/docs/indicators/averages/jma/calc.md @@ -0,0 +1,48 @@ +# JMA Calculation + +### Initial Parameters: + +$\beta = factor \cdot \frac{period - 1}{factor \cdot (period - 1) + 2}$ + +$len1 = \frac{\ln(\sqrt{period - 1})}{\ln(2)} + 2$ + +$pow1 = \max(len1 - 2, 0.5)$ + +$phase \in [0.5, 2.5]$ (clamped to $(phase \cdot 0.01) + 1.5$) + +### Volatility Calculations: + +$del1_t = price_t - upperBand_{t-1}$ + +$del2_t = price_t - lowerBand_{t-1}$ + +$volty_t = \max(|del1_t|, |del2_t|)$ + +$vSum_t = \frac{\sum_{i=t-buffer+1}^t volty_i}{buffer}$ + +$avgVolty_t = \text{mean}(vSum_{t-64:t})$ + +$rVolty_t = \text{clamp}(\frac{volty_t}{avgVolty_t}, 1, len1^{1/pow1})$ + +### Band Calculations: + +$pow2_t = rVolty_t^{pow1}$ + +$K_v = \beta^{\sqrt{pow2_t}}$ + + +$upperBand_t = price_t - K_v \cdot del1_t$ + + + +$\alpha_t = \beta^{pow2_t}$ + +$ma1_t = price_t + \alpha_t(ma1_{t-1} - price_t)$ + +$det0_t = price_t + \beta(det0_{t-1} - price_t + ma1_t) - ma1_t$ + +$ma2_t = ma1_t + phase \cdot det0_t$ + +$det1_t = (ma2_t - jma_{t-1})(1-\alpha_t)^2 + \alpha_t^2 \cdot det1_{t-1}$ + +$jma_t = jma_{t-1} + det1_t$ \ No newline at end of file diff --git a/docs/indicators/indicators.md b/docs/indicators/indicators.md index cb11589d..d0d66932 100644 --- a/docs/indicators/indicators.md +++ b/docs/indicators/indicators.md @@ -4,17 +4,17 @@ ✔️= Validation tests passed
❌= Issue -|**MOMENTUM INDICATORS**|**QuanTALib**|Skender.Stock|TALib.NETCore| +|**MOMENTUM INDICATORS**|**Class Name**|Skender.Stock|TALib.NETCore| |--|:--:|:--:|:--:| -|*DMI - Directional Movement Index|`?`|GetDmi|| -|*DMX - Jurik Directional Movement Index|`?`||| -|*MOM - Momentum|`?`||| -|*VEL - Jurik Signal Velocity|`?`||| +|DMI - Directional Movement Index|`?`|GetDmi|| +|DMX - Jurik Directional Movement Index|`?`||| +|MOM - Momentum|`?`||| +|VEL - Jurik Signal Velocity|`?`||| |ADX - Average Directional Movement Index|`?`|GetAdx|Adx| |ADXR - Average Directional Movement Index|`?`|Rating|Adxr| |APO - Absolute Price Oscillator|`?`|Apo|| |DPO - Detrended Price Oscillator|`?`|GetDpo|| -|MACD - Movign Average Convergence/Divergence|`?`||| +|MACD - Moving Average Convergence/Divergence|`?`||| |PO - Price Oscillator|`?`||| |PPO - Percentage Price Oscillator|`?`||| |PMO - Price Momentum Oscillator|`?`|GetPmo|| @@ -23,161 +23,161 @@ |TRIX - 1-day ROC of TEMA|`?`|GetTrix|| |VORTEX - Vortex Indicator|`?`|||
-|**VOLATILITY INDICATORS**|**QuanTALib**|Skender.Stock|TALib.NETCore| -|ADR - Average Daily Range|||| -|ANDREW - Andrew's Pitchfork|||| +|**VOLATILITY INDICATORS**|**Class Name**|Skender.Stock|TALib.NETCore| +|ADR - Average Daily Range|`?`||| +|ANDREW - Andrew's Pitchfork|`?`||| |ATR - Average True Range|`Atr`|GetAtr|Atr| -|ATRP - Average True Range Percent|||| -|ATRSTOP - ATR Trailing Stop ||GetAtrStop|| -|BBANDS - Bollinger Bands®||BollingerBands|| -|CHAND - Chandelier Exit||GetChandelier|| -|CVI - Chaikins Volatility|||| -|DON - Donchian Channels||GetDonchian|| -|FCB - Fractal Chaos Bands||GetFcb|| -|HV - Historical Volatility|||| -|ICH - Ichimoku Cloud||GetIchimoku|| -|KEL - Keltner Channels||GetKeltner|| -|NATR - Normalized Average True Range||GetAtr|| -|CHN - Price Channel Indicator|||| -|SAR - Parabolic Stop and Reverse||GetParabolicSar|| -|STARC - Starc Bands||GetStarcBands|| -|TR - True Range|||| -|UI - Ulcer Index||GetUlcerIndex|| -|VSTOP - Volatility Stop||GetVolatilityStop|| +|ATRP - Average True Range Percent|`?`||| +|ATRSTOP - ATR Trailing Stop|`?`|GetAtrStop|| +|BBANDS - Bollinger Bands®|`?`|BollingerBands|| +|CHAND - Chandelier Exit|`?`|GetChandelier|| +|CVI - Chaikins Volatility|`?`||| +|DON - Donchian Channels|`?`|GetDonchian|| +|FCB - Fractal Chaos Bands|`?`|GetFcb|| +|HV - Historical Volatility|`Hv`||| +|ICH - Ichimoku Cloud|`?`|GetIchimoku|| +|KEL - Keltner Channels|`?`|GetKeltner|| +|NATR - Normalized Average True Range|`?`|GetAtr|| +|CHN - Price Channel Indicator|`?`||| +|SAR - Parabolic Stop and Reverse|`?`|GetParabolicSar|| +|STARC - Starc Bands|`?`|GetStarcBands|| +|TR - True Range|`?`||| +|UI - Ulcer Index|`?`|GetUlcerIndex|| +|VSTOP - Volatility Stop|`?`|GetVolatilityStop||
-|**OSCILLATORS**|**QuanTALib**|Skender.Stock|TALib.NETCore| +|**OSCILLATORS**|**Class Name**|Skender.Stock|TALib.NETCore| |RSI - Relative Strength Index|`Rsi`|GetRsi|| |RSX - Jurik Trend Strength Index|`Rsx`||| -|AC - Acceleration Oscillator||||| -|AO - Awesome Oscillator||GetAwesome||| -|AROON - Aroon oscillator||GetAroon|Aroon|| -|BOP - Balance of Power||GetBop|Bop|| -|CCI - Commodity Channel Index||GetCci|Cci|| -|CFO - Chande Forcast Oscillator||||| -|CMO - Chande Momentum Oscillator||GetCmo|Cmo|| -|CHOP - Choppiness Index||GetChop||| -|COG - Ehler's Center of Gravity||||| -|COPPOCK - Coppock Curve||||| -|CRSI - Connor RSI||GetConnorsRsi||| -|CTI - Ehler's Correlation Trend Indicator||||| -|DOSC - Derivative Oscillator||||| -|EFI - Elder Ray's Force Index||GetElderRay||| -|FISHER - Fisher Transform||||| -|FOSC - Forecast Oscillator|||||| -|GATOR - Williams Alliator Oscillator||GetGator||| -|KDJ - KDJ Indicator (trend reversal)||||| -|KRI - Kairi Relative Index||||| -|RVGI - Relative Vigor Index||||| -|SMI - Stochastic Momentum Index||GetSmi||| -|SRSI - Stochastic RSI||GetStochRsi||| -|STC - Schaff Trend Cycle||GetStc||| -|STOCH - Stochastic Oscillator||`GetStoch||| -|TSI - True Strength Index||GetTsi||| -|UO - Ultimate Oscillator||GetUltimate||| -|WILLR - Larry Williams' %R||GetWilliamsR||| +|AC - Acceleration Oscillator|`?`||| +|AO - Awesome Oscillator|`?`|GetAwesome|| +|AROON - Aroon oscillator|`?`|GetAroon|Aroon| +|BOP - Balance of Power|`?`|GetBop|Bop| +|CCI - Commodity Channel Index|`?`|GetCci|Cci| +|CFO - Chande Forcast Oscillator|`?`||| +|CMO - Chande Momentum Oscillator|`Cmo`|GetCmo|Cmo| +|CHOP - Choppiness Index|`?`|GetChop|| +|COG - Ehler's Center of Gravity|`?`||| +|COPPOCK - Coppock Curve|`?`||| +|CRSI - Connor RSI|`?`|GetConnorsRsi|| +|CTI - Ehler's Correlation Trend Indicator|`?`||| +|DOSC - Derivative Oscillator|`?`||| +|EFI - Elder Ray's Force Index|`?`|GetElderRay|| +|FISHER - Fisher Transform|`?`||| +|FOSC - Forecast Oscillator|`?`||| +|GATOR - Williams Alliator Oscillator|`?`|GetGator|| +|KDJ - KDJ Indicator (trend reversal)|`?`||| +|KRI - Kairi Relative Index|`?`||| +|RVGI - Relative Vigor Index|`?`||| +|SMI - Stochastic Momentum Index|`?`|GetSmi|| +|SRSI - Stochastic RSI|`?`|GetStochRsi|| +|STC - Schaff Trend Cycle|`?`|GetStc|| +|STOCH - Stochastic Oscillator|`?`|GetStoch|| +|TSI - True Strength Index|`?`|GetTsi|| +|UO - Ultimate Oscillator|`?`|GetUltimate|| +|WILLR - Larry Williams' %R|`?`|GetWilliamsR||
-|**VOLUME INDICATORS**|**QuanTALib**|Skender.Stock|TALib.NETCore| -|ADL - Chaikin Accumulation Distribution Line||GetAdl|Ad|| -|ADOSC - Chaikin Accumulation Distribution Oscillator||GetChaikinOsc|AdOsc|| -|AOBV - Archer On-Balance Volume||||| -|CMF - Chaikin Money Flow||GetCmf||| -|EOM - Ease of Movement||||| -|KVO - Klinger Volume Oscillator||GetKvo|||| -|MFI - Money Flow Index||GetMfi||| -|NVI - Negative Volume Index||||| -|OBV - On-Balance Volume||GetObv||| -|PVI - Positive Volume Index||||| -|PVOL - Price-Volume||||| -|PVO - Percentage Volume Oscillator||GetPvo||| -|PVR - Price Volume Rank||||| -|PVT - Price Volume Trend||||| -|TVI - Trade Volume Index||||| -|VP - Volume Profile||||| -|VWAP - Volume Weighted Average Price||GetVwap||| -|VWMA - Volume Weighted Moving Average||GetVwma|||| +|**VOLUME INDICATORS**|**Class Name**|Skender.Stock|TALib.NETCore| +|ADL - Chaikin Accumulation Distribution Line|`?`|GetAdl|Ad| +|ADOSC - Chaikin Accumulation Distribution Oscillator|`?`|GetChaikinOsc|AdOsc| +|AOBV - Archer On-Balance Volume|`?`||| +|CMF - Chaikin Money Flow|`?`|GetCmf|| +|EOM - Ease of Movement|`?`||| +|KVO - Klinger Volume Oscillator|`?`|GetKvo|| +|MFI - Money Flow Index|`?`|GetMfi|| +|NVI - Negative Volume Index|`?`||| +|OBV - On-Balance Volume|`?`|GetObv|| +|PVI - Positive Volume Index|`?`||| +|PVOL - Price-Volume|`?`||| +|PVO - Percentage Volume Oscillator|`?`|GetPvo|| +|PVR - Price Volume Rank|`?`||| +|PVT - Price Volume Trend|`?`||| +|TVI - Trade Volume Index|`?`||| +|VP - Volume Profile|`?`||| +|VWAP - Volume Weighted Average Price|`?`|GetVwap|| +|VWMA - Volume Weighted Moving Average|`?`|GetVwma||
-|**NUMERICAL ANALYSIS**|**QuanTALib**|Skender.Stock|TALib.NETCore| -|BETA - Beta coefficient||||| -|CORR - Correlation Coefficient||||| -|CURVATURE - Rate of Change in Direction or Slope|`Curvature`|||| -|ENTROPY - Measure of Uncertainty or Disorder|`Entropy`|||| -|KURTOSIS - Measure of Tails/Peakedness|`Kurtosis`|||| -|HUBER - Huber Loss|`Huberloss`|||| -|HURST - Hurst Exponent||GetHurst||| -|MAX - Maximum with exponential decay|`Max`|||| -|MEDIAN - Middle value|`Median`|||| -|MIN - Minimum with exponential decay|`Min`|||| -|MODE - Most Frequent Value|`Mode`|||| -|PERCENTILE - Rank Order|`Percentile`|||| -|RSQUARED - Coefficient of Determination R-Squared||||| -|SKEW - Skewness, asymmetry of distribution|`Skew`|||| -|SLOPE - Rate of Change, Linear Regression|`Slope`|||| -|STDDEV - Standard Deviation, Measure of Spread|`Stddev`|||| -|THEIL - Theil's U Statistics||||| -|TSF - Time Series Forecast|||`✔️`|`✔️`| -|VARIANCE - Average of Squared Deviations|`Variance`|||| -|ZSCORE - Standardized Score|`Zscore`|||| +|**NUMERICAL ANALYSIS**|**Class Name**|Skender.Stock|TALib.NETCore| +|BETA - Beta coefficient|`?`||| +|CORR - Correlation Coefficient|`?`||| +|CURVATURE - Rate of Change in Direction or Slope|`Curvature`||| +|ENTROPY - Measure of Uncertainty or Disorder|`Entropy`||| +|KURTOSIS - Measure of Tails/Peakedness|`Kurtosis`||| +|HUBER - Huber Loss|`Huber`||| +|HURST - Hurst Exponent|`?`|GetHurst|| +|MAX - Maximum with exponential decay|`Max`||| +|MEDIAN - Middle value|`Median`||| +|MIN - Minimum with exponential decay|`Min`||| +|MODE - Most Frequent Value|`Mode`||| +|PERCENTILE - Rank Order|`Percentile`||| +|RSQUARED - Coefficient of Determination R-Squared|`?`||| +|SKEW - Skewness, asymmetry of distribution|`Skew`||| +|SLOPE - Rate of Change, Linear Regression|`Slope`||| +|STDDEV - Standard Deviation, Measure of Spread|`Stddev`||| +|THEIL - Theil's U Statistics|`?`||| +|TSF - Time Series Forecast|`?`|✔️|✔️| +|VARIANCE - Average of Squared Deviations|`Variance`||| +|ZSCORE - Standardized Score|`Zscore`|||
-|**ERRORS**|**QuanTALib**|Skender.Stock|TALib.NETCore| -|MAE - Mean Absolute Error|`Mae`|||| -|MAPD - Mean Absolute Percentage Deviation|`Mapd`|||| -|MAPE - Mean Absolute Percentage Error|`Mape`|||| -|MASE - Mean Absolute Scaled Error|`Mase`|||| -|MDA - Mean Directional Accuracy||||| -|ME - Mean Error|`Me`|||| -|MPE - Pean Percentage Error|`Mpe`|||| -|MSE - Mean Squared Error|`Mse`|||| -|MSLE - Mean Squared Logarithmic Error|`Msle`|||| -|RAE - Relative Absolute Error|`Rae`|||| -|RMSE - Root Mean Squared Error|`Rmse`|||| -|RSE - Relateive Squared Error|`Rse`|||| -|RMSLE - Root Mean Squared Logarithmic Error|`Rmsle`|||| -|SMAPE - Symmetric Mean Absolute Percentage Error|`Smape`|||| +|**ERRORS**|**Class Name**|Skender.Stock|TALib.NETCore| +|MAE - Mean Absolute Error|`Mae`||| +|MAPD - Mean Absolute Percentage Deviation|`Mapd`||| +|MAPE - Mean Absolute Percentage Error|`Mape`||| +|MASE - Mean Absolute Scaled Error|`Mase`||| +|MDA - Mean Directional Accuracy|`Mda`||| +|ME - Mean Error|`Me`||| +|MPE - Mean Percentage Error|`Mpe`||| +|MSE - Mean Squared Error|`Mse`||| +|MSLE - Mean Squared Logarithmic Error|`Msle`||| +|RAE - Relative Absolute Error|`Rae`||| +|RMSE - Root Mean Squared Error|`Rmse`||| +|RSE - Relative Squared Error|`Rse`||| +|RMSLE - Root Mean Squared Logarithmic Error|`Rmsle`||| +|SMAPE - Symmetric Mean Absolute Percentage Error|`Smape`|||
-|**AVERAGES & TRENDS**|**QuanTALib**|Skender.Stock|TALib.NETCore| -|AFIRMA - Autoregressive Finite Impulse Response Moving Average|`Afirma`|||| -|ALMA - Arnaud Legoux Moving Average|`Alma`|`✔️`|| -|DEMA - Double EMA Average|`Dema`|`✔️`|`✔️`| -|DSMA - Deviation Scaled Moving Average|`Dsma`|||| -|DWMA - Double WMA Average|`Dwma`|||| -|EMA - Exponential Moving Average|`Ema`|`⭐`|`⭐`| -|EPMA - Endpoint Moving Average|`Epma`|`✔️`||| -|FRAMA - Fractal Adaptive Moving Average|`Frama`|||| -|FWMA - Fibonacci Weighted Moving Average|`Fwma`|||| -|HILO - Gann High-Low Activator||||| -|HTIT - Hilbert Transform Instantaneous Trendline|`Htit`|`✔️`|`✔️`|| -|GMA - Gaussian-Weighted Moving Average|`Gma`|||| -|HMA - Hull Moving Average|`Hma`|`✔️`||`✔️`| -|HWMA - Holt-Winter Moving Average|`Hwma`|||| -|JMA - Jurik Moving Average|`Jma`|||| -|JORDAN - Jordan Moving Average||||| -|KAMA - Kaufman's Adaptive Moving Average|`Kama`|`✔️`|`✔️`|`✔️`| -|LTMA - Laguerre Transform Moving Average|`Ltma`|||| -|MAAF - Median-Average Adaptive Filter|`Maaf`|||| -|MAMA - MESA Adaptive Moving Average|`Mama`|`✔️`|`✔️`|| -|MGDI - McGinley Dynamic Indicator|`Mgdi`|`✔️`||| -|MLMA - Minimal Lag Moving Average||||| -|MMA - Modified Moving Average|`Mma`|||| -|PPMA - Pivot Point Moving Average||||| -|PWMA - Pascal's Weighted Moving Average|`Pwma`|||| -|QEMA - Quad Exponential Moving Average|`Qema`|||| -|RMA - WildeR's Moving Average|`Rma`|||| -|SINEMA - Sine Weighted Moving Average|`Sinema`|||| +|**AVERAGES & TRENDS**|**Class Name**|Skender.Stock|TALib.NETCore| +|AFIRMA - Autoregressive Finite Impulse Response Moving Average|`Afirma`||| +|ALMA - Arnaud Legoux Moving Average|`Alma`|✔️|| +|DEMA - Double EMA Average|`Dema`|✔️|✔️| +|DSMA - Deviation Scaled Moving Average|`Dsma`||| +|DWMA - Double WMA Average|`Dwma`||| +|EMA - Exponential Moving Average|`Ema`|⭐|⭐| +|EPMA - Endpoint Moving Average|`Epma`|✔️|| +|FRAMA - Fractal Adaptive Moving Average|`Frama`||| +|FWMA - Fibonacci Weighted Moving Average|`Fwma`||| +|HILO - Gann High-Low Activator|`?`||| +|HTIT - Hilbert Transform Instantaneous Trendline|`Htit`|✔️|✔️| +|GMA - Gaussian-Weighted Moving Average|`Gma`||| +|HMA - Hull Moving Average|`Hma`|✔️|✔️| +|HWMA - Holt-Winter Moving Average|`Hwma`||| +|JMA - Jurik Moving Average|`Jma`||| +|JORDAN - Jordan Moving Average|`?`||| +|KAMA - Kaufman's Adaptive Moving Average|`Kama`|✔️|✔️| +|LTMA - Laguerre Transform Moving Average|`Ltma`||| +|MAAF - Median-Average Adaptive Filter|`Maaf`||| +|MAMA - MESA Adaptive Moving Average|`Mama`|✔️|✔️| +|MGDI - McGinley Dynamic Indicator|`Mgdi`|✔️|| +|MLMA - Minimal Lag Moving Average|`?`||| +|MMA - Modified Moving Average|`Mma`||| +|PPMA - Pivot Point Moving Average|`?`||| +|PWMA - Pascal's Weighted Moving Average|`Pwma`||| +|QEMA - Quad Exponential Moving Average|`Qema`||| +|RMA - WildeR's Moving Average|`Rma`||| +|SINEMA - Sine Weighted Moving Average|`Sinema`||| |SMA - Simple Moving Average|`Sma`||| -|SMMA - Smoothed Moving Average|`Smma`|`✔️`|| -|SSF - Ehler's Super Smoother Filter|||| -|SUPERTREND - Supertrend||`✔️`|| -|T3 - Tillson T3 Moving Average|`T3`|`✔️`|`✔️`| -|TEMA - Triple EMA Average|`Tema`|`✔️`|`✔️`| -|TRIMA - Triangular Moving Average|`Trima`|`✔️`|| +|SMMA - Smoothed Moving Average|`Smma`|✔️|| +|SSF - Ehler's Super Smoother Filter|`?`||| +|SUPERTREND - Supertrend|`?`|✔️|| +|T3 - Tillson T3 Moving Average|`T3`|✔️|✔️| +|TEMA - Triple EMA Average|`Tema`|✔️|✔️| +|TRIMA - Triangular Moving Average|`Trima`|✔️|| |VIDYA - Variable Index Dynamic Average|`Vidya`||| -|WMA - Weighted Moving Average|`Wma`|`✔️`|| +|WMA - Weighted Moving Average|`Wma`|✔️|| |ZLEMA - Zero Lag EMA Average|`Zlema`|||
-|**BASIC TRANSFORMS**|**QuanTALib**|Skender.Stock|TALib.NETCore| -|OC2 - Midpoint price|️`.OC2`|CandlePart.OC2|MidPoint| -|HL2 - Median Price|️`.HL2`|CandlePart.HL2|MedPrice| -|HLC3 - Typical Price|️`.HLC3`|CandlePart.HLC3|TypPrice| -|OHL3 - Mean Price|`️.OHL3`|CandlePart.OHL3| -|OHLC4 - Average Price|`️.OHLC4`|CandlePart.OHLC4|AvgPrice| -|HLCC4 - Weighted Price|`️.HLCC4`||WclPrice| \ No newline at end of file +|**BASIC TRANSFORMS**|**Class Name**|Skender.Stock|TALib.NETCore| +|OC2 - Midpoint price|`.OC2`|CandlePart.OC2|MidPoint| +|HL2 - Median Price|`.HL2`|CandlePart.HL2|MedPrice| +|HLC3 - Typical Price|`.HLC3`|CandlePart.HLC3|TypPrice| +|OHL3 - Mean Price|`.OHL3`|CandlePart.OHL3|| +|OHLC4 - Average Price|`.OHLC4`|CandlePart.OHLC4|AvgPrice| +|HLCC4 - Weighted Price|`.HLCC4`||WclPrice| diff --git a/lib/averages/_list.md b/lib/averages/_list.md new file mode 100644 index 00000000..7ad3da91 --- /dev/null +++ b/lib/averages/_list.md @@ -0,0 +1,33 @@ +✔️ AFIRMA - Adaptive FIR Moving Average +✔️ ALMA - Arnaud Legoux Moving Average +✔️ DEMA - Double Exponential Moving Average +✔️ DSMA - Dynamic Simple Moving Average +✔️ DWMA - Dynamic Weighted Moving Average +✔️ EMA - Exponential Moving Average +✔️ EPMA - Endpoint Moving Average +✔️ FRAMA - Fractal Adaptive Moving Average +✔️ FWMA - Forward Weighted Moving Average +✔️ GMA - Gaussian Moving Average +✔️ HMA - Hull Moving Average +✔️ HTIT - Hilbert Transform Instantaneous Trendline +✔️ HWMA - Hann Weighted Moving Average +✔️ JMA - Jurik Moving Average +✔️ KAMA - Kaufman Adaptive Moving Average +✔️ LTMA - Linear Time Moving Average +✔️ MAAF - Moving Average Adaptive Filter +✔️ MAMA - MESA Adaptive Moving Average +✔️ MGDI - McGinley Dynamic Indicator +✔️ MMA - Modified Moving Average +✔️ PWMA - Parabolic Weighted Moving Average +✔️ QEMA - Quick Exponential Moving Average +✔️ REMA - Regularized Exponential Moving Average +✔️ RMA - Running Moving Average +✔️ SINEMA - Sine-weighted Moving Average +✔️ SMA - Simple Moving Average +✔️ SMMA - Smoothed Moving Average +✔️ T3 - Triple Exponential Moving Average (T3) +✔️ TEMA - Triple Exponential Moving Average +✔️ TRIMA - Triangular Moving Average +✔️ VIDYA - Variable Index Dynamic Average +✔️ WMA - Weighted Moving Average +✔️ ZLEMA - Zero-Lag Exponential Moving Average diff --git a/lib/errors/Huberloss.cs b/lib/errors/Huber.cs similarity index 92% rename from lib/errors/Huberloss.cs rename to lib/errors/Huber.cs index e2bdac55..c7510344 100644 --- a/lib/errors/Huberloss.cs +++ b/lib/errors/Huber.cs @@ -1,12 +1,12 @@ namespace QuanTAlib; -public class Huberloss : AbstractBase +public class Huber : AbstractBase { private readonly CircularBuffer _actualBuffer; private readonly CircularBuffer _predictedBuffer; private readonly double _delta; - public Huberloss(int period, double delta = 1.0) + public Huber(int period, double delta = 1.0) { if (period < 1) { @@ -24,7 +24,7 @@ public class Huberloss : AbstractBase Init(); } - public Huberloss(object source, int period, double delta = 1.0) : this(period, delta) + public Huber(object source, int period, double delta = 1.0) : this(period, delta) { var pubEvent = source.GetType().GetEvent("Pub"); pubEvent?.AddEventHandler(source, new ValueSignal(Sub)); diff --git a/lib/errors/_list.md b/lib/errors/_list.md new file mode 100644 index 00000000..03ecde4b --- /dev/null +++ b/lib/errors/_list.md @@ -0,0 +1,16 @@ +✔️ HUBER - Huber Loss +✔️ MAE - Mean Absolute Error +✔️ MAPD - Mean Absolute Percentage Deviation +✔️ MAPE - Mean Absolute Percentage Error +✔️ MASE - Mean Absolute Scaled Error +✔️ MDA - Mean Directional Accuracy +✔️ ME - Mean Error +✔️ MPE - Mean Percentage Error +✔️ MSE - Mean Squared Error +✔️ MSLE - Mean Squared Logarithmic Error +✔️ RAE - Relative Absolute Error +✔️ RMSE - Root Mean Squared Error +✔️ RMSLE - Root Mean Squared Logarithmic Error +✔️ RSE - Relative Squared Error +✔️ RSQUARED - R-Squared (Coefficient of Determination) +✔️ SMAPE - Symmetric Mean Absolute Percentage Error diff --git a/lib/momentum/_list.md b/lib/momentum/_list.md new file mode 100644 index 00000000..873798b0 --- /dev/null +++ b/lib/momentum/_list.md @@ -0,0 +1,16 @@ +ADX - Average Directional Movement Index +ADXR - Average Directional Movement Index +APO - Absolute Price Oscillator +DMI - Directional Movement Index +DMX - Jurik Directional Movement Index +DPO - Detrended Price Oscillator +MACD - Moving Average Convergence/Divergence +MOM - Momentum +PMO - Price Momentum Oscillator +PO - Price Oscillator +PPO - Percentage Price Oscillator +PRS - Price Relative Strength +ROC - Rate of Change +TRIX - 1-day ROC of TEMA +VEL - Jurik Signal Velocity +VORTEX - Vortex Indicator diff --git a/lib/oscillators/Cmo.cs b/lib/oscillators/Cmo.cs index 0b8d92c5..db0c545c 100644 --- a/lib/oscillators/Cmo.cs +++ b/lib/oscillators/Cmo.cs @@ -20,6 +20,17 @@ public class Cmo : AbstractBase Name = $"CMO({period})"; } + /// + /// Initializes a new instance of the CMO class with a data source. + /// + /// The source object that publishes data. + /// The number of data points to consider. + public Cmo(object source, int period) : this(period) + { + var pubEvent = source.GetType().GetEvent("Pub"); + pubEvent?.AddEventHandler(source, new ValueSignal(Sub)); + } + protected override void ManageState(bool isNew) { if (isNew) @@ -54,7 +65,6 @@ public class Cmo : AbstractBase { _sumH.Add(0, Input.IsNew); _sumL.Add(-diff, Input.IsNew); - } // Calculate sums for the specified period only @@ -67,4 +77,3 @@ public class Cmo : AbstractBase 0.0; } } - diff --git a/lib/volatility/Rsi.cs b/lib/oscillators/Rsi.cs similarity index 76% rename from lib/volatility/Rsi.cs rename to lib/oscillators/Rsi.cs index 9252281d..358e4d03 100644 --- a/lib/volatility/Rsi.cs +++ b/lib/oscillators/Rsi.cs @@ -22,6 +22,17 @@ public class Rsi : AbstractBase Name = $"RSI({period})"; } + /// + /// Initializes a new instance of the RSI class with a data source. + /// + /// The source object that publishes data. + /// The number of data points to consider. + public Rsi(object source, int period) : this(period) + { + var pubEvent = source.GetType().GetEvent("Pub"); + pubEvent?.AddEventHandler(source, new ValueSignal(Sub)); + } + protected override void ManageState(bool isNew) { if (isNew) @@ -53,10 +64,7 @@ public class Rsi : AbstractBase _avgLoss.Calc(loss, IsNew: Input.IsNew); double rsi = (_avgLoss.Value > 0) ? 100 - (100 / (1 + (_avgGain.Value / _avgLoss.Value))) : 100; - return rsi; - - } } diff --git a/lib/volatility/Rsx.cs b/lib/oscillators/Rsx.cs similarity index 70% rename from lib/volatility/Rsx.cs rename to lib/oscillators/Rsx.cs index 6d44c26d..b2d365c6 100644 --- a/lib/volatility/Rsx.cs +++ b/lib/oscillators/Rsx.cs @@ -24,6 +24,19 @@ public class Rsx : AbstractBase Name = $"RSX({period})"; } + /// + /// Initializes a new instance of the RSX class with a data source. + /// + /// The source object that publishes data. + /// The number of data points to consider. + /// The phase parameter. + /// The factor parameter. + public Rsx(object source, int period, int phase = 0, double factor = 0.55) : this(period, phase, factor) + { + var pubEvent = source.GetType().GetEvent("Pub"); + pubEvent?.AddEventHandler(source, new ValueSignal(Sub)); + } + protected override void ManageState(bool isNew) { if (isNew) @@ -58,7 +71,5 @@ public class Rsx : AbstractBase double rsx = _rsx.Calc(rsi, Input.IsNew); return rsx; - - } } diff --git a/lib/oscillators/_list.md b/lib/oscillators/_list.md new file mode 100644 index 00000000..ecda4263 --- /dev/null +++ b/lib/oscillators/_list.md @@ -0,0 +1,29 @@ +AC - Acceleration Oscillator +AO - Awesome Oscillator +AROON - Aroon oscillator +BOP - Balance of Power +CCI - Commodity Channel Index +CFO - Chande Forcast Oscillator +✔️ CMO - Chande Momentum Oscillator +CHOP - Choppiness Index +COG - Ehler's Center of Gravity +COPPOCK - Coppock Curve +CRSI - Connor RSI +CTI - Ehler's Correlation Trend Indicator +DOSC - Derivative Oscillator +EFI - Elder Ray's Force Index +FISHER - Fisher Transform +FOSC - Forecast Oscillator +GATOR - Williams Alliator Oscillator +KDJ - KDJ Indicator (trend reversal) +KRI - Kairi Relative Index +✔️ RSI - Relative Strength Index +✔️ RSX - Jurik Trend Strength Index +RVGI - Relative Vigor Index +SMI - Stochastic Momentum Index +SRSI - Stochastic RSI +STC - Schaff Trend Cycle +STOCH - Stochastic Oscillator +TSI - True Strength Index +UO - Ultimate Oscillator +WILLR - Larry Williams' %R diff --git a/lib/statistics/_list.md b/lib/statistics/_list.md new file mode 100644 index 00000000..b7f77ddc --- /dev/null +++ b/lib/statistics/_list.md @@ -0,0 +1,20 @@ +BETA - Beta coefficient +CORR - Correlation Coefficient +✔️ CURVATURE - Rate of Change in Direction or Slope +✔️ ENTROPY - Measure of Uncertainty or Disorder +HUBER - Huber Loss +HURST - Hurst Exponent +✔️ KURTOSIS - Measure of Tails/Peakedness +✔️ MAX - Maximum with exponential decay +✔️ MEDIAN - Middle value +✔️ MIN - Minimum with exponential decay +✔️ MODE - Most Frequent Value +✔️ PERCENTILE - Rank Order +RSQUARED - Coefficient of Determination R-Squared +✔️ SKEW - Skewness, asymmetry of distribution +✔️ SLOPE - Rate of Change, Linear Regression +✔️ STDDEV - Standard Deviation, Measure of Spread +THEIL - Theil's U Statistics +TSF - Time Series Forecast +✔️ VARIANCE - Average of Squared Deviations +✔️ ZSCORE - Standardized Score diff --git a/lib/volatility/Historical.cs b/lib/volatility/Hv.cs similarity index 95% rename from lib/volatility/Historical.cs rename to lib/volatility/Hv.cs index 9417b14d..ef74e37e 100644 --- a/lib/volatility/Historical.cs +++ b/lib/volatility/Hv.cs @@ -9,7 +9,7 @@ namespace QuanTAlib; /// both annualized and non-annualized volatility measures. The calculation uses a sample /// standard deviation formula and assumes 252 trading days in a year for annualization. /// -public class Historical : AbstractBase +public class Hv : AbstractBase { private readonly int Period; private readonly bool IsAnnualized; @@ -25,7 +25,7 @@ public class Historical : AbstractBase /// /// Thrown when period is less than 2. /// - public Historical(int period, bool isAnnualized = true) + public Hv(int period, bool isAnnualized = true) { if (period < 2) { @@ -46,7 +46,7 @@ public class Historical : AbstractBase /// The source object to subscribe to for value updates. /// The period over which to calculate historical volatility. /// Whether to annualize the volatility (default is true). - public Historical(object source, int period, bool isAnnualized = true) : this(period, isAnnualized) + public Hv(object source, int period, bool isAnnualized = true) : this(period, isAnnualized) { var pubEvent = source.GetType().GetEvent("Pub"); pubEvent?.AddEventHandler(source, new ValueSignal(Sub)); diff --git a/lib/volatility/Realized.cs b/lib/volatility/Rv.cs similarity index 85% rename from lib/volatility/Realized.cs rename to lib/volatility/Rv.cs index 5798919b..4aec3783 100644 --- a/lib/volatility/Realized.cs +++ b/lib/volatility/Rv.cs @@ -9,7 +9,7 @@ namespace QuanTAlib; /// both annualized and non-annualized volatility measures. The calculation uses a rolling /// sum of squared returns for efficiency and assumes 252 trading days in a year for annualization. /// -public class Realized : AbstractBase +public class Rv : AbstractBase { private readonly int Period; private readonly bool IsAnnualized; @@ -25,7 +25,7 @@ public class Realized : AbstractBase /// /// Thrown when period is less than 2. /// - public Realized(int period, bool isAnnualized = true) + public Rv(int period, bool isAnnualized = true) { if (period < 2) { @@ -39,6 +39,18 @@ public class Realized : AbstractBase Init(); } + /// + /// Initializes a new instance of the Realized class with a data source. + /// + /// The source object that publishes data. + /// The period over which to calculate realized volatility. + /// Whether to annualize the volatility (default is true). + public Rv(object source, int period, bool isAnnualized = true) : this(period, isAnnualized) + { + var pubEvent = source.GetType().GetEvent("Pub"); + pubEvent?.AddEventHandler(source, new ValueSignal(Sub)); + } + /// /// Initializes the Realized instance by clearing buffers and resetting calculation variables. /// @@ -113,4 +125,4 @@ public class Realized : AbstractBase IsHot = _index >= WarmupPeriod; return volatility; } -} \ No newline at end of file +} diff --git a/lib/volatility/_list.md b/lib/volatility/_list.md new file mode 100644 index 00000000..5f62b5cf --- /dev/null +++ b/lib/volatility/_list.md @@ -0,0 +1,34 @@ +ADR - Average Daily Range +AP - Andrew's Pitchfork +✔️ ATR - Average True Range +ATRP - Average True Range Percent +ATRS - ATR Trailing Stop +BB - Bollinger Bands® +CCV - Close-to-Close Volatility +CE - Chandelier Exit +CV - Conditional Volatility (ARCH/GARCH) +CVI - Chaikin's Volatility +DC - Donchian Channels +FCB - Fractal Chaos Bands +GKV - Garman-Klass Volatility +HLV - High-Low Volatility +✔️ HV - Historical Volatility +ICH - Ichimoku Cloud +✔️ JVOLTY - Jurik Volatility +KC - Keltner Channels +NATR - Normalized Average True Range +PCH - Price Channel Indicator +PSAR - Parabolic Stop and Reverse +PV - Parkinson Volatility +RSV - Rogers-Satchell Volatility +✔️ RV - Realized Volatility +RVI - Relative Volatility Index +STARC - Starc Bands +SV - Stochastic Volatility +TR - True Range +UI - Ulcer Index +VC - Volatility Cone +VOV - Volatility of Volatility +VR - Volatility Ratio +VS - Volatility Stop +YZV - Yang-Zhang Volatility \ No newline at end of file diff --git a/lib/volume/_list.md b/lib/volume/_list.md new file mode 100644 index 00000000..0b99daa1 --- /dev/null +++ b/lib/volume/_list.md @@ -0,0 +1,18 @@ +ADL - Chaikin Accumulation Distribution Line +ADOSC - Chaikin Accumulation Distribution Oscillator +AOBV - Archer On-Balance Volume +CMF - Chaikin Money Flow +EOM - Ease of Movement +KVO - Klinger Volume Oscillator +MFI - Money Flow Index +NVI - Negative Volume Index +OBV - On-Balance Volume +PVI - Positive Volume Index +PVOL - Price-Volume +PVO - Percentage Volume Oscillator +PVR - Price Volume Rank +PVT - Price Volume Trend +TVI - Trade Volume Index +VP - Volume Profile +VWAP - Volume Weighted Average Price +VWMA - Volume Weighted Moving Average diff --git a/notebooks/charting.dib b/notebooks/charting.dib index 93f47139..6aaaed19 100644 --- a/notebooks/charting.dib +++ b/notebooks/charting.dib @@ -4,7 +4,7 @@ #!csharp -#r "..\lib\obj\Debug\QuanTAlib.dll" +#r "../lib/obj/Debug/QuanTAlib.dll" using QuanTAlib; QuanTAlib.Formatters.Initialize(); @@ -40,14 +40,14 @@ Formatter.Register(typeof(ScottPlot.Plot), (p, w) => TSeries ma1 = Spike; TSeries out1 = new(); -Ema calc1 = new(10); +Jma calc1 = new(period: 7, phase: 0, factor: 0.30, buffer: 2); foreach (var value in ma1) { out1.Add(calc1.Calc(value)); } double[] gma1 = ma1.v.ToArray()[52..]; double[] gsig1 = out1.v.ToArray()[52..]; TSeries ma2 = Impulse; TSeries out2 = new(); -Ema calc2 = new(10); +Jma calc2 = new(period: 7, phase: 0, factor: 0.20, buffer: 2); foreach (var value in ma2) { out2.Add(calc2.Calc(value)); } double[] gma2 = ma2.v.ToArray()[52..]; double[] gsig2 = out2.v.ToArray()[52..]; @@ -57,12 +57,12 @@ double[] gsig2 = out2.v.ToArray()[52..]; Plot plt1 = new(); var p1a = plt1.Add.Signal(gma1); p1a.Color = ScottPlot.Colors.Red; p1a.LineWidth = 2; var p1b = plt1.Add.Signal(gsig1); p1b.Color = ScottPlot.Colors.Blue; p1b.LineWidth = 3; -plt1.Title("Spike - EMA(10)"); +plt1.Title("Spike - JMA(10)"); Plot plt2 = new(); var p2a = plt2.Add.Signal(gma2); p2a.Color = ScottPlot.Colors.Red; p2a.LineWidth = 2; var p2b = plt2.Add.Signal(gsig2); p2b.Color = ScottPlot.Colors.Blue; p2b.LineWidth = 3; -plt2.Title("Impulse - EMA(10)"); +plt2.Title("Impulse - JMA(10)"); plt1.Display(); plt2.Display(); diff --git a/notebooks/jma.dib b/notebooks/jma.dib index b6d42f87..72b779d7 100644 --- a/notebooks/jma.dib +++ b/notebooks/jma.dib @@ -41,7 +41,7 @@ plt.Display(); #!csharp -#r "..\lib\obj\Debug\QuanTAlib.dll" +#r "../lib/obj/Debug/QuanTAlib.dll" using QuanTAlib; QuanTAlib.Formatters.Initialize(); @@ -82,163 +82,11 @@ TSeries MarketJMA = new() { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, #!csharp -public class Jmaxx : AbstractBase -{ - private readonly double _period; - private readonly double _phase; - private readonly CircularBuffer _vsumBuff; - private readonly CircularBuffer _avoltyBuff; - - private double _len1; - private double _pow1; - private readonly double _beta; - private double _upperBand, _lowerBand, _p_upperBand, _p_lowerBand; - private double _prevMa1, _prevDet0, _prevDet1, _prevJma, _p_prevMa1, _p_prevDet0, _p_prevDet1, _p_prevJma; - private double _vSum, _p_vSum; - - - public double UpperBand { get; set; } - public double LowerBand { get; set; } - public double Volty { get; set; } - - /// - /// Initializes a new instance of the Jma class with the specified parameters. - /// - /// The period over which to calculate the Jvolty. - /// The phase parameter for the JMA-style calculation. - /// - /// Thrown when period is less than 1. - /// - public Jmaxx(int period, int phase = 0) - { - if (period < 1) - { - throw new ArgumentOutOfRangeException(nameof(period), "Period must be greater than or equal to 1."); - } - _period = period; - - _phase = Math.Clamp((phase * 0.01) + 1.5, 0.5, 2.5); - - _vsumBuff = new CircularBuffer(10); - _avoltyBuff = new CircularBuffer(65); - _beta = 0.45 * (_period - 1) / (0.45 * (_period - 1) + 2); - - WarmupPeriod = (int)_period * 2; - Name = $"JMA({period})"; - } - - /// - /// Initializes the Jma instance by setting up the initial state. - /// - public override void Init() - { - base.Init(); - _upperBand = _lowerBand = 0.0; - _p_upperBand = _p_lowerBand = 0.0; - _len1 = Math.Max((Math.Log(Math.Sqrt(_period - 1)) / Math.Log(2.0)) + 2.0, 0); - _pow1 = Math.Max(_len1 - 2.0, 0.5); - _avoltyBuff.Clear(); - _vsumBuff.Clear(); - } - - /// - /// Manages the state of the Jma instance based on whether a new value is being processed. - /// - /// Indicates whether the current input is a new value. - protected override void ManageState(bool isNew) - { - if (isNew) - { - _index++; - _p_upperBand = _upperBand; - _p_lowerBand = _lowerBand; - _p_vSum = _vSum; - _p_prevMa1 = _prevMa1; - _p_prevDet0 = _prevDet0; - _p_prevDet1 = _prevDet1; - _p_prevJma = _prevJma; - } - else - { - _upperBand = _p_upperBand; - _lowerBand = _p_lowerBand; - _vSum = _p_vSum; - _prevMa1 = _p_prevMa1; - _prevDet0 = _p_prevDet0; - _prevDet1 = _p_prevDet1; - _prevJma = _p_prevJma; - } - } - - /// - /// Performs the Jma calculation for the current value. - /// - /// - /// The calculated Jma value for the current input. - /// - protected override double Calculation() - { - ManageState(Input.IsNew); - - double price = Input.Value; - if (_index == 1) - { - _upperBand = _lowerBand = price; - } - - double del1 = price - _upperBand; - double del2 = price - _lowerBand; - double volty = Math.Max(Math.Abs(del1), Math.Abs(del2)); - - _vsumBuff.Add(volty, Input.IsNew); - _vSum += (_vsumBuff[^1] - _vsumBuff[0]) / 10; - _avoltyBuff.Add(_vSum, Input.IsNew); - double avgvolty = _avoltyBuff.Average(); - - double rvolty = (avgvolty > 0) ? volty / avgvolty : 1; - rvolty = Math.Min(Math.Max(rvolty, 1.0), Math.Pow(_len1, 1.0 / _pow1)); - - double pow2 = Math.Pow(rvolty, _pow1); - double Kv = Math.Pow(_beta, Math.Sqrt(pow2)); - - _upperBand = (del1 >= 0) ? price : price - (Kv * del1); - _lowerBand = (del2 <= 0) ? price : price - (Kv * del2); - - - - - - - - double alpha = Math.Pow(_beta, pow2); - double ma1 = (1 - alpha) * Input.Value + alpha * _prevMa1; - _prevMa1 = ma1; - - double det0 = (price - ma1) * (1 - _beta) + _beta * _prevDet0; - _prevDet0 = det0; - double ma2 = ma1 + _phase * det0; - - double det1 = ((ma2 - _prevJma) * (1 - alpha) * (1 - alpha) ) + (alpha * alpha * _prevDet1); - _prevDet1 = det1; - double jma = _prevJma + det1; - _prevJma = jma; - - UpperBand = _upperBand; - LowerBand = _lowerBand; - Volty = volty; - - IsHot = _index >= WarmupPeriod; - return jma; - } -} - -#!csharp - -TSeries ma = Complex; -TSeries re = ComplexJMA; +TSeries ma = Spike; +TSeries re = SpikeJMA; TSeries out1 = new(); -Jmaxx calc = new(10); +Jma calc = new(period: 10, phase: 0, factor: 0.45); foreach (var value in ma) { out1.Add(calc.Calc(value)); } diff --git a/quantower/Averages/ZlemaIndicator.cs b/quantower/Averages/ZlemaIndicator.cs index a38b9c07..a6ffd28e 100644 --- a/quantower/Averages/ZlemaIndicator.cs +++ b/quantower/Averages/ZlemaIndicator.cs @@ -26,7 +26,7 @@ public class ZlemaIndicator : Indicator, IWatchlistIndicator public bool ShowColdValues { get; set; } = true; private Zlema? ma; - private Huberloss? err; + private Huber? err; protected LineSeries? Series; protected string? SourceName; public int MinHistoryDepths => Periods; diff --git a/quantower/Averages/_Averages.csproj b/quantower/Averages/_Averages.csproj index cadffce4..8d946a96 100644 --- a/quantower/Averages/_Averages.csproj +++ b/quantower/Averages/_Averages.csproj @@ -26,8 +26,10 @@ - - + + diff --git a/quantower/Statistics/_Statistics.csproj b/quantower/Statistics/_Statistics.csproj index 3f3ccd37..4904fae6 100644 --- a/quantower/Statistics/_Statistics.csproj +++ b/quantower/Statistics/_Statistics.csproj @@ -25,7 +25,8 @@ - + diff --git a/quantower/Volatility/HistoricalIndicator.cs b/quantower/Volatility/HistoricalIndicator.cs index 06ed5ec8..949b2dde 100644 --- a/quantower/Volatility/HistoricalIndicator.cs +++ b/quantower/Volatility/HistoricalIndicator.cs @@ -11,7 +11,7 @@ public class HistoricalIndicator : Indicator, IWatchlistIndicator [InputParameter("Annualized", sortIndex: 2)] public bool IsAnnualized { get; set; } = true; - private Historical? historical; + private Hv? historical; protected LineSeries? HvSeries; public int MinHistoryDepths => Periods; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; @@ -28,7 +28,7 @@ public class HistoricalIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - historical = new Historical(Periods, IsAnnualized); + historical = new(Periods, IsAnnualized); base.OnInit(); } diff --git a/quantower/Volatility/RealizedIndicator.cs b/quantower/Volatility/RealizedIndicator.cs index 126658c7..6625a71f 100644 --- a/quantower/Volatility/RealizedIndicator.cs +++ b/quantower/Volatility/RealizedIndicator.cs @@ -11,7 +11,7 @@ public class RealizedIndicator : Indicator, IWatchlistIndicator [InputParameter("Annualized", sortIndex: 2)] public bool IsAnnualized { get; set; } = true; - private Realized? realized; + private Rv? realized; protected LineSeries? RvSeries; public int MinHistoryDepths => Periods; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; @@ -28,7 +28,7 @@ public class RealizedIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - realized = new Realized(Periods, IsAnnualized); + realized = new(Periods, IsAnnualized); base.OnInit(); } diff --git a/quantower/Volatility/_Volatility.csproj b/quantower/Volatility/_Volatility.csproj index eabfa6b9..0a8f58d8 100644 --- a/quantower/Volatility/_Volatility.csproj +++ b/quantower/Volatility/_Volatility.csproj @@ -26,7 +26,8 @@ - +