From 4b25801d52a6e507cf670474bd7cd5388098fb24 Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Tue, 24 Sep 2024 16:28:16 -0700 Subject: [PATCH] Afirma + documentation --- docs/_sidebar.md | 24 +- docs/indicators/averages/afirma/afirma.md | 39 ++ docs/indicators/averages/afirma/charts.dib | 61 ++ docs/indicators/averages/afirma/charts.md | 3 + .../averages/afirma/img/AFIRMA10_B.svg | 330 ++++++++++ .../averages/afirma/img/AFIRMA10_Chirp.svg | 330 ++++++++++ .../averages/afirma/img/AFIRMA10_ChirpG.svg | 348 ++++++++++ .../averages/afirma/img/AFIRMA10_Complex.svg | 333 ++++++++++ .../averages/afirma/img/AFIRMA10_Gauss.svg | 327 ++++++++++ .../averages/afirma/img/AFIRMA10_HF.svg | 330 ++++++++++ .../averages/afirma/img/AFIRMA10_Impulse.svg | 338 ++++++++++ .../afirma/img/AFIRMA10_ImpulseHF.svg | 320 ++++++++++ .../averages/afirma/img/AFIRMA10_Market.svg | 357 +++++++++++ .../averages/afirma/img/AFIRMA10_Sawtooth.svg | 355 +++++++++++ .../afirma/img/AFIRMA10_SawtoothHF.svg | 332 ++++++++++ .../averages/afirma/img/AFIRMA10_Sine.svg | 330 ++++++++++ .../averages/afirma/img/AFIRMA10_SineG.svg | 346 ++++++++++ .../averages/afirma/img/AFIRMA10_Spike.svg | 338 ++++++++++ .../averages/afirma/img/AFIRMA10_Triangle.svg | 355 +++++++++++ .../averages/afirma/img/AFIRMA10_White.svg | 335 ++++++++++ docs/indicators/averages/alma/alma.md | 53 ++ docs/indicators/averages/alma/charts.dib | 6 +- .../indicators/averages/alma/img/ALMA10_B.svg | 12 +- .../averages/alma/img/ALMA10_Chirp.svg | 12 +- .../averages/alma/img/ALMA10_ChirpG.svg | 12 +- .../averages/alma/img/ALMA10_Complex.svg | 12 +- .../averages/alma/img/ALMA10_Gauss.svg | 12 +- .../averages/alma/img/ALMA10_HF.svg | 12 +- .../averages/alma/img/ALMA10_Impulse.svg | 12 +- .../averages/alma/img/ALMA10_ImpulseHF.svg | 12 +- .../averages/alma/img/ALMA10_Market.svg | 12 +- .../averages/alma/img/ALMA10_Sawtooth.svg | 12 +- .../averages/alma/img/ALMA10_SawtoothHF.svg | 12 +- .../averages/alma/img/ALMA10_Sine.svg | 12 +- .../averages/alma/img/ALMA10_SineG.svg | 12 +- .../averages/alma/img/ALMA10_Spike.svg | 12 +- .../averages/alma/img/ALMA10_Triangle.svg | 12 +- .../averages/alma/img/ALMA10_White.svg | 12 +- docs/indicators/averages/dema/dema.md | 59 ++ docs/indicators/averages/dsma/charts.dib | 7 +- docs/indicators/averages/dsma/dsma.md | 62 ++ .../indicators/averages/dsma/img/DSMA10_B.svg | 380 ++++++----- .../averages/dsma/img/DSMA10_Chirp.svg | 378 ++++++----- .../averages/dsma/img/DSMA10_ChirpG.svg | 399 ++++++------ .../averages/dsma/img/DSMA10_Complex.svg | 158 ++--- .../averages/dsma/img/DSMA10_Gauss.svg | 358 +++++------ .../averages/dsma/img/DSMA10_HF.svg | 357 ++++++----- .../averages/dsma/img/DSMA10_Impulse.svg | 401 ++++++------ .../averages/dsma/img/DSMA10_ImpulseHF.svg | 346 +++++----- .../averages/dsma/img/DSMA10_Market.svg | 158 ++--- .../averages/dsma/img/DSMA10_Sawtooth.svg | 593 +++++++++--------- .../averages/dsma/img/DSMA10_SawtoothHF.svg | 571 +++++++++-------- .../averages/dsma/img/DSMA10_Sine.svg | 158 ++--- .../averages/dsma/img/DSMA10_SineG.svg | 158 ++--- .../averages/dsma/img/DSMA10_Spike.svg | 581 ++++++++--------- .../averages/dsma/img/DSMA10_Triangle.svg | 396 ++++++------ .../averages/dsma/img/DSMA10_White.svg | 385 ++++++------ docs/indicators/indicators.md | 6 +- docs/readme.md | 9 +- docs/setup/quantower.md | 1 + lib/averages/Afirma.cs | 89 +++ lib/averages/Alma.cs | 5 - lib/averages/Dsma.cs | 20 +- lib/averages/Ema.cs | 5 - quantower/Averages/AfirmaIndicator.cs | 25 + quantower/Averages/DsmaIndicator.cs | 6 +- 66 files changed, 8792 insertions(+), 3061 deletions(-) create mode 100644 docs/indicators/averages/afirma/afirma.md create mode 100644 docs/indicators/averages/afirma/charts.dib create mode 100644 docs/indicators/averages/afirma/charts.md create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_B.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Chirp.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_ChirpG.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Complex.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Gauss.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_HF.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Impulse.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_ImpulseHF.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Market.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Sawtooth.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_SawtoothHF.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Sine.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_SineG.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Spike.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_Triangle.svg create mode 100644 docs/indicators/averages/afirma/img/AFIRMA10_White.svg create mode 100644 docs/indicators/averages/alma/alma.md create mode 100644 docs/indicators/averages/dema/dema.md create mode 100644 docs/indicators/averages/dsma/dsma.md create mode 100644 docs/setup/quantower.md create mode 100644 lib/averages/Afirma.cs create mode 100644 quantower/Averages/AfirmaIndicator.cs diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 24d3cd5f..2bdd1409 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,24 +1,20 @@ * [QuanTAlib](/) -* Library Structure - * Basic types - * Tvalue & TSeries - * TBar & TBarSeries - * Usage -* Using in Quantower * [Indicators](indicators/indicators.md) * Averages & Trends - * ALMA - Arnaud Legoux Moving Average - * [Charts](indicators/averages/alma/charts.md) - * DEMA - Double Exponential Moving Average - * [Charts](indicators/averages/dema/charts.md) - * DSMA - Deviation Scaled Moving Average - * [Charts](indicators/averages/dsma/charts.md) + * [AFIRMA - Adaptive Filtering Integrated Recursive Moving Average](indicators/averages/afirma/afirma.md) + * [AFIRMA Charts](indicators/averages/afirma/charts.md) + * [ALMA - Arnaud Legoux Moving Average](indicators/averages/alma/alma.md) + * [ALMA Charts](indicators/averages/alma/charts.md) + * [DEMA - Double Exponential Moving Average](indicators/averages/dema/dema.md) + * [DEMA Charts](indicators/averages/dema/charts.md) + * [DSMA - Deviation Scaled Moving Average](indicators/averages/dsma/dsma.md) + * [DSMA Charts](indicators/averages/dsma/charts.md) * DWMA - Double Weighted Moving Average - * [Charts](indicators/averages/dwma/charts.md) + * [DWMA Charts](indicators/averages/dwma/charts.md) * [EMA - Exponential Moving Average](indicators/averages/ema/ema.md) * [Calculation](indicators/averages/ema/calculation.md) * [Quality](indicators/averages/ema/quality.md) - * [Charts](indicators/averages/ema/charts.md) + * [EMA Charts](indicators/averages/ema/charts.md) * EPMA - Endpoint Moving Average * FRAMA - Fractal Adaptive Moving Average * FWMA - Fibonacci-Weighted Moving Average diff --git a/docs/indicators/averages/afirma/afirma.md b/docs/indicators/averages/afirma/afirma.md new file mode 100644 index 00000000..ec8a714e --- /dev/null +++ b/docs/indicators/averages/afirma/afirma.md @@ -0,0 +1,39 @@ +## AFIRMA: Adaptive Filtering Integrated Recursive Moving Average + +### Concept + +AFIRMA combines elements of simple moving averages (`SMA`) with adaptive filtering techniques from signal processing. It aims to provide a more responsive indicator that can quickly adjust to market changes while maintaining stability. + +### Origin + +AFIRMA (Adaptive Filtering Integrated Recursive Moving Average) was developed by Clive Bowsher and Roland Meeks in their 2008 paper titled "*The Dynamics of Economic Functions: Modeling and Forecasting the Yield Curve.*" It was created as an improvement over traditional moving averages, designed to adapt more quickly to changes in financial time series data. + +### Key Features + +1. **Adaptive Nature**: AFIRMA adjusts its behavior based on recent price movements, allowing it to respond more quickly to significant changes. +2. **Error-based Adaptation**: It uses the error between its last output and the current input to determine how much to adapt. +3. **Customizable Sensitivity**: The alpha parameter allows fine-tuning the indicator's responsiveness. + +### Usage + +1. **Trend Identification**: AFIRMA can help identify the start or end of trends more quickly than traditional moving averages. +2. **Signal Generation**: Traders may use crossovers of AFIRMA with price or other indicators to generate buy/sell signals. +3. **Dynamic Support/Resistance**: The AFIRMA line can act as a dynamic support or resistance level. +4. **Volatility Analysis**: The adaptive nature of AFIRMA can provide insights into market volatility. + +### Advantages + +- More responsive to market changes compared to traditional moving averages. +- Reduces lag typically associated with moving averages. +- Customizable through its `alpha` parameter to suit different market conditions or trading styles. + +### Considerations + +- **Adaptive Factor**: Alpha serves as the base adaptive factor. It has a range between 0.0 and 1.0 that determines how quickly the AFIRMA responds to changes in the input data. +- **Error Sensitivity**: Alpha is used in calculating the adaptive factor, which is based on the error between the current input and the last AFIRMA value. +- **Balancing Stability and Responsiveness**: A smaller alpha (closer to 0.0) makes the AFIRMA more stable but less responsive to recent changes. +A larger alpha (closer to 1) makes the AFIRMA more responsive to recent changes but potentially more volatile. +- **Fine-tuning the Indicator**: + - In trending markets, a higher alpha might be preferred to capture price movements more quickly. + - In ranging markets, a lower alpha might be better to reduce false signals from price noise. +- **Adaptive Nature**: The use of alpha allows AFIRMA to adapt its behavior based on recent price movements. When there are significant changes (large errors), the adaptive factor increases, allowing AFIRMA to adjust more quickly. \ No newline at end of file diff --git a/docs/indicators/averages/afirma/charts.dib b/docs/indicators/averages/afirma/charts.dib new file mode 100644 index 00000000..d1c8c640 --- /dev/null +++ b/docs/indicators/averages/afirma/charts.dib @@ -0,0 +1,61 @@ +#!meta + +{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} + +#!csharp + +#r "..\..\..\..\lib\obj\Debug\QuanTAlib.dll" + +#r "nuget: ScottPlot" + +using QuanTAlib; +using ScottPlot; +using Microsoft.DotNet.Interactive.Formatting; + +QuanTAlib.Formatters.Initialize(); +Formatter.Register(typeof(ScottPlot.Plot), (p, w) => + w.Write(((ScottPlot.Plot)p).GetSvgXml(600, 300)), HtmlFormatter.MimeType); + +#!csharp + +Dictionary Data = new Dictionary +{ + { "Spike", new double[] { 0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,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,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0 } }, + { "Impulse", new double[] { 0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,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,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 } }, + { "Triangle", new double[] { 0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2 } }, + { "Sawtooth", new double[] { 0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,33,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,0,0,0,0,0 } }, + { "Sine", new double[] { 0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0.39,0.56,0.72,0.84,0.93,0.99,1,0.97,0.91,0.81,0.68,0.52,0.33,0.14,-0.06,-0.26,-0.44,-0.61,-0.76,-0.87,-0.95,-0.99,-1,-0.96,-0.88,-0.77,-0.63,-0.46,-0.28,-0.08,0.12,0.31,0.49,0.66,0.79,0.9,0.97,1,0.99,0.94,0.85,0.73,0.58,0.41,0.22,0.02,-0.17,-0.37,-0.54,-0.7,-0.83,-0.92,-0.98,-1,-0.98,-0.92,-0.82,-0.69,-0.54,-0.36,-0.17,0.03,0.23,0.42,0.59,0.74 } }, + { "Chirp", new double[] { 0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0.93,0.27,-0.59,-1,-0.71,0.05,0.75,1,0.67,0,-0.67,-0.99,-0.85,-0.34,0.31,0.81,1,0.82,0.35,-0.22,-0.71,-0.98,-0.95,-0.66,-0.2,0.31,0.72,0.96,0.98,0.78,0.43,-0.01,-0.43,-0.77,-0.96,-0.99,-0.85,-0.58,-0.23,0.16,0.51,0.79,0.95,1,0.92,0.73,0.47,0.15,-0.17,-0.47,-0.72,-0.9,-0.99,-0.99,-0.9,-0.74,-0.52,-0.26,0.01,0.28,0.53,0.73,0.88,0.97,1,0.97 } }, + { "White", new double[] { -0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,0.03,-0.4,-0.47,0.19,-0.4,-0.23,0.31,0.41,0.19,0.16,-0.5,-0.31,-0.21,0.25,0.18,-0.48,-0.1,0.38,0.29,-0.38,-0.08,-0.21,0.34,0.01,-0.46,0.28,-0.48,0.11,0.02,-0.37,0.19,-0.2,0.1,0.24,0.08,-0.22,-0.12,0.15,0.36,-0.43,-0.03,-0.32,0.45,-0.5,-0.04,-0.04,-0.08,-0.18,0.13,-0.33,-0.19,0.36,-0.39,0.2,-0.31,0.28,-0.13,-0.07,-0.29,0.37,0.03,-0.25,-0.06,-0.3,-0.08,-0.09 } }, + { "Gauss", new double[] { -0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,0,0.03,0.11,-0.1,-0.43,-0.08,0.36,-0.04,-0.04,-0.21,-0.3,0.26,0.2,0.28,0.2,0.27,-0.01,-0.1,-0.23,-0.13,-0.41,-0.23,-0.07,-0.21,0.32,-0.18,-0.48,0.3,0.46,-0.2,0.52,-0.81,-0.25,-0.21,-0.12,-0.18,0.18,0.52,0.29,0.44,0.18,-1.2,0.38,0.24,0.06,0.28,0.34,0.3,-0.13,0.19,-0.5,0.59,-0.36,0.22,-0.23,0.24,0.39,0.13,-0.33,-0.57,-0.23,0.49,-0.13,0.76,0.59,0.61 } }, + { "B", new double[] { -0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0.4,-0.4,0,-0.28,0.41,-0.54,0.65,-0.75,0.84,-0.91,0.96,-0.99,1,-0.99,0.96,-0.92,0.85,-0.77,0.67,-0.56,0.44,-0.3,0.17,-0.03,-0.11,0.25,-0.39,0.51,-0.63,0.73,-0.82,0.89,-0.95,0.98,-1,0.99,-0.97,0.93,-0.86,0.78,-0.69,0.58,-0.46,0.33,-0.19,0.05,0.09,-0.23,0.36,-0.49,0.61,-0.71,0.81,-0.88,0.94,-0.98,1,-1,0.98,-0.94,0.88,-0.8,0.71,-0.6,0.48,-0.35,0.22,-0.08,-0.06 } }, + { "HF", new double[] { -0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,-0.6,0.6,0,0.14,-0.76,-0.96,-0.28,0.66,0.99,0.41,-0.54,-1,-0.54,0.42,0.99,0.65,-0.29,-0.96,-0.75,0.15,0.91,0.84,-0.01,-0.85,-0.91,-0.13,0.76,0.96,0.27,-0.66,-0.99,-0.4,0.55,1,0.53,-0.43,-0.99,-0.64,0.3,0.96,0.75,-0.16,-0.92,-0.83,0.02,0.85,0.9,0.12,-0.77,-0.95,-0.26,0.67,0.99,0.4,-0.56,-1,-0.52,0.44,0.99,0.64,-0.3,-0.97,-0.74,0.17,0.92,0.83,-0.03,-0.86 } }, + { "ImpulseHF", new double[] { -0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0,0,0.05,-0.25,-0.32,-0.09,0.22,0.33,0.14,-0.18,-0.33,-0.18,0.14,0.33,0.22,-0.1,-0.32,-0.25,0.05,0.3,0.28,0,-0.28,-0.3,-0.04,0.25,0.32,0.09,-0.22,-0.33,-0.13,0.18,0.33,0.18,0.86,0.67,0.79,1.1,1.32,1.25,0.95,0.69,0.72,1.01,1.28,1.3,1.04,0.74,0.68,0.91,1.22,1.33,1.13,0.81,0.67,0.83,1.15,1.33,1.21,0.9,0.68,0.75,1.06,1.31,1.28,0.99,0.71 } }, + { "SawtoothHF", new double[] { -0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0,0,2.7,-0.8,-0.8,3.6,9.3,11.95,10.05,6.3,5,8.3,14.1,17.95,17.25,13.55,11.2,13.25,18.75,23.55,24.2,20.95,17.75,18.45,23.35,28.8,30.8,28.35,24.7,24.05,28,33.75,37,35.65,31.85,28.05,-3.2,1.5,4.8,3.75,-0.8,-4.6,-4.15,0.1,4.25,4.5,0.6,-3.85,-4.75,-1.3,3.35,4.95,2,-2.8,-5,-2.6,2.2,4.95,3.2,-1.5,-4.85,-3.7,0.85,4.6,4.15,-0.15,-4.3} }, + { "SineG", new double[] { -0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0.2,-0.2,0,0,0.59,0.83,0.74,0.5,0.91,1.36,0.93,0.87,0.6,0.38,0.78,0.53,0.42,0.14,0.01,-0.45,-0.71,-0.99,-1,-1.36,-1.22,-1.07,-1.17,-0.56,-0.95,-1.11,-0.16,0.18,-0.28,0.64,-0.5,0.24,0.45,0.67,0.72,1.15,1.52,1.28,1.38,1.03,-0.47,0.96,0.65,0.28,0.3,0.17,-0.07,-0.67,-0.51,-1.33,-0.33,-1.34,-0.78,-1.21,-0.68,-0.43,-0.56,-0.87,-0.93,-0.4,0.52,0.1,1.18,1.18,1.35} }, + { "ChirpG", new double[] { 0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,0,0.01,1.3,0.3,-0.48,-1.1,-1.14,-0.03,1.11,0.96,0.63,-0.21,-0.97,-0.73,-0.65,-0.06,0.51,1.08,0.99,0.72,0.12,-0.35,-1.12,-1.21,-1.02,-0.87,0.12,0.13,0.24,1.26,1.44,0.58,0.95,-0.82,-0.68,-0.98,-1.08,-1.17,-0.67,-0.06,0.06,0.6,0.69,-0.41,1.33,1.24,0.98,1.01,0.81,0.45,-0.3,-0.28,-1.22,-0.31,-1.35,-0.77,-1.13,-0.5,-0.13,-0.13,-0.32,-0.29,0.3,1.22,0.75,1.73,1.59,1.58} }, + { "Complex", new double[] { 175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.1,175.6,175.44,176.27,176.04,176.99,175.49,175.68,174.34,176.4,174.05,174.4,174.2,176.16,175,177.72,174.33,176.96,174.62,174.76,170.9,171.12,171.05,170.01,169.24,172.64,171.96,175.72,174.16,175.81,177.3,178.38,176.75,177.19,175.55,178.49,176.52,178.45,178.04,178.25,177.8,176.97,172.94,174.92,173.98,172.29,171.19,172.54,172.11,175.32,175.63,176.65,173.8,176.04,172.74,175.24,171.84,171.54,172.17,171.85,172.38,170.78,173.49,173.69,171.71,174.38,173.99,174.83} }, + { "Market", new double[] { 68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,68.75,68.25,67.75,67.75,72.75,74.75,72.25,71.25,71.75,72.75,77.75,76,76,76,74.75,75.5,74.75,73.75,74,74.75,72.25,72.5,72.25,74.5,74.75,75.75,75.75,75.75,74.25,73.75,74.75,72,71.75,72.5,72.25,71,72,71.75,71.75,73.25,72.5,73.75,74,76.75,75.75,75,75.75,74.5,74.25,73.5,71.75,70.5,69,70.5,70,68.75,67.25,68.5,70.75,70,70.5,68.25,68.25,68.25,63.75,64.25} } + +}; + +#!csharp + +String Name = "AFIRMA"; +int p = 10; +double alpha = 0.5; +Func Indicator = period => new Afirma(period,alpha); + +foreach (var item in Data) { + string Signal = item.Key; + double[] Input = item.Value; + TSeries Output = new(); + var ma = Indicator(p); + foreach (var value in Input) { Output.Add(ma.Calc(value)); } + Plot plt = new(); + var p1a = plt.Add.Signal(Input[24..]); p1a.Color = ScottPlot.Colors.Red; p1a.LineWidth = 2; + var p1b = plt.Add.Signal(Output.v.ToArray()[24..]); p1b.Color = ScottPlot.Colors.Blue; p1b.LineWidth = 4; + plt.Title($"{Signal} - {Name}({p}, {alpha})"); + plt.Display(); + plt.SaveSvg($"img/{Name}{p}_{Signal}.svg", 450, 300); +} diff --git a/docs/indicators/averages/afirma/charts.md b/docs/indicators/averages/afirma/charts.md new file mode 100644 index 00000000..d3b95b46 --- /dev/null +++ b/docs/indicators/averages/afirma/charts.md @@ -0,0 +1,3 @@ +# AFIRMA Charts + +![](img/AFIRMA10_Spike.svg) ![](img/AFIRMA10_Impulse.svg) ![](img/AFIRMA10_Triangle.svg) ![](img/AFIRMA10_Sawtooth.svg) ![](img/AFIRMA10_Sine.svg) ![](img/AFIRMA10_Chirp.svg) ![](img/AFIRMA10_White.svg) ![](img/AFIRMA10_Gauss.svg) ![](img/AFIRMA10_B.svg) ![](img/AFIRMA10_HF.svg) ![](img/AFIRMA10_ImpulseHF.svg) ![](img/AFIRMA10_SawtoothHF.svg) ![](img/AFIRMA10_SineG.svg) ![](img/AFIRMA10_ChirpG.svg) ![](img/AFIRMA10_Complex.svg) ![](img/AFIRMA10_Market.svg) diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_B.svg b/docs/indicators/averages/afirma/img/AFIRMA10_B.svg new file mode 100644 index 00000000..08fbe8bf --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_B.svg @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + -0.5 + + + + 0 + + + + 0.5 + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + B - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Chirp.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Chirp.svg new file mode 100644 index 00000000..1c8e44c7 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Chirp.svg @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + -0.5 + + + + 0 + + + + 0.5 + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + Chirp - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_ChirpG.svg b/docs/indicators/averages/afirma/img/AFIRMA10_ChirpG.svg new file mode 100644 index 00000000..62dd210d --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_ChirpG.svg @@ -0,0 +1,348 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1.5 + + + + -1 + + + + -0.5 + + + + 0 + + + + 0.5 + + + + 1 + + + + 1.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ChirpG - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Complex.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Complex.svg new file mode 100644 index 00000000..ed8b1c42 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Complex.svg @@ -0,0 +1,333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 170 + + + + 172 + + + + 174 + + + + 176 + + + + 178 + + + + + + + + + + + + + + + + + + + + + + + + + + Complex - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Gauss.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Gauss.svg new file mode 100644 index 00000000..98190bd9 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Gauss.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + -0.5 + + + + 0 + + + + 0.5 + + + + + + + + + + + + + + + + + + + + + + + + Gauss - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_HF.svg b/docs/indicators/averages/afirma/img/AFIRMA10_HF.svg new file mode 100644 index 00000000..c2259c57 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_HF.svg @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + -0.5 + + + + 0 + + + + 0.5 + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + HF - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Impulse.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Impulse.svg new file mode 100644 index 00000000..45ddbb94 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Impulse.svg @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0.2 + + + + 0.4 + + + + 0.6 + + + + 0.8 + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + Impulse - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_ImpulseHF.svg b/docs/indicators/averages/afirma/img/AFIRMA10_ImpulseHF.svg new file mode 100644 index 00000000..4a5c8479 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_ImpulseHF.svg @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0.5 + + + + 1 + + + + + + + + + + + + + + + + + + + + + ImpulseHF - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Market.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Market.svg new file mode 100644 index 00000000..cf860443 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Market.svg @@ -0,0 +1,357 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 64 + + + + 66 + + + + 68 + + + + 70 + + + + 72 + + + + 74 + + + + 76 + + + + 78 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Market - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Sawtooth.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Sawtooth.svg new file mode 100644 index 00000000..ec5cadb8 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Sawtooth.svg @@ -0,0 +1,355 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sawtooth - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_SawtoothHF.svg b/docs/indicators/averages/afirma/img/AFIRMA10_SawtoothHF.svg new file mode 100644 index 00000000..392508d4 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_SawtoothHF.svg @@ -0,0 +1,332 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 10 + + + + 20 + + + + 30 + + + + 40 + + + + + + + + + + + + + + + + + + + + + + + + + SawtoothHF - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Sine.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Sine.svg new file mode 100644 index 00000000..5d391a00 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Sine.svg @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + -0.5 + + + + 0 + + + + 0.5 + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + Sine - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_SineG.svg b/docs/indicators/averages/afirma/img/AFIRMA10_SineG.svg new file mode 100644 index 00000000..4f8b6d2b --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_SineG.svg @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1.5 + + + + -1 + + + + -0.5 + + + + 0 + + + + 0.5 + + + + 1 + + + + 1.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SineG - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Spike.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Spike.svg new file mode 100644 index 00000000..ef3d9095 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Spike.svg @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0.2 + + + + 0.4 + + + + 0.6 + + + + 0.8 + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + Spike - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_Triangle.svg b/docs/indicators/averages/afirma/img/AFIRMA10_Triangle.svg new file mode 100644 index 00000000..f4fc099c --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_Triangle.svg @@ -0,0 +1,355 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Triangle - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/afirma/img/AFIRMA10_White.svg b/docs/indicators/averages/afirma/img/AFIRMA10_White.svg new file mode 100644 index 00000000..d23c6dd3 --- /dev/null +++ b/docs/indicators/averages/afirma/img/AFIRMA10_White.svg @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 5 + + + + 10 + + + + 15 + + + + 20 + + + + 25 + + + + 30 + + + + 35 + + + + 40 + + + + 45 + + + + 50 + + + + 55 + + + + 60 + + + + 65 + + + + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -0.4 + + + + -0.2 + + + + 0 + + + + 0.2 + + + + 0.4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + White - AFIRMA(10, 0.5) + + diff --git a/docs/indicators/averages/alma/alma.md b/docs/indicators/averages/alma/alma.md new file mode 100644 index 00000000..df1c80af --- /dev/null +++ b/docs/indicators/averages/alma/alma.md @@ -0,0 +1,53 @@ +## ALMA: Arnaud Legoux Moving Average + +### Concept + +ALMA is a moving average designed to reduce the lag of traditional moving averages while maintaining smoothness. It uses a Gaussian distribution to weight the price data, allowing for greater flexibility in balancing smoothness and responsiveness. + +### Origin + +ALMA was developed by *Arnaud Legoux and Dimitrios Kouzis-Loukas*, introduced in 2009. It was created to address the limitations of traditional moving averages, particularly the lag issue in trend identification and signal generation. + +### Key Features + +1. **Gaussian Distribution**: Uses a Gaussian (normal) distribution to weight price data, concentrating the most weight around a specific point. +2. **Offset Parameter**: Allows shifting the Gaussian distribution to the left or right, affecting the lag and responsiveness. +3. **Sigma Parameter**: Controls the width of the Gaussian distribution, affecting the smoothness of the average. +4. **Lag Reduction**: Designed to minimize lag while maintaining a smooth output. + +### Usage + +1. **Trend Identification**: ALMA can identify trends more quickly than traditional moving averages due to its reduced lag. +2. **Signal Generation**: Crossovers between ALMA and price, or between different ALMA settings, can generate trading signals. +3. **Support and Resistance**: ALMA can act as dynamic support and resistance levels. +4. **Smoothing Price Action**: Useful for smoothing noisy price data while preserving important trend information. + +### Advantages + +- Reduces lag compared to simple and exponential moving averages. +- Highly customizable through its offset and sigma parameters. +- Can be tuned to be more responsive or more smooth based on trading preferences. +- Potentially more effective in capturing short-term price movements. + +### Considerations + +- **Offset Parameter**: Ranges from 0 to 1, determining the distribution's center of weight. + - 0 results in a simple moving average (more lag, very smooth). + - 1 creates a weighted average focused on the most recent prices (less lag, less smooth). + - 0.85 is often used as a default, balancing lag reduction and smoothness. + +- **Sigma Parameter**: Controls the Gaussian distribution's width. + - Lower values create a narrower distribution, focusing on fewer price bars. + - Higher values create a wider distribution, incorporating more price bars. + - 6 is often used as a default value. + +- **Period**: As with other moving averages, determines how many price bars are included in the calculation. + +- **Balancing Responsiveness and Stability**: + - Adjusting offset and sigma allows fine-tuning between quick response to price changes and stability in noisy markets. + - Higher offset and lower sigma increase responsiveness but may lead to more false signals in volatile markets. + - Lower offset and higher sigma increase smoothness but may introduce more lag. + +- **Computational Complexity**: More complex to calculate than simple moving averages, which may be a consideration in high-frequency trading systems. + +- **Interpretation**: Due to its unique weighting system, ALMA may behave differently from traditional moving averages in certain market conditions, requiring careful interpretation. \ No newline at end of file diff --git a/docs/indicators/averages/alma/charts.dib b/docs/indicators/averages/alma/charts.dib index c40b915a..c43f9194 100644 --- a/docs/indicators/averages/alma/charts.dib +++ b/docs/indicators/averages/alma/charts.dib @@ -43,7 +43,9 @@ Dictionary Data = new Dictionary String Name = "ALMA"; int p = 10; -Func Indicator = period => new Alma(period); +double offset = 0.85; +double sigma = 6.0; +Func Indicator = period => new Alma(period, offset: offset, sigma: sigma); foreach (var item in Data) { string Signal = item.Key; @@ -54,7 +56,7 @@ foreach (var item in Data) { Plot plt = new(); var p1a = plt.Add.Signal(Input[24..]); p1a.Color = ScottPlot.Colors.Red; p1a.LineWidth = 2; var p1b = plt.Add.Signal(Output.v.ToArray()[24..]); p1b.Color = ScottPlot.Colors.Blue; p1b.LineWidth = 4; - plt.Title($"{Signal} - {Name}({p})"); + plt.Title($"{Signal} - {Name}({p}, {offset:F2}, {sigma:F2})"); plt.Display(); plt.SaveSvg($"img/{Name}{p}_{Signal}.svg", 450, 300); } diff --git a/docs/indicators/averages/alma/img/ALMA10_B.svg b/docs/indicators/averages/alma/img/ALMA10_B.svg index a00036ba..aa9eebf0 100644 --- a/docs/indicators/averages/alma/img/ALMA10_B.svg +++ b/docs/indicators/averages/alma/img/ALMA10_B.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -324,7 +324,7 @@ - - B - ALMA(10) + + B - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Chirp.svg b/docs/indicators/averages/alma/img/ALMA10_Chirp.svg index 3f24614b..6eb00d70 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Chirp.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Chirp.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -324,7 +324,7 @@ - - Chirp - ALMA(10) + + Chirp - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_ChirpG.svg b/docs/indicators/averages/alma/img/ALMA10_ChirpG.svg index 5b4d02cc..54c3e238 100644 --- a/docs/indicators/averages/alma/img/ALMA10_ChirpG.svg +++ b/docs/indicators/averages/alma/img/ALMA10_ChirpG.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -342,7 +342,7 @@ - - ChirpG - ALMA(10) + + ChirpG - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Complex.svg b/docs/indicators/averages/alma/img/ALMA10_Complex.svg index 9ff8437b..79a14269 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Complex.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Complex.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -327,7 +327,7 @@ - - Complex - ALMA(10) + + Complex - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Gauss.svg b/docs/indicators/averages/alma/img/ALMA10_Gauss.svg index 4ea44cb0..0a0bfca3 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Gauss.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Gauss.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -321,7 +321,7 @@ - - Gauss - ALMA(10) + + Gauss - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_HF.svg b/docs/indicators/averages/alma/img/ALMA10_HF.svg index d6c56a19..40dd1bc2 100644 --- a/docs/indicators/averages/alma/img/ALMA10_HF.svg +++ b/docs/indicators/averages/alma/img/ALMA10_HF.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -324,7 +324,7 @@ - - HF - ALMA(10) + + HF - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Impulse.svg b/docs/indicators/averages/alma/img/ALMA10_Impulse.svg index 371c60c0..6ad12bbb 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Impulse.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Impulse.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -332,7 +332,7 @@ - - Impulse - ALMA(10) + + Impulse - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_ImpulseHF.svg b/docs/indicators/averages/alma/img/ALMA10_ImpulseHF.svg index e83c7910..dabf368c 100644 --- a/docs/indicators/averages/alma/img/ALMA10_ImpulseHF.svg +++ b/docs/indicators/averages/alma/img/ALMA10_ImpulseHF.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -314,7 +314,7 @@ - - ImpulseHF - ALMA(10) + + ImpulseHF - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Market.svg b/docs/indicators/averages/alma/img/ALMA10_Market.svg index bf76c722..f73a1a92 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Market.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Market.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -351,7 +351,7 @@ - - Market - ALMA(10) + + Market - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Sawtooth.svg b/docs/indicators/averages/alma/img/ALMA10_Sawtooth.svg index 82fd1081..2639137f 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Sawtooth.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Sawtooth.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -349,7 +349,7 @@ - - Sawtooth - ALMA(10) + + Sawtooth - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_SawtoothHF.svg b/docs/indicators/averages/alma/img/ALMA10_SawtoothHF.svg index 8aa4cfab..7a2b2f8e 100644 --- a/docs/indicators/averages/alma/img/ALMA10_SawtoothHF.svg +++ b/docs/indicators/averages/alma/img/ALMA10_SawtoothHF.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -326,7 +326,7 @@ - - SawtoothHF - ALMA(10) + + SawtoothHF - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Sine.svg b/docs/indicators/averages/alma/img/ALMA10_Sine.svg index cf18eba2..77d36a43 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Sine.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Sine.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -324,7 +324,7 @@ - - Sine - ALMA(10) + + Sine - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_SineG.svg b/docs/indicators/averages/alma/img/ALMA10_SineG.svg index a3611953..625dbe46 100644 --- a/docs/indicators/averages/alma/img/ALMA10_SineG.svg +++ b/docs/indicators/averages/alma/img/ALMA10_SineG.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -340,7 +340,7 @@ - - SineG - ALMA(10) + + SineG - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Spike.svg b/docs/indicators/averages/alma/img/ALMA10_Spike.svg index 1398ef2a..56323b11 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Spike.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Spike.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -332,7 +332,7 @@ - - Spike - ALMA(10) + + Spike - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_Triangle.svg b/docs/indicators/averages/alma/img/ALMA10_Triangle.svg index 53a38259..691d7693 100644 --- a/docs/indicators/averages/alma/img/ALMA10_Triangle.svg +++ b/docs/indicators/averages/alma/img/ALMA10_Triangle.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -349,7 +349,7 @@ - - Triangle - ALMA(10) + + Triangle - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/alma/img/ALMA10_White.svg b/docs/indicators/averages/alma/img/ALMA10_White.svg index cba2d816..b1524b93 100644 --- a/docs/indicators/averages/alma/img/ALMA10_White.svg +++ b/docs/indicators/averages/alma/img/ALMA10_White.svg @@ -3,10 +3,10 @@ - + - + @@ -81,10 +81,10 @@ - + - + @@ -329,7 +329,7 @@ - - White - ALMA(10) + + White - ALMA(10, 0.85, 6.00) diff --git a/docs/indicators/averages/dema/dema.md b/docs/indicators/averages/dema/dema.md new file mode 100644 index 00000000..6d82fb2b --- /dev/null +++ b/docs/indicators/averages/dema/dema.md @@ -0,0 +1,59 @@ +## DEMA: Double Exponential Moving Average + +### Concept + +DEMA is an enhanced version of the Exponential Moving Average (EMA) designed to reduce lag while maintaining smoothness. It achieves this by calculating an EMA of an EMA and then using a formula to reduce the inherent lag - at the expense of overshooting the signal line. + +### Origin + +DEMA was developed by Patrick Mulloy and first introduced in the February 1994 issue of *Technical Analysis of Stocks & Commodities magazine*. It was created to address the lag issue in traditional moving averages, particularly in trend identification and signal generation. + +### Key Features + +1. **Double Smoothing**: Uses two EMAs in its calculation, providing a smoother output than a single EMA. +2. **Lag Reduction**: Employs a formula to reduce the lag typically associated with moving averages. +3. **Responsiveness**: More responsive to price changes than a standard EMA of the same period, at the expense of overshooting. +4. **Trend Sensitivity**: Better at capturing trends and reacting to reversals than traditional moving averages. + +### Usage + +1. **Trend Identification**: DEMA can identify trends more quickly than traditional moving averages due to its reduced lag. +2. **Signal Generation**: Crossovers between DEMA and price, or between different DEMA settings, can generate trading signals. +3. **Support and Resistance**: DEMA can act as dynamic support and resistance levels. +4. **Smoothing Price Action**: Useful for smoothing noisy price data while preserving important trend information. + +### Advantages + +- Reduces lag compared to simple and exponential moving averages. +- More responsive to price changes than traditional EMAs. +- Maintains smoothness despite increased responsiveness. +- Can be more effective in capturing short to medium-term price movements. +- Simple to understand conceptually, building on the familiar EMA. + +### Considerations + +- **Period**: As with other moving averages, determines how many price bars are included in the calculation. The period affects both EMAs used in the DEMA calculation. + +- **Calculation**: The formula for DEMA is: + DEMA = 2 * EMA(price) - EMA(EMA(price))
+ This formula effectively doubles the percentage of EMA weight applied to the most recent price. + +- **Sensitivity**: + - DEMA is more sensitive to price changes than a standard EMA of the same period. + - This increased sensitivity can lead to earlier signals but may also result in more false signals in choppy markets. + +- **Balancing Responsiveness and Stability**: + - Shorter periods increase responsiveness but may lead to more false signals in volatile markets. + - Longer periods increase smoothness but may introduce more lag. + +- **Comparison to Other MAs**: + - DEMA typically responds faster than EMA, SMA, or triangular MA of the same period. + - It may be less smooth than a triple exponential moving average (TEMA) but with less lag. + +- **Whipsaws**: Due to its responsiveness, DEMA may be prone to whipsaws in ranging or choppy markets. + +- **Multiple Time Frame Analysis**: Using DEMAs on different time frames can provide a more comprehensive view of trends and potential reversals. + +- **Computational Complexity**: Slightly more complex to calculate than simple or exponential moving averages, which may be a minor consideration in high-frequency trading systems. + +- **Interpretation**: While more responsive than traditional EMAs, traders should still be aware that DEMA is a lagging indicator by nature, and should be used in conjunction with other technical analysis tools for confirmation. \ No newline at end of file diff --git a/docs/indicators/averages/dsma/charts.dib b/docs/indicators/averages/dsma/charts.dib index 9cf4093b..b759e556 100644 --- a/docs/indicators/averages/dsma/charts.dib +++ b/docs/indicators/averages/dsma/charts.dib @@ -43,18 +43,19 @@ Dictionary Data = new Dictionary String Name = "DSMA"; int p = 10; -Func Indicator = period => new Dsma(period); +double scale = 0.5; +Func Indicator = (period, scale) => new Dsma(period, scale); foreach (var item in Data) { string Signal = item.Key; double[] Input = item.Value; TSeries Output = new(); - var ma = Indicator(p); + var ma = Indicator(p, scale); foreach (var value in Input) { Output.Add(ma.Calc(value)); } Plot plt = new(); var p1a = plt.Add.Signal(Input[24..]); p1a.Color = ScottPlot.Colors.Red; p1a.LineWidth = 2; var p1b = plt.Add.Signal(Output.v.ToArray()[24..]); p1b.Color = ScottPlot.Colors.Blue; p1b.LineWidth = 4; - plt.Title($"{Signal} - {Name}({p})"); + plt.Title($"{Signal} - {Name}({p}, {scale:F2})"); plt.Display(); plt.SaveSvg($"img/{Name}{p}_{Signal}.svg", 450, 300); } diff --git a/docs/indicators/averages/dsma/dsma.md b/docs/indicators/averages/dsma/dsma.md new file mode 100644 index 00000000..2a7446b9 --- /dev/null +++ b/docs/indicators/averages/dsma/dsma.md @@ -0,0 +1,62 @@ +## DSMA: Deviation Scaled Moving Average + +### Concept + +DSMA is an adaptive moving average that adjusts its responsiveness based on the volatility of the price action. It uses a scaling factor derived from the standard deviation of prices to modify the weight of the most recent price in the average calculation. + +### Origin + +DSMA was developed by Tushar Chande and appeared in his book "*Beyond Technical Analysis*" (1997). It was created to address the limitations of fixed-parameter moving averages by incorporating a measure of market volatility into the calculation. + +### Key Features + +1. **Volatility Adaptation**: Adjusts its behavior based on market volatility, becoming more responsive in volatile markets and more stable in quiet markets. +2. **Standard Deviation Scaling**: Uses the standard deviation of prices to scale the weight of the most recent price. +3. **Self-Adjusting**: Automatically adapts to changing market conditions without manual parameter adjustments. Overshooting is sharp but short. +4. **Lag Reduction**: Designed to reduce lag in volatile markets while maintaining smoothness in stable markets. + +### Usage + +1. **Trend Identification**: DSMA can identify trends more effectively than traditional moving averages, especially in markets with changing volatility. +2. **Signal Generation**: Crossovers between DSMA and price, or between different DSMA settings, can generate trading signals. +3. **Dynamic Support and Resistance**: The DSMA line can act as dynamic support and resistance levels that adapt to market volatility. +4. **Volatility Analysis**: The behavior of DSMA relative to price can provide insights into market volatility and potential trend changes. + +### Advantages + +- Adapts automatically to changes in market volatility. +- Reduces lag in volatile markets while maintaining smoothness in stable markets. +- Potentially more effective in capturing price movements across different market conditions. +- Eliminates the need for frequent manual adjustments of moving average parameters. + +### Considerations + +- **Period**: Determines the number of price bars used in both the moving average and standard deviation calculations. + +- **Scaling Factor**: The standard deviation is used to create a scaling factor that adjusts the weight of the most recent price. This factor is typically constrained within a range (e.g., 0.1 to 1.0) to prevent extreme values. + +- **Calculation**: The general form of the DSMA calculation is: + DSMA = α * Price + (1 - α) * Previous DSMA + Where α is determined by the scaling factor derived from the standard deviation. + +- **Sensitivity to Volatility Changes**: + - In high volatility periods, DSMA becomes more responsive, potentially providing earlier signals. + - In low volatility periods, DSMA becomes more smooth, potentially reducing false signals. + +- **Comparison to Fixed-Parameter MAs**: + - DSMA may outperform fixed-parameter moving averages in markets with varying volatility. + - It may provide a good balance between the responsiveness of shorter-term MAs and the stability of longer-term MAs. + +- **Whipsaws**: While DSMA adapts to volatility, it may still be subject to whipsaws, especially during periods of volatility transition. + +- **Computational Complexity**: More complex to calculate than simple moving averages due to the standard deviation calculation and scaling factor application. + +- **Interpretation**: + - The distance between price and DSMA can provide insights into market volatility and potential overbought/oversold conditions. + - Traders should be aware of how DSMA behaves in different volatility environments for effective interpretation. + +- **Parameter Optimization**: While DSMA is self-adjusting, the choice of period and any constraints on the scaling factor may still require optimization for specific trading strategies or markets. + +- **Multiple Time Frame Analysis**: Using DSMAs on different time frames can provide a more comprehensive view of trends and volatility across various time horizons. + +- **Complementary Indicators**: DSMA can be particularly effective when used in conjunction with other volatility-based indicators or oscillators for confirmation of signals. \ No newline at end of file diff --git a/docs/indicators/averages/dsma/img/DSMA10_B.svg b/docs/indicators/averages/dsma/img/DSMA10_B.svg index eee2d9e1..9b830e86 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_B.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_B.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,65 +284,47 @@ - - - -2 - - - - -1.5 - - - + + -1 - - + + -0.5 - - + + 0 - - + + 0.5 - - + + 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - B - DSMA(10) + + B - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Chirp.svg b/docs/indicators/averages/dsma/img/DSMA10_Chirp.svg index c8e17edd..ee006f26 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Chirp.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Chirp.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,63 +284,47 @@ - - - -1.5 - - - + + -1 - - + + -0.5 - - + + 0 - - + + 0.5 - - + + 1 - - - 1.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - Chirp - DSMA(10) + + Chirp - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_ChirpG.svg b/docs/indicators/averages/dsma/img/DSMA10_ChirpG.svg index 18a25285..8ef73fe9 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_ChirpG.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_ChirpG.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,74 +284,65 @@ - - + + -1.5 - - + + -1 - - + + -0.5 - - + + 0 - - + + 0.5 - - + + 1 - - + + 1.5 - - - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - ChirpG - DSMA(10) + + ChirpG - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Complex.svg b/docs/indicators/averages/dsma/img/DSMA10_Complex.svg index c008e8aa..3d5a2f97 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Complex.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Complex.svg @@ -3,10 +3,10 @@ - + - + @@ -81,83 +81,83 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -327,7 +327,7 @@ - - Complex - DSMA(10) + + Complex - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Gauss.svg b/docs/indicators/averages/dsma/img/DSMA10_Gauss.svg index ea3d8540..a71e42f0 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Gauss.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Gauss.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,44 +284,44 @@ - - + + -1 - - + + -0.5 - - + + 0 - - + + 0.5 - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - Gauss - DSMA(10) + + Gauss - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_HF.svg b/docs/indicators/averages/dsma/img/DSMA10_HF.svg index 9c80e8aa..971d3156 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_HF.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_HF.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,48 +284,47 @@ - - + + -1 - - + + -0.5 - - + + 0 - - + + 0.5 1 - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - HF - DSMA(10) + + HF - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Impulse.svg b/docs/indicators/averages/dsma/img/DSMA10_Impulse.svg index 61c61961..96a2a7cf 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Impulse.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Impulse.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,82 +284,55 @@ - - + + 0 - - + + 0.2 - - + + 0.4 - - + + 0.6 - - + + 0.8 - - + + 1 - - - 1.2 - - - - 1.4 - - - - 1.6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - Impulse - DSMA(10) + + Impulse - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_ImpulseHF.svg b/docs/indicators/averages/dsma/img/DSMA10_ImpulseHF.svg index c2828409..80130b8e 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_ImpulseHF.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_ImpulseHF.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,37 +284,37 @@ - - + + 0 - - + + 0.5 - - + + 1 - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - ImpulseHF - DSMA(10) + + ImpulseHF - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Market.svg b/docs/indicators/averages/dsma/img/DSMA10_Market.svg index fef0aecc..d8badc3b 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Market.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Market.svg @@ -3,10 +3,10 @@ - + - + @@ -81,83 +81,83 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -351,7 +351,7 @@ - - Market - DSMA(10) + + Market - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Sawtooth.svg b/docs/indicators/averages/dsma/img/DSMA10_Sawtooth.svg index 1536998b..f03cbb58 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Sawtooth.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Sawtooth.svg @@ -1,334 +1,355 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + 0 - - + + 5 - - + + 10 - - + + 15 - - + + 20 - - + + 25 - - + + 30 - - + + 35 - - + + 40 - - + + 45 - - + + 50 - - + + 55 - - + + 60 - - + + 65 - - + + 70 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 - - + + + 5 + + + 10 - - + + + 15 + + + 20 - - + + + 25 + + + 30 - - - - - - - - - - - - - - - - - - - - - - - + + + 35 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - Sawtooth - DSMA(10) + + Sawtooth - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_SawtoothHF.svg b/docs/indicators/averages/dsma/img/DSMA10_SawtoothHF.svg index 14fbfe97..3fe385c3 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_SawtoothHF.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_SawtoothHF.svg @@ -1,339 +1,332 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + 0 - - + + 5 - - + + 10 - - + + 15 - - + + 20 - - + + 25 - - + + 30 - - + + 35 - - + + 40 - - + + 45 - - + + 50 - - + + 55 - - + + 60 - - + + 65 - - + + 70 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 - - + + 10 - - + + 20 - - + + 30 - - + + 40 - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - SawtoothHF - DSMA(10) + + SawtoothHF - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Sine.svg b/docs/indicators/averages/dsma/img/DSMA10_Sine.svg index 26067db4..e24f46e1 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Sine.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Sine.svg @@ -3,10 +3,10 @@ - + - + @@ -81,83 +81,83 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -324,7 +324,7 @@ - - Sine - DSMA(10) + + Sine - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_SineG.svg b/docs/indicators/averages/dsma/img/DSMA10_SineG.svg index e9ff3415..0427fa08 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_SineG.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_SineG.svg @@ -3,10 +3,10 @@ - + - + @@ -81,83 +81,83 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -340,7 +340,7 @@ - - SineG - DSMA(10) + + SineG - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Spike.svg b/docs/indicators/averages/dsma/img/DSMA10_Spike.svg index 1961a6ae..8281c498 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Spike.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Spike.svg @@ -1,333 +1,338 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + 0 - - + + 5 - - + + 10 - - + + 15 - - + + 20 - - + + 25 - - + + 30 - - + + 35 - - + + 40 - - + + 45 - - + + 50 - - + + 55 - - + + 60 - - + + 65 - - + + 70 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0.5 - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 - - - 0.5 + + + 0.2 - - + + + 0.4 + + + + 0.6 + + + + 0.8 + + + 1 - - - 1.5 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - Spike - DSMA(10) + + Spike - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_Triangle.svg b/docs/indicators/averages/dsma/img/DSMA10_Triangle.svg index 8a4478a2..62a2cbe1 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_Triangle.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_Triangle.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,72 +284,72 @@ - - + + 0 - - + + 5 - - + + 10 - - + + 15 - - + + 20 - - + + 25 - - + + 30 - - + + 35 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - Triangle - DSMA(10) + + Triangle - DSMA(10, 0.50) diff --git a/docs/indicators/averages/dsma/img/DSMA10_White.svg b/docs/indicators/averages/dsma/img/DSMA10_White.svg index 4d5eaa7e..4b465bea 100644 --- a/docs/indicators/averages/dsma/img/DSMA10_White.svg +++ b/docs/indicators/averages/dsma/img/DSMA10_White.svg @@ -2,162 +2,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,65 +284,52 @@ - - - -0.8 - - - - -0.6 - - - + + -0.4 - - + + -0.2 - - + + 0 - - + + 0.2 - - + + 0.4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - White - DSMA(10) + + White - DSMA(10, 0.50) diff --git a/docs/indicators/indicators.md b/docs/indicators/indicators.md index dbe9e221..8de0cd95 100644 --- a/docs/indicators/indicators.md +++ b/docs/indicators/indicators.md @@ -14,12 +14,12 @@ |HLCC4 - Weighted Price|`️.HLCC4`||`WclPrice`|| |
|||| |**AVERAGES & TRENDS**|**QuanTALib**|Skender.Stock|TALib.NETCore|Tulip.NETCore|Trady| -|AFIRMA - Autoregressive Finite Impulse Response Moving Average||||| +|AFIRMA - Autoregressive Finite Impulse Response Moving Average|`✔️`|||| |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`](indicators/averages/ema/ema.md)|`⭐`|`⭐`|`⭐`|`⭐`| +|⭐EMA - Exponential Moving Average|`Ema`|`⭐`|`⭐`|`⭐`|`⭐`| |EPMA - Endpoint Moving Average|`Epma`|`✔️`||| |FRAMA - Fractal Adaptive Moving Average|`Frama`|||| |FWMA - Fibonacci Weighted Moving Average|`Fwma`|||| @@ -42,7 +42,7 @@ |QEMA - Quad Exponential Moving Average|`Qema`|||| |RMA - WildeR's Moving Average|`Rma`|||| |SINEMA - Sine Weighted Moving Average|`Sinema`|||| -|⭐SMA - Simple Moving Average|[`Sma`](indicators/averages/sma/sma.md)|`⭐`|`⭐`|`⭐`|`⭐`| +|⭐SMA - Simple Moving Average|`Sma`|`⭐`|`⭐`|`⭐`|`⭐`| |SMMA - Smoothed Moving Average|`Smma`|`✔️`||| |SSF - Ehler's Super Smoother Filter||||| |SUPERTREND - Supertrend||`✔️`||| diff --git a/docs/readme.md b/docs/readme.md index 2184218a..6364377f 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,6 +1,6 @@ # QuanTAlib - quantitative technical indicators for Quantower -## (and other C#-based trading platorms) +### (and other C#-based trading platorms) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=mihakralj_QuanTAlib&metric=ncloc)](https://sonarcloud.io/summary/overall?id=mihakralj_QuanTAlib) [![Codacy grade](https://img.shields.io/codacy/grade/b1f9109222234c87bce45f1fd4c63aee?style=flat-square)](https://app.codacy.com/gh/mihakralj/QuanTAlib/dashboard) @@ -22,6 +22,13 @@ - **Allow updates/corrections** of the last quote - QuanTAlib is re-calculating the last value as many times as required before continuing to the new bar - **Calculate early data right** - calculated data is as valid as mathematically possible from the first value onwards - no blackout or warming-up periods. All indicators return data from the first bar, alongside with a flag `isHot` - defining if calculation is already stable. +## Installation to Quantower + +- `` is the directory where Quantower is installed - where `Start.lnk` launcher is +- Copy `Averages.dll` from Releases to `\Settings\Scripts\Indicators\Averages\Averages.dll` +- Copy `Statistics.dll` from Releases to `\Settings\Scripts\Indicators\Statistics\Statistics.dll` +- Copy `SyntheticVendor.dll` from Releases to `\Settings\Scripts\Vendors\SyntheticVendor\SyntheticVendor.dll` + ![Alt text](./img/quotes.gif) QuanTAlib is intended for developers and users of Quantower, therefore it does not focus on privind sources of OHLCV quotes. There are some very basic data feeds available to use in the learning process: `GBM_Feed` for Random (Geometric Brownian Motion) data, and `SyntheticVendor` data generator for Quantower. diff --git a/docs/setup/quantower.md b/docs/setup/quantower.md new file mode 100644 index 00000000..d1068c9f --- /dev/null +++ b/docs/setup/quantower.md @@ -0,0 +1 @@ +# Setup \ No newline at end of file diff --git a/lib/averages/Afirma.cs b/lib/averages/Afirma.cs new file mode 100644 index 00000000..e2771a61 --- /dev/null +++ b/lib/averages/Afirma.cs @@ -0,0 +1,89 @@ +namespace QuanTAlib; + +public class Afirma : AbstractBase +{ + private readonly int Period; + private readonly CircularBuffer _buffer; + private readonly double _alpha; // Adaptive factor + private double _lastAfirma, _p_lastAfirma; + private double _lastError, _p_lastError; + + public Afirma(int period, double alpha = 0.1) + { + if (period < 1) + { + throw new ArgumentOutOfRangeException(nameof(period), "Period must be greater than or equal to 1."); + } + if (alpha <= 0 || alpha >= 1) + { + throw new ArgumentOutOfRangeException(nameof(alpha), "Alpha must be between 0 and 1 (exclusive)."); + } + Period = period; + WarmupPeriod = period; + _buffer = new CircularBuffer(period); + _alpha = alpha; + Name = "Afirma"; + WarmupPeriod = period; + Init(); + } + + public Afirma(object source, int period, double alpha = 0.1) : this(period: period, alpha: alpha) + { + var pubEvent = source.GetType().GetEvent("Pub"); + pubEvent?.AddEventHandler(source, new ValueSignal(Sub)); + } + + public override void Init() + { + base.Init(); + _lastAfirma = 0; + _lastError = 0; + } + + protected override void ManageState(bool isNew) + { + if (isNew) + { + _lastValidValue = Input.Value; + _index++; + _p_lastAfirma = _lastAfirma; + _p_lastError = _lastError; + } + else + { + _lastAfirma = _p_lastAfirma; + _lastError = _p_lastError; + } + } + + /// + /// Core AFIRMA calculation + /// + protected override double Calculation() + { + double result; + ManageState(IsNew); + _buffer.Add(Input.Value, Input.IsNew); + + if (_index < Period) + { + // Use simple average during warmup period + result = _buffer.Average(); + } + else + { + // AFIRMA calculation + double sma = _buffer.Average(); + double error = Input.Value - _lastAfirma; + double denominator = Math.Abs(error) + Math.Abs(_lastError); + double adaptiveFactor = denominator != 0 ? _alpha * Math.Abs(error) / denominator : _alpha; + result = sma + adaptiveFactor * (Input.Value - sma); + + _lastError = error; + } + + _lastAfirma = result; + IsHot = _index >= WarmupPeriod; + return result; + } +} \ No newline at end of file diff --git a/lib/averages/Alma.cs b/lib/averages/Alma.cs index 844351d6..9d34a7a9 100644 --- a/lib/averages/Alma.cs +++ b/lib/averages/Alma.cs @@ -8,11 +8,6 @@ namespace QuanTAlib; /// of the data in conjunction with smoothing to reduce noise. /// /// -/// Smoothness: ★★★★☆ (4/5) -/// Sensitivity: ★★★★☆ (4/5) -/// Overshooting: ★★★★☆ (4/5) -/// Lag: ★★★★★ (5/5) -/// /// Validation: /// Skender.Stock.Indicators /// diff --git a/lib/averages/Dsma.cs b/lib/averages/Dsma.cs index 50ed159c..18c0a765 100644 --- a/lib/averages/Dsma.cs +++ b/lib/averages/Dsma.cs @@ -6,11 +6,6 @@ namespace QuanTAlib; /// It aims to be more responsive during trending periods and more stable during ranging periods. /// /// -/// Smoothness: ★★★★☆ (4/5) -/// Sensitivity: ★★★★☆ (4/5) -/// Overshooting: ★★★★☆ (4/5) -/// Lag: ★★★★☆ (4/5) -/// /// The DSMA uses a SuperSmoother filter to reduce noise and a dynamic alpha calculation based on the /// scaled deviation of the input data. This allows it to adapt to changing market conditions. /// @@ -29,6 +24,7 @@ public class Dsma : AbstractBase private readonly int _period; private readonly CircularBuffer _buffer; private readonly double _c1, _c2, _c3; + private readonly double _scaleFactor; private double _lastDsma, _p_lastDsma; private double _filt, _filt1, _filt2, _zeros, _zeros1; private double _p_filt, _p_filt1, _p_filt2, _p_zeros, _p_zeros1; @@ -39,13 +35,18 @@ public class Dsma : AbstractBase /// /// The number of data points used in the DSMA calculation. /// Thrown when period is less than 1. - public Dsma(int period) + public Dsma(int period, double scaleFactor = 0.9) { if (period < 1) { throw new ArgumentOutOfRangeException(nameof(period), "Period must be greater than or equal to 1."); } + if (scaleFactor <= 0 || scaleFactor > 1) + { + throw new ArgumentOutOfRangeException(nameof(scaleFactor), "Scale factor must be between 0 and 1 (exclusive)."); + } _period = period; + _scaleFactor = scaleFactor; _buffer = new CircularBuffer(period); // SuperSmoother filter coefficients @@ -56,11 +57,11 @@ public class Dsma : AbstractBase _c1 = 1 - _c2 - _c3; Name = "Dsma"; - WarmupPeriod = period * 2; // A conservative estimate + WarmupPeriod = (int) (period * 1.5); // A conservative estimate Init(); } - public Dsma(object source, int period) : this(period) + public Dsma(object source, int period, double scaleFactor = 0.9) : this(period, scaleFactor) { var pubEvent = source.GetType().GetEvent("Pub"); pubEvent?.AddEventHandler(source, new ValueSignal(Sub)); @@ -127,7 +128,8 @@ public class Dsma : AbstractBase double scaledFilt = rms != 0 ? _filt / rms : 0; // Calculate adaptive alpha - double alpha = Math.Abs(scaledFilt) * 5 / _period; + double alpha = _scaleFactor * Math.Abs(scaledFilt) * 5 / _period; + alpha = Math.Max(0.1, Math.Min(1.0, alpha)); // DSMA calculation double dsma = alpha * Input.Value + (1 - alpha) * _lastDsma; diff --git a/lib/averages/Ema.cs b/lib/averages/Ema.cs index 9aa575d8..069d588f 100644 --- a/lib/averages/Ema.cs +++ b/lib/averages/Ema.cs @@ -6,11 +6,6 @@ namespace QuanTAlib; /// previous EMA value. The weight of the new datapoint (alpha) is alpha = 2 / (period + 1) /// /// -/// Smoothness: ★★★☆☆ (3/5) -/// Sensitivity: ★★★★☆ (4/5) -/// Overshooting: ★★★★★ (5/5) -/// Lag: ★★★☆☆ (3/5) -/// /// Key characteristics: /// - Uses no buffer, relying only on the previous EMA value. /// - The weight of new data points is calculated as alpha = 2 / (period + 1). diff --git a/quantower/Averages/AfirmaIndicator.cs b/quantower/Averages/AfirmaIndicator.cs new file mode 100644 index 00000000..b7fb250d --- /dev/null +++ b/quantower/Averages/AfirmaIndicator.cs @@ -0,0 +1,25 @@ +using TradingPlatform.BusinessLayer; +namespace QuanTAlib; + +public class AfirmaIndicator : IndicatorBase +{ + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 10; + + [InputParameter("Alpha", sortIndex: 2, 0.01, 0.99, 0.01, 2)] + public double Alpha { get; set; } = 0.1; + private Afirma? ma; + protected override AbstractBase QuanTAlib => ma!; + public override string ShortName => $"AFIRMA {Period} : {SourceName}"; + + public AfirmaIndicator() + { + Name = "AFIRMA - Adaptive Filtering Integrated Recursive Moving Average"; + Description = "Adaptive Filtering Integrated Recursive Moving Average"; + } + + protected override void InitIndicator() + { + ma = new Afirma(period: Period, alpha: Alpha); + } +} \ No newline at end of file diff --git a/quantower/Averages/DsmaIndicator.cs b/quantower/Averages/DsmaIndicator.cs index bdf43876..c301fce6 100644 --- a/quantower/Averages/DsmaIndicator.cs +++ b/quantower/Averages/DsmaIndicator.cs @@ -5,10 +5,12 @@ public class DsmaIndicator : IndicatorBase { [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] public int Period { get; set; } = 10; + [InputParameter("Scale factor", sortIndex: 2, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)] + public double Scale { get; set; } = 0.5; private Dsma? ma; protected override AbstractBase QuanTAlib => ma!; - public override string ShortName => $"DSMA {Period} : {SourceName}"; + public override string ShortName => $"DSMA {Period} : {Scale:F2} : {SourceName}"; public DsmaIndicator() { @@ -17,7 +19,7 @@ public class DsmaIndicator : IndicatorBase protected override void InitIndicator() { - ma = new Dsma(Period); + ma = new Dsma(Period, Scale); MinHistoryDepths = ma.WarmupPeriod; } }