diff --git a/.vscode/settings.json b/.vscode/settings.json index 2490a28f3..ce0ed61d8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -117,5 +117,44 @@ "Vwap", "Vwma", "Woodie" + ], + "cSpell.ignorePaths": [ + "package-lock.json", + "node_modules", + "vscode-extension", + ".git/objects", + ".vscode", + ".vscode-insiders", + "src", + "tests" + ], + "cSpell.enableFiletypes": [ + "!asciidoc", + "!c", + "!cpp", + "!csharp", + "!css", + "!elixir", + "!git-commit", + "!go", + "!graphql", + "!handlebars", + "!haskell", + "!jade", + "!java", + "!javascript", + "!javascriptreact", + "!jsonc", + "!latex", + "!less", + "!pug", + "!python", + "!restructuredtext", + "!rust", + "!scala", + "!swift", + "!typescript", + "!typescriptreact", + "!vue" ] } \ No newline at end of file diff --git a/docs/_indicators/Adl.md b/docs/_indicators/Adl.md index efe4d9581..23128cc7f 100644 --- a/docs/_indicators/Adl.md +++ b/docs/_indicators/Adl.md @@ -41,7 +41,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. ### AdlResult @@ -75,5 +75,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Adx.md b/docs/_indicators/Adx.md index 4426abdcd..8a5c2b5f9 100644 --- a/docs/_indicators/Adx.md +++ b/docs/_indicators/Adx.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `2×N-1` periods will have `null` values for `Adx` since there's not enough data to calculate. @@ -73,5 +73,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Alligator.md b/docs/_indicators/Alligator.md index 641d264f0..525fbccaf 100644 --- a/docs/_indicators/Alligator.md +++ b/docs/_indicators/Alligator.md @@ -42,7 +42,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `JP+JO` periods will have `null` values since there's not enough data to calculate. @@ -77,5 +77,3 @@ var results = quotes ``` Results **cannot** be further chained with additional transforms. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Alma.md b/docs/_indicators/Alma.md index f6b6fa347..abe8f8a1a 100644 --- a/docs/_indicators/Alma.md +++ b/docs/_indicators/Alma.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -77,5 +77,3 @@ var results = quotes .GetAlma(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Aroon.md b/docs/_indicators/Aroon.md index d39fc3db4..10df1489b 100644 --- a/docs/_indicators/Aroon.md +++ b/docs/_indicators/Aroon.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values for `Aroon` since there's not enough data to calculate. @@ -70,5 +70,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Atr.md b/docs/_indicators/Atr.md index 3b5ef3d69..b7a83bc1f 100644 --- a/docs/_indicators/Atr.md +++ b/docs/_indicators/Atr.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values for ATR since there's not enough data to calculate. @@ -72,5 +72,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Awesome.md b/docs/_indicators/Awesome.md index 8dd46bcb7..80609f417 100644 --- a/docs/_indicators/Awesome.md +++ b/docs/_indicators/Awesome.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first period `S-1` periods will have `null` values since there's not enough data to calculate. @@ -78,5 +78,3 @@ var results = quotes .GetAwesome(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/BasicQuote.md b/docs/_indicators/BasicQuote.md index e44df4690..023e0b598 100644 --- a/docs/_indicators/BasicQuote.md +++ b/docs/_indicators/BasicQuote.md @@ -36,7 +36,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. ### BasicData diff --git a/docs/_indicators/Beta.md b/docs/_indicators/Beta.md index e2e77f52a..66ba9e746 100644 --- a/docs/_indicators/Beta.md +++ b/docs/_indicators/Beta.md @@ -47,7 +47,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -92,8 +92,6 @@ var results = quotesEval .GetSlope(..); ``` -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. - ## Pro tips - Financial institutions often depict a single number for Beta on their sites. To get that same long-term Beta value, use 5 years of monthly bars for `quotes` and a value of 60 for `lookbackPeriods`. If you only have daily bars, use the [quotes.Aggregate(PeriodSize.Monthly)]({{site.baseurl}}/utilities#resize-quote-history) utility to convert it. diff --git a/docs/_indicators/BollingerBands.md b/docs/_indicators/BollingerBands.md index 896490a28..d88d63016 100644 --- a/docs/_indicators/BollingerBands.md +++ b/docs/_indicators/BollingerBands.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -81,5 +81,3 @@ var results = quotes .GetBollingerBands(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Bop.md b/docs/_indicators/Bop.md index 3904d133f..4332a1671 100644 --- a/docs/_indicators/Bop.md +++ b/docs/_indicators/Bop.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -69,5 +69,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Cci.md b/docs/_indicators/Cci.md index 5500df918..5ebfdce0e 100644 --- a/docs/_indicators/Cci.md +++ b/docs/_indicators/Cci.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -68,5 +68,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/ChaikinOsc.md b/docs/_indicators/ChaikinOsc.md index d294b59cf..fa708bdbc 100644 --- a/docs/_indicators/ChaikinOsc.md +++ b/docs/_indicators/ChaikinOsc.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `S-1` periods will have `null` values for `Oscillator` since there's not enough data to calculate. @@ -76,5 +76,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Chandelier.md b/docs/_indicators/Chandelier.md index d27c44279..080118172 100644 --- a/docs/_indicators/Chandelier.md +++ b/docs/_indicators/Chandelier.md @@ -46,7 +46,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods will have `null` Chandelier values since there's not enough data to calculate. @@ -77,5 +77,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Chop.md b/docs/_indicators/Chop.md index 013d2df9e..97e1fedee 100644 --- a/docs/_indicators/Chop.md +++ b/docs/_indicators/Chop.md @@ -36,7 +36,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods will have `null` values since there's not enough data to calculate. @@ -67,5 +67,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Cmf.md b/docs/_indicators/Cmf.md index 8cab0875c..582f3fd52 100644 --- a/docs/_indicators/Cmf.md +++ b/docs/_indicators/Cmf.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -72,5 +72,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/ConnorsRsi.md b/docs/_indicators/ConnorsRsi.md index 4a281c381..6029aa36f 100644 --- a/docs/_indicators/ConnorsRsi.md +++ b/docs/_indicators/ConnorsRsi.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `MAX(R,S,P)-1` periods will have `null` values since there's not enough data to calculate. @@ -82,5 +82,3 @@ var results = quotes .GetConnorsRsi(..) .GetSma(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Correlation.md b/docs/_indicators/Correlation.md index 640e2a3a4..cb60a1d92 100644 --- a/docs/_indicators/Correlation.md +++ b/docs/_indicators/Correlation.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -81,5 +81,3 @@ var results = quotes .GetCorrelation(..) .GetSlope(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Dema.md b/docs/_indicators/Dema.md index 877db373c..07ef85400 100644 --- a/docs/_indicators/Dema.md +++ b/docs/_indicators/Dema.md @@ -41,7 +41,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -81,5 +81,3 @@ var results = quotes .GetDema(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Doji.md b/docs/_indicators/Doji.md index fc1543698..e1a7c18ab 100644 --- a/docs/_indicators/Doji.md +++ b/docs/_indicators/Doji.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The candlestick pattern is indicated on dates where `Match` is `Match.Neutral`. - `Price` is `Close` price; however, all OHLCV elements are included in `CandleProperties`. diff --git a/docs/_indicators/Donchian.md b/docs/_indicators/Donchian.md index f496134fa..b6769fe72 100644 --- a/docs/_indicators/Donchian.md +++ b/docs/_indicators/Donchian.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods will have `null` values since there's not enough data to calculate. diff --git a/docs/_indicators/Dpo.md b/docs/_indicators/Dpo.md index 3d1e0f82e..1017057e7 100644 --- a/docs/_indicators/Dpo.md +++ b/docs/_indicators/Dpo.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N/2-2` and last `N/2+1` periods will be `null` since they cannot be calculated. @@ -75,5 +75,3 @@ var results = quotes .GetDpo(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/ElderRay.md b/docs/_indicators/ElderRay.md index 35c1d6456..3affbfd78 100644 --- a/docs/_indicators/ElderRay.md +++ b/docs/_indicators/ElderRay.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` indicator values since there's not enough data to calculate. @@ -73,5 +73,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Ema.md b/docs/_indicators/Ema.md index b3dba6614..06d7f128e 100644 --- a/docs/_indicators/Ema.md +++ b/docs/_indicators/Ema.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -79,5 +79,3 @@ var results = quotes .GetEma(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Epma.md b/docs/_indicators/Epma.md index f9e0e34cc..9f797e6ea 100644 --- a/docs/_indicators/Epma.md +++ b/docs/_indicators/Epma.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -76,5 +76,3 @@ var results = quotes .GetEpma(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Fcb.md b/docs/_indicators/Fcb.md index 5ef408745..63d0b3b33 100644 --- a/docs/_indicators/Fcb.md +++ b/docs/_indicators/Fcb.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The periods before the first fractal are `null` since they cannot be calculated. diff --git a/docs/_indicators/FisherTransform.md b/docs/_indicators/FisherTransform.md index ddfe01fc2..7c5f27cff 100644 --- a/docs/_indicators/FisherTransform.md +++ b/docs/_indicators/FisherTransform.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. :hourglass: **Convergence Warning**: The first `N+15` warmup periods will have unusable decreasing magnitude, convergence-related precision errors that can be as high as ~25% deviation in earlier indicator values. @@ -83,5 +83,3 @@ var results = quotes .GetFisherTransform(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/ForceIndex.md b/docs/_indicators/ForceIndex.md index f41c23e2a..a8aead050 100644 --- a/docs/_indicators/ForceIndex.md +++ b/docs/_indicators/ForceIndex.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods for will be `null` since they cannot be calculated. @@ -70,5 +70,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Fractal.md b/docs/_indicators/Fractal.md index cd1d77405..cde54b6c6 100644 --- a/docs/_indicators/Fractal.md +++ b/docs/_indicators/Fractal.md @@ -47,7 +47,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first and last `S` periods in `quotes` are unable to be calculated since there's not enough prior/following data. diff --git a/docs/_indicators/Gator.md b/docs/_indicators/Gator.md index 116c2349f..8efd2e7cb 100644 --- a/docs/_indicators/Gator.md +++ b/docs/_indicators/Gator.md @@ -36,7 +36,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first 10-20 periods will have `null` values since there's not enough data to calculate. @@ -72,5 +72,3 @@ var results = quotes ``` Results **cannot** be further chained with additional transforms. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/HeikinAshi.md b/docs/_indicators/HeikinAshi.md index b04df6de1..ef6a0c9a4 100644 --- a/docs/_indicators/HeikinAshi.md +++ b/docs/_indicators/HeikinAshi.md @@ -33,7 +33,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first period will have `null` values since there's not enough data to calculate. - `HeikinAshiResult` is based on `IQuote`, so it can be used as a direct replacement for `quotes`. @@ -68,5 +68,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Hma.md b/docs/_indicators/Hma.md index ee8133fa9..7c9b6f3da 100644 --- a/docs/_indicators/Hma.md +++ b/docs/_indicators/Hma.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N+(integer of SQRT(N))-1` periods will have `null` values since there's not enough data to calculate. @@ -75,5 +75,3 @@ var results = quotes .GetHma(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/HtTrendline.md b/docs/_indicators/HtTrendline.md index e217dbb71..d05f50f79 100644 --- a/docs/_indicators/HtTrendline.md +++ b/docs/_indicators/HtTrendline.md @@ -31,7 +31,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `6` periods will have `null` values for `SmoothPrice` since there's not enough data to calculate. @@ -72,5 +72,3 @@ var results = quotes .GetHtTrendline(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Hurst.md b/docs/_indicators/Hurst.md index 8d6e266f2..a544692d9 100644 --- a/docs/_indicators/Hurst.md +++ b/docs/_indicators/Hurst.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods will have `null` values since there's not enough data to calculate. @@ -76,5 +76,3 @@ var results = quotes .GetHurst(..) .GetSlope(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Ichimoku.md b/docs/_indicators/Ichimoku.md index e511b94be..baab8fc09 100644 --- a/docs/_indicators/Ichimoku.md +++ b/docs/_indicators/Ichimoku.md @@ -53,7 +53,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `T-1`, `K-1`, and `S-1` periods will have various `null` values since there's not enough data to calculate. Custom offset periods may also increase `null` results for warmup periods. diff --git a/docs/_indicators/Kama.md b/docs/_indicators/Kama.md index e2f8223a1..2c0a5b462 100644 --- a/docs/_indicators/Kama.md +++ b/docs/_indicators/Kama.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `E-1` periods will have `null` values since there's not enough data to calculate. @@ -82,5 +82,3 @@ var results = quotes .GetKama(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Keltner.md b/docs/_indicators/Keltner.md index 0c0960bfa..d48426d0b 100644 --- a/docs/_indicators/Keltner.md +++ b/docs/_indicators/Keltner.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. diff --git a/docs/_indicators/Kvo.md b/docs/_indicators/Kvo.md index ea456b373..ac07c5d23 100644 --- a/docs/_indicators/Kvo.md +++ b/docs/_indicators/Kvo.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `L+1` periods will have `null` values since there's not enough data to calculate. @@ -73,5 +73,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/MaEnvelopes.md b/docs/_indicators/MaEnvelopes.md index 745c355dc..9f5655463 100644 --- a/docs/_indicators/MaEnvelopes.md +++ b/docs/_indicators/MaEnvelopes.md @@ -57,7 +57,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first periods will have `null` values since there's not enough data to calculate; the quantity will vary based on the `movingAverageType` specified. @@ -93,5 +93,3 @@ var results = quotes ``` Results **cannot** be further chained with additional transforms. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Macd.md b/docs/_indicators/Macd.md index effeb7628..1d2866791 100644 --- a/docs/_indicators/Macd.md +++ b/docs/_indicators/Macd.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `S-1` slow periods will have `null` values since there's not enough data to calculate. @@ -83,5 +83,3 @@ var results = quotes .GetMacd(..) .GetSlope(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Mama.md b/docs/_indicators/Mama.md index ab7fcc259..44b1af8ee 100644 --- a/docs/_indicators/Mama.md +++ b/docs/_indicators/Mama.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `5` periods will have `null` values for `Mama` since there's not enough data to calculate. @@ -79,5 +79,3 @@ var results = quotes .GetMama(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Marubozu.md b/docs/_indicators/Marubozu.md index 385d5812c..04e92db60 100644 --- a/docs/_indicators/Marubozu.md +++ b/docs/_indicators/Marubozu.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The candlestick pattern is indicated on dates where `Match` is `Match.BullSignal` or `Match.BearSignal`. - `Price` is `Close` price; however, all OHLCV elements are included in `CandleProperties`. diff --git a/docs/_indicators/Mfi.md b/docs/_indicators/Mfi.md index 3ae24b4ee..4d008f19e 100644 --- a/docs/_indicators/Mfi.md +++ b/docs/_indicators/Mfi.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods will have `null` MFI values since they cannot be calculated. @@ -68,5 +68,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Obv.md b/docs/_indicators/Obv.md index 5ab67f98a..7132a8095 100644 --- a/docs/_indicators/Obv.md +++ b/docs/_indicators/Obv.md @@ -41,7 +41,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first period OBV will have `0` value since there's not enough data to calculate. @@ -74,5 +74,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/ParabolicSar.md b/docs/_indicators/ParabolicSar.md index 429604741..8000ce520 100644 --- a/docs/_indicators/ParabolicSar.md +++ b/docs/_indicators/ParabolicSar.md @@ -43,7 +43,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first trend will have `null` values since it is not accurate and based on an initial guess. @@ -75,5 +75,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/PivotPoints.md b/docs/_indicators/PivotPoints.md index da4da9eaa..f46e179ad 100644 --- a/docs/_indicators/PivotPoints.md +++ b/docs/_indicators/PivotPoints.md @@ -58,7 +58,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first window will have `null` values since there's not enough data to calculate. diff --git a/docs/_indicators/Pivots.md b/docs/_indicators/Pivots.md index 2541a55e6..41da7f41a 100644 --- a/docs/_indicators/Pivots.md +++ b/docs/_indicators/Pivots.md @@ -49,7 +49,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `L` and last `R` periods in `quotes` are unable to be calculated since there's not enough prior/following data. diff --git a/docs/_indicators/Pmo.md b/docs/_indicators/Pmo.md index dbe311779..2ed519987 100644 --- a/docs/_indicators/Pmo.md +++ b/docs/_indicators/Pmo.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `T+S-1` periods will have `null` values for PMO since there's not enough data to calculate. @@ -80,5 +80,3 @@ var results = quotes .GetPmo(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Prs.md b/docs/_indicators/Prs.md index a193858db..17557699b 100644 --- a/docs/_indicators/Prs.md +++ b/docs/_indicators/Prs.md @@ -43,7 +43,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The `N` periods will have `null` values for `PrsPercent` and the first `S-1` periods will have `null` values for `Sma` since there's not enough data to calculate. @@ -82,5 +82,3 @@ var results = quotesEval .GetPrs(quotesBase, ..) .GetSlope(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Pvo.md b/docs/_indicators/Pvo.md index 855550fed..144f65256 100644 --- a/docs/_indicators/Pvo.md +++ b/docs/_indicators/Pvo.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `S-1` slow periods will have `null` values since there's not enough data to calculate. @@ -74,5 +74,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Renko.md b/docs/_indicators/Renko.md index 35d812d34..058a9d580 100644 --- a/docs/_indicators/Renko.md +++ b/docs/_indicators/Renko.md @@ -114,7 +114,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. :paintbrush: **Repaint Warning**: When using the `GetRenkoAtr()` variant, the last [Average True Range (ATR)]({{site.baseurl}}/indicators/Atr/#content) value is used to set `brickSize`. Since the ATR changes over time, historical bricks will be repainted as new periods are added or updated in `quotes`. diff --git a/docs/_indicators/Roc.md b/docs/_indicators/Roc.md index e86475127..ae11d4b67 100644 --- a/docs/_indicators/Roc.md +++ b/docs/_indicators/Roc.md @@ -43,7 +43,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods will have `null` values for ROC since there's not enough data to calculate. @@ -82,5 +82,3 @@ var results = quotes .GetRoc(..) .GetEma(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/RocWb.md b/docs/_indicators/RocWb.md index 3a81e99b0..57bbe6ca7 100644 --- a/docs/_indicators/RocWb.md +++ b/docs/_indicators/RocWb.md @@ -40,7 +40,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods will have `null` values for ROC since there's not enough data to calculate. @@ -81,5 +81,3 @@ var results = quotes .GetRocWb(..) .GetEma(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/RollingPivots.md b/docs/_indicators/RollingPivots.md index d921d9c78..5b2ff0071 100644 --- a/docs/_indicators/RollingPivots.md +++ b/docs/_indicators/RollingPivots.md @@ -51,7 +51,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `W+F-1` periods will have `null` values since there's not enough data to calculate. diff --git a/docs/_indicators/Rsi.md b/docs/_indicators/Rsi.md index a315cd68b..6e60efdb1 100644 --- a/docs/_indicators/Rsi.md +++ b/docs/_indicators/Rsi.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -77,5 +77,3 @@ var results = quotes .GetRsi(..) .GetSlope(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Slope.md b/docs/_indicators/Slope.md index 26936e7ff..987f38fc3 100644 --- a/docs/_indicators/Slope.md +++ b/docs/_indicators/Slope.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values for `Slope` since there's not enough data to calculate. @@ -82,5 +82,3 @@ var results = quotes .GetSlope(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Sma.md b/docs/_indicators/Sma.md index ba20c5aa9..2956c8a90 100644 --- a/docs/_indicators/Sma.md +++ b/docs/_indicators/Sma.md @@ -40,7 +40,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -98,5 +98,3 @@ var results = quotes .GetSma(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Smi.md b/docs/_indicators/Smi.md index 61559e405..876e4c83e 100644 --- a/docs/_indicators/Smi.md +++ b/docs/_indicators/Smi.md @@ -41,7 +41,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` SMI values since there's not enough data to calculate. @@ -75,5 +75,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Smma.md b/docs/_indicators/Smma.md index ac9522175..360372e82 100644 --- a/docs/_indicators/Smma.md +++ b/docs/_indicators/Smma.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -78,5 +78,3 @@ var results = quotes .GetSmma(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/StarcBands.md b/docs/_indicators/StarcBands.md index 5e8f9d24b..40174b0d3 100644 --- a/docs/_indicators/StarcBands.md +++ b/docs/_indicators/StarcBands.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate, where `N` is the greater of `S` or `A`. diff --git a/docs/_indicators/Stc.md b/docs/_indicators/Stc.md index a68acb654..b77e6b7a1 100644 --- a/docs/_indicators/Stc.md +++ b/docs/_indicators/Stc.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `S+C` slow periods will have `null` values since there's not enough data to calculate. @@ -79,5 +79,3 @@ var results = quotes .GetStc(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/StdDev.md b/docs/_indicators/StdDev.md index 228cf9d21..73343cc75 100644 --- a/docs/_indicators/StdDev.md +++ b/docs/_indicators/StdDev.md @@ -43,7 +43,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -84,5 +84,3 @@ var results = quotes .GetStdDev(..) .GetSlope(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/StdDevChannels.md b/docs/_indicators/StdDevChannels.md index 75c66940d..9df4ecb61 100644 --- a/docs/_indicators/StdDevChannels.md +++ b/docs/_indicators/StdDevChannels.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - Up to `N-1` periods will have `null` values since there's not enough data to calculate. @@ -80,5 +80,3 @@ var results = quotesEval ``` Results **cannot** be further chained with additional transforms. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Stoch.md b/docs/_indicators/Stoch.md index 558ee3cc3..82555ab19 100644 --- a/docs/_indicators/Stoch.md +++ b/docs/_indicators/Stoch.md @@ -59,7 +59,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N+S-2` periods will have `null` Oscillator values since there's not enough data to calculate. @@ -96,5 +96,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/StochRsi.md b/docs/_indicators/StochRsi.md index 57aa1be82..7e4ab8bfa 100644 --- a/docs/_indicators/StochRsi.md +++ b/docs/_indicators/StochRsi.md @@ -42,7 +42,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `R+S+M` periods will have `null` values for `StochRsi` since there's not enough data to calculate. @@ -76,5 +76,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/SuperTrend.md b/docs/_indicators/SuperTrend.md index fd6d5fb47..84552eff0 100644 --- a/docs/_indicators/SuperTrend.md +++ b/docs/_indicators/SuperTrend.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` SuperTrend values since there's not enough data to calculate. diff --git a/docs/_indicators/T3.md b/docs/_indicators/T3.md index a8adb1b05..171d53ac5 100644 --- a/docs/_indicators/T3.md +++ b/docs/_indicators/T3.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `6×(N-1)` periods will have `null` values since there's not enough data to calculate. @@ -78,5 +78,3 @@ var results = quotes .GetT3(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Tema.md b/docs/_indicators/Tema.md index c74bd4710..02cb315e2 100644 --- a/docs/_indicators/Tema.md +++ b/docs/_indicators/Tema.md @@ -42,7 +42,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. Also note that we are using the proper [weighted variant](https://en.wikipedia.org/wiki/Triple_exponential_moving_average) for TEMA. If you prefer the unweighted raw 3 EMAs value, please use the `Ema3` output from the [TRIX]({{site.baseurl}}/indicators/Trix#content) oscillator instead. @@ -82,5 +82,3 @@ var results = quotes .GetTema(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Trix.md b/docs/_indicators/Trix.md index 4cc70d5a7..73f31ca67 100644 --- a/docs/_indicators/Trix.md +++ b/docs/_indicators/Trix.md @@ -42,7 +42,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `3×N-3` periods will have `null` values since there's not enough data to calculate. @@ -84,5 +84,3 @@ var results = quotes .GetTrix(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Tsi.md b/docs/_indicators/Tsi.md index 73aeb8cd0..ffec3ffc0 100644 --- a/docs/_indicators/Tsi.md +++ b/docs/_indicators/Tsi.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N+M-1` periods will have `null` values since there's not enough data to calculate. - `Signal` will be `null` for all periods if `signalPeriods=0`. @@ -81,5 +81,3 @@ var results = quotes .GetTsi(..) .GetSlope(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/UlcerIndex.md b/docs/_indicators/UlcerIndex.md index 69a1711a6..933e488da 100644 --- a/docs/_indicators/UlcerIndex.md +++ b/docs/_indicators/UlcerIndex.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -75,5 +75,3 @@ var results = quotes .GetAlma(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Ultimate.md b/docs/_indicators/Ultimate.md index 9116e4719..0acb2726c 100644 --- a/docs/_indicators/Ultimate.md +++ b/docs/_indicators/Ultimate.md @@ -39,7 +39,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `L-1` periods will have `null` Ultimate values since there's not enough data to calculate. @@ -70,5 +70,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/VolatilityStop.md b/docs/_indicators/VolatilityStop.md index 4ce0ed4af..e4ce2109a 100644 --- a/docs/_indicators/VolatilityStop.md +++ b/docs/_indicators/VolatilityStop.md @@ -38,7 +38,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first trend will have `null` values since it is not accurate and based on an initial guess. @@ -76,5 +76,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Vortex.md b/docs/_indicators/Vortex.md index 6de202f3d..df0c2a61b 100644 --- a/docs/_indicators/Vortex.md +++ b/docs/_indicators/Vortex.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N` periods will have `null` values for VI since there's not enough data to calculate. diff --git a/docs/_indicators/Vwap.md b/docs/_indicators/Vwap.md index b58a407b3..f6dc21a24 100644 --- a/docs/_indicators/Vwap.md +++ b/docs/_indicators/Vwap.md @@ -41,7 +41,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first period or the `startDate` will have a `Vwap = Close` value since it is the initial starting point. - `Vwap` values before `startDate`, if specified, will be `null`. @@ -73,5 +73,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Vwma.md b/docs/_indicators/Vwma.md index 1008ce84d..0ee2435b3 100644 --- a/docs/_indicators/Vwma.md +++ b/docs/_indicators/Vwma.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values for `Vwma` since there's not enough data to calculate. @@ -68,5 +68,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/WilliamsR.md b/docs/_indicators/WilliamsR.md index bc46c6e28..17015b060 100644 --- a/docs/_indicators/WilliamsR.md +++ b/docs/_indicators/WilliamsR.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` Oscillator values since there's not enough data to calculate. @@ -68,5 +68,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/Wma.md b/docs/_indicators/Wma.md index 3dfa81852..c2336e2cf 100644 --- a/docs/_indicators/Wma.md +++ b/docs/_indicators/Wma.md @@ -37,7 +37,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - The first `N-1` periods will have `null` values since there's not enough data to calculate. @@ -75,5 +75,3 @@ var results = quotes .GetWma(..) .GetRsi(..); ``` - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/_indicators/ZigZag.md b/docs/_indicators/ZigZag.md index 56d06e21b..eb06364f5 100644 --- a/docs/_indicators/ZigZag.md +++ b/docs/_indicators/ZigZag.md @@ -45,7 +45,7 @@ IEnumerable ``` - This method returns a time series of all available indicator values for the `quotes` provided. -- It always returns the same number of elements as there are in the historical quotes when not chained from another indicator. +- It always returns the same number of elements as there are in the historical quotes. - It does not return a single incremental indicator value. - If you do not supply enough points to cover the percent change, there will be no Zig Zag points or lines. - The first line segment starts after the first confirmed point; ZigZag values before the first confirmed point will be `null`. @@ -84,5 +84,3 @@ var results = quotes ``` This indicator must be generated from `quotes` and **cannot** be generated from results of another chain-enabled indicator or method. - -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. diff --git a/docs/guide.md b/docs/guide.md index f66d491ec..8a4b4a291 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -227,8 +227,6 @@ IEnumerable obvResults = quotes.GetObv(); IEnumerable rsiOfObv = obvResults.GetRsi(14); ``` -:warning: **Warning:** fewer results are returned from chained indicators because unusable warmup period `null` values are removed. - ## Candlestick patterns [Candlestick Patterns]({{site.baseurl}}/indicators/#candlestick-pattern) are a unique form of indicator and have a common output model. diff --git a/docs/utilities.md b/docs/utilities.md index 0c83e83c5..0bc444c24 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -19,7 +19,7 @@ redirect_from: `quotes.Use()` can be used before most indicator calls to specify price element to analyze. It cannot be used for indicators that require the full OHLCV quote profile. ```csharp -// example: use HL2 price instead of +// example: use HL2 price instead of // the standard Close price for RSI var results = quotes .Use(CandlePart.HL2) @@ -113,7 +113,7 @@ See [individual indicator pages]({{site.baseurl}}/indicators/#content) for infor :warning: Note: `.RemoveWarmupPeriods()` is not available on indicators that do not have any recommended pruning; however, you can still do a custom pruning by using the customizable `.RemoveWarmupPeriods(removePeriods)`. -:warning: WARNING! `.RemoveWarmupPeriods()` will reverse-engineer some parameters in determing the recommended pruning amount. Consequently, on rare occassions when there are unusual results, there can be an erroneous increase in the amount of pruning. If you want more certainty, use the `.RemoveWarmupPeriods(removePeriods)` with a specific number of `removePeriods`. +:warning: WARNING! `.RemoveWarmupPeriods()` will reverse-engineer some parameters in determining the recommended pruning amount. Consequently, on rare occasions when there are unusual results, there can be an erroneous increase in the amount of pruning. Using this method on chained indicators without specifying `removePeriods` is strongly discouraged. If you want more certainty, use the `.RemoveWarmupPeriods(removePeriods)` with a specific number of `removePeriods`. ### Condense diff --git a/src/_common/Candles/Candles.cs b/src/_common/Candles/Candles.cs index 51b2aafb6..e782af512 100644 --- a/src/_common/Candles/Candles.cs +++ b/src/_common/Candles/Candles.cs @@ -13,9 +13,8 @@ internal static List ToCandleResults( where TQuote : IQuote { List candlesList = quotes - .Select(x => new CandleResult + .Select(x => new CandleResult(x.Date) { - Date = x.Date, Match = Match.None, Candle = new CandleProperties { diff --git a/src/_common/Candles/Models.cs b/src/_common/Candles/Models.cs index d5d6a4681..7de0260f7 100644 --- a/src/_common/Candles/Models.cs +++ b/src/_common/Candles/Models.cs @@ -24,8 +24,9 @@ public class CandleProperties : Quote [Serializable] public class CandleResult : ResultBase { - public CandleResult() + public CandleResult(DateTime date) { + Date = date; Candle = new CandleProperties(); } diff --git a/src/_common/Enums.cs b/src/_common/Enums.cs index 6bbfdc33d..300efadef 100644 --- a/src/_common/Enums.cs +++ b/src/_common/Enums.cs @@ -23,6 +23,18 @@ public enum EndType HighLow = 1 } +public enum Match +{ + BullConfirmed = 200, + BullSignal = 100, + BullBasis = 10, + Neutral = 1, + None = 0, + BearBasis = -10, + BearSignal = -100, + BearConfirmed = -200 +} + public enum MaType { ALMA, @@ -54,14 +66,10 @@ public enum PeriodSize OneMinute } -public enum Match +public enum SyncType { - BullConfirmed = 200, - BullSignal = 100, - BullBasis = 10, - Neutral = 1, - None = 0, - BearBasis = -10, - BearSignal = -100, - BearConfirmed = -200 -} + Prepend, + AppendOnly, + RemoveOnly, + FullMatch +} \ No newline at end of file diff --git a/src/_common/Results/Result.Utilities.cs b/src/_common/Results/Result.Utilities.cs index d09a85c58..10b497758 100644 --- a/src/_common/Results/Result.Utilities.cs +++ b/src/_common/Results/Result.Utilities.cs @@ -24,6 +24,97 @@ public static IEnumerable RemoveWarmupPeriods( "If specified, the Remove Periods value must be greater than or equal to 0.") : results.Remove(removePeriods); + // SYNC INDEX - RESIZE TO MATCH OTHER + public static IEnumerable SyncIndex( + this IEnumerable results, + IEnumerable resultsToMatch, + SyncType syncType = SyncType.FullMatch) + where TResultR : IResult + where TResultM : IResult + { + // initialize + List resultsList = results.ToSortedList(); + List matchList = resultsToMatch.ToSortedList(); + + if (matchList.Count == 0 || resultsList.Count == 0) + { + return new List(); + } + + bool prepend = false; + bool append = false; + bool remove = false; + + switch (syncType) + { + case SyncType.Prepend: + prepend = true; + break; + + case SyncType.AppendOnly: + prepend = append = true; + break; + + case SyncType.RemoveOnly: + remove = true; + break; + + case SyncType.FullMatch: + prepend = append = remove = true; + break; + } + + Type type = resultsList[0].GetType(); + + // add plugs for missing values + if (prepend || append) + { + List toAppend = new(); + + for (int i = 0; i < matchList.Count; i++) + { + TResultM? m = matchList[i]; + TResultR? r = resultsList.Find(m.Date); + + if (r is null) + { + TResultR? n = (TResultR?)Activator.CreateInstance(type, m.Date); + if (n != null) + { + toAppend.Add(n); + } + } + else if (!append) + { + break; + } + } + + resultsList.AddRange(toAppend); + } + + // remove unmatched results + if (remove) + { + List toRemove = new(); + + for (int i = 0; i < resultsList.Count; i++) + { + TResultR? r = resultsList[i]; + TResultM? m = matchList.Find(r.Date); + + if (m is null) + { + toRemove.Add(r); + } + } + + resultsList.RemoveAll(x => toRemove.Contains(x)); + } + + return resultsList.ToSortedList(); + } + // REMOVE RESULTS private static List Remove( this IEnumerable results, @@ -69,4 +160,11 @@ private static List Remove( return prices.OrderBy(x => x.Date).ToList(); } + + // RETURN SORTED LIST of RESULTS + internal static List ToSortedList( + this IEnumerable results) + where TResult : IResult => results + .OrderBy(x => x.Date) + .ToList(); } diff --git a/src/a-d/Adl/Adl.Models.cs b/src/a-d/Adl/Adl.Models.cs index 2992acb22..d8bbe1f88 100644 --- a/src/a-d/Adl/Adl.Models.cs +++ b/src/a-d/Adl/Adl.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class AdlResult : ResultBase, IReusableResult { + public AdlResult(DateTime date) + { + Date = date; + } + public double? MoneyFlowMultiplier { get; set; } public double? MoneyFlowVolume { get; set; } public double Adl { get; set; } diff --git a/src/a-d/Adl/Adl.Series.cs b/src/a-d/Adl/Adl.Series.cs index c5dd37f24..4f9d05df3 100644 --- a/src/a-d/Adl/Adl.Series.cs +++ b/src/a-d/Adl/Adl.Series.cs @@ -23,14 +23,13 @@ internal static List CalcAdl( double mfv = mfm * q.Volume; double adl = mfv + prevAdl; - AdlResult result = new() + AdlResult r = new(q.Date) { - Date = q.Date, MoneyFlowMultiplier = mfm, MoneyFlowVolume = mfv, Adl = adl }; - results.Add(result); + results.Add(r); prevAdl = adl; @@ -43,7 +42,7 @@ internal static List CalcAdl( sumSma += results[p].Adl; } - result.AdlSma = sumSma / smaPeriods; + r.AdlSma = sumSma / smaPeriods; } } diff --git a/src/a-d/Adx/Adx.Models.cs b/src/a-d/Adx/Adx.Models.cs index 549d61134..3c179a51c 100644 --- a/src/a-d/Adx/Adx.Models.cs +++ b/src/a-d/Adx/Adx.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class AdxResult : ResultBase, IReusableResult { + public AdxResult(DateTime date) + { + Date = date; + } + public double? Pdi { get; set; } public double? Mdi { get; set; } public double? Adx { get; set; } diff --git a/src/a-d/Adx/Adx.Series.cs b/src/a-d/Adx/Adx.Series.cs index bacb5dea9..9701e59f3 100644 --- a/src/a-d/Adx/Adx.Series.cs +++ b/src/a-d/Adx/Adx.Series.cs @@ -34,11 +34,8 @@ internal static List CalcAdx( { QuoteD q = qdList[i]; - AdxResult result = new() - { - Date = q.Date - }; - results.Add(result); + AdxResult r = new(q.Date); + results.Add(r); // skip first period if (i == 0) @@ -104,8 +101,8 @@ internal static List CalcAdx( double pdi = 100 * pdm / (double)trs; double mdi = 100 * mdm / (double)trs; - result.Pdi = pdi; - result.Mdi = mdi; + r.Pdi = pdi; + r.Mdi = mdi; // calculate ADX double dx = (pdi + mdi == 0) @@ -116,11 +113,11 @@ internal static List CalcAdx( if (i + 1 > 2 * lookbackPeriods) { adx = ((prevAdx * (lookbackPeriods - 1)) + dx) / lookbackPeriods; - result.Adx = adx; + r.Adx = adx; double? priorAdx = results[i + 1 - lookbackPeriods].Adx; - result.Adxr = (adx + priorAdx) / 2; + r.Adxr = (adx + priorAdx) / 2; prevAdx = adx; } @@ -129,7 +126,7 @@ internal static List CalcAdx( { sumDx += dx; adx = sumDx / lookbackPeriods; - result.Adx = adx; + r.Adx = adx; prevAdx = adx; } diff --git a/src/a-d/Alligator/Alligator.Api.cs b/src/a-d/Alligator/Alligator.Api.cs index 64f041505..55d006097 100644 --- a/src/a-d/Alligator/Alligator.Api.cs +++ b/src/a-d/Alligator/Alligator.Api.cs @@ -40,7 +40,8 @@ public static IEnumerable GetAlligator( teethPeriods, teethOffset, lipsPeriods, - lipsOffset); + lipsOffset) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetAlligator( diff --git a/src/a-d/Alligator/Alligator.Models.cs b/src/a-d/Alligator/Alligator.Models.cs index 2ff36437f..75f928142 100644 --- a/src/a-d/Alligator/Alligator.Models.cs +++ b/src/a-d/Alligator/Alligator.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class AlligatorResult : ResultBase { + public AlligatorResult(DateTime date) + { + Date = date; + } + public double? Jaw { get; set; } public double? Teeth { get; set; } public double? Lips { get; set; } diff --git a/src/a-d/Alligator/Alligator.Series.cs b/src/a-d/Alligator/Alligator.Series.cs index 190b01ef9..8d16cd853 100644 --- a/src/a-d/Alligator/Alligator.Series.cs +++ b/src/a-d/Alligator/Alligator.Series.cs @@ -27,10 +27,7 @@ internal static List CalcAlligator( List results = tpList - .Select(x => new AlligatorResult - { - Date = x.Date - }) + .Select(x => new AlligatorResult(x.Date)) .ToList(); // roll through quotes diff --git a/src/a-d/Alma/Alma.Api.cs b/src/a-d/Alma/Alma.Api.cs index 66e1328c9..6d180315d 100644 --- a/src/a-d/Alma/Alma.Api.cs +++ b/src/a-d/Alma/Alma.Api.cs @@ -22,7 +22,8 @@ public static IEnumerable GetAlma( double offset = 0.85, double sigma = 6) => results .ToResultTuple() - .CalcAlma(lookbackPeriods, offset, sigma); + .CalcAlma(lookbackPeriods, offset, sigma) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetAlma( diff --git a/src/a-d/Alma/Alma.Models.cs b/src/a-d/Alma/Alma.Models.cs index 8e6f114f2..1ce7e3570 100644 --- a/src/a-d/Alma/Alma.Models.cs +++ b/src/a-d/Alma/Alma.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class AlmaResult : ResultBase, IReusableResult { + public AlmaResult(DateTime date) + { + Date = date; + } + public double? Alma { get; set; } double? IReusableResult.Value => Alma; diff --git a/src/a-d/Alma/Alma.Series.cs b/src/a-d/Alma/Alma.Series.cs index 440f1cef4..d0bff4a3e 100644 --- a/src/a-d/Alma/Alma.Series.cs +++ b/src/a-d/Alma/Alma.Series.cs @@ -34,10 +34,8 @@ internal static List CalcAlma( { (DateTime date, double _) = tpList[i]; - AlmaResult r = new() - { - Date = date - }; + AlmaResult r = new(date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -53,8 +51,6 @@ internal static List CalcAlma( r.Alma = weightedSum / norm; } - - results.Add(r); } return results; diff --git a/src/a-d/Aroon/Aroon.Models.cs b/src/a-d/Aroon/Aroon.Models.cs index 6e98d0aa8..50fdc2ddf 100644 --- a/src/a-d/Aroon/Aroon.Models.cs +++ b/src/a-d/Aroon/Aroon.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class AroonResult : ResultBase, IReusableResult { + public AroonResult(DateTime date) + { + Date = date; + } + public double? AroonUp { get; set; } public double? AroonDown { get; set; } public double? Oscillator { get; set; } diff --git a/src/a-d/Aroon/Aroon.Series.cs b/src/a-d/Aroon/Aroon.Series.cs index f0860feb3..4af941670 100644 --- a/src/a-d/Aroon/Aroon.Series.cs +++ b/src/a-d/Aroon/Aroon.Series.cs @@ -18,10 +18,8 @@ internal static List CalcAroon( { QuoteD q = qdList[i]; - AroonResult result = new() - { - Date = q.Date - }; + AroonResult r = new(q.Date); + results.Add(r); // add aroons if (i + 1 > lookbackPeriods) @@ -48,12 +46,10 @@ internal static List CalcAroon( } } - result.AroonUp = 100d * (lookbackPeriods - (i + 1 - lastHighIndex)) / lookbackPeriods; - result.AroonDown = 100d * (lookbackPeriods - (i + 1 - lastLowIndex)) / lookbackPeriods; - result.Oscillator = result.AroonUp - result.AroonDown; + r.AroonUp = 100d * (lookbackPeriods - (i + 1 - lastHighIndex)) / lookbackPeriods; + r.AroonDown = 100d * (lookbackPeriods - (i + 1 - lastLowIndex)) / lookbackPeriods; + r.Oscillator = r.AroonUp - r.AroonDown; } - - results.Add(result); } return results; diff --git a/src/a-d/Atr/Atr.Models.cs b/src/a-d/Atr/Atr.Models.cs index 531dad0c9..d2980015c 100644 --- a/src/a-d/Atr/Atr.Models.cs +++ b/src/a-d/Atr/Atr.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class AtrResult : ResultBase, IReusableResult { + public AtrResult(DateTime date) + { + Date = date; + } + public double? Tr { get; set; } public double? Atr { get; set; } public double? Atrp { get; set; } diff --git a/src/a-d/Atr/Atr.Series.cs b/src/a-d/Atr/Atr.Series.cs index 5bd781a68..7926446c7 100644 --- a/src/a-d/Atr/Atr.Series.cs +++ b/src/a-d/Atr/Atr.Series.cs @@ -24,10 +24,8 @@ internal static List CalcAtr( { QuoteD q = qdList[i]; - AtrResult result = new() - { - Date = q.Date - }; + AtrResult r = new(q.Date); + results.Add(r); if (i > 0) { @@ -36,14 +34,14 @@ internal static List CalcAtr( } double tr = Math.Max(q.High - q.Low, Math.Max(highMinusPrevClose, lowMinusPrevClose)); - result.Tr = tr; + r.Tr = tr; if (i + 1 > lookbackPeriods) { // calculate ATR double atr = ((prevAtr * (lookbackPeriods - 1)) + tr) / lookbackPeriods; - result.Atr = atr; - result.Atrp = (q.Close == 0) ? null : atr / q.Close * 100; + r.Atr = atr; + r.Atrp = (q.Close == 0) ? null : atr / q.Close * 100; prevAtr = atr; } else if (i + 1 == lookbackPeriods) @@ -51,8 +49,8 @@ internal static List CalcAtr( // initialize ATR sumTr += tr; double atr = sumTr / lookbackPeriods; - result.Atr = atr; - result.Atrp = (q.Close == 0) ? null : atr / q.Close * 100; + r.Atr = atr; + r.Atrp = (q.Close == 0) ? null : atr / q.Close * 100; prevAtr = atr; } else @@ -61,7 +59,6 @@ internal static List CalcAtr( sumTr += tr; } - results.Add(result); prevClose = q.Close; } diff --git a/src/a-d/Awesome/Awesome.Api.cs b/src/a-d/Awesome/Awesome.Api.cs index efc3eba31..8d42da713 100644 --- a/src/a-d/Awesome/Awesome.Api.cs +++ b/src/a-d/Awesome/Awesome.Api.cs @@ -20,7 +20,8 @@ public static IEnumerable GetAwesome( int fastPeriods = 5, int slowPeriods = 34) => results .ToResultTuple() - .CalcAwesome(fastPeriods, slowPeriods); + .CalcAwesome(fastPeriods, slowPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetAwesome( diff --git a/src/a-d/Awesome/Awesome.Models.cs b/src/a-d/Awesome/Awesome.Models.cs index cafcbbbec..a0dd84a03 100644 --- a/src/a-d/Awesome/Awesome.Models.cs +++ b/src/a-d/Awesome/Awesome.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class AwesomeResult : ResultBase, IReusableResult { + public AwesomeResult(DateTime date) + { + Date = date; + } + public double? Oscillator { get; set; } public double? Normalized { get; set; } diff --git a/src/a-d/Awesome/Awesome.Series.cs b/src/a-d/Awesome/Awesome.Series.cs index a608ea566..287be270a 100644 --- a/src/a-d/Awesome/Awesome.Series.cs +++ b/src/a-d/Awesome/Awesome.Series.cs @@ -22,10 +22,8 @@ internal static List CalcAwesome( (DateTime date, double value) = tpList[i]; pr[i] = value; - AwesomeResult r = new() - { - Date = date - }; + AwesomeResult r = new(date); + results.Add(r); if (i + 1 >= slowPeriods) { @@ -45,8 +43,6 @@ internal static List CalcAwesome( r.Oscillator = (sumFast / fastPeriods) - (sumSlow / slowPeriods); r.Normalized = (pr[i] != 0) ? 100 * r.Oscillator / pr[i] : double.NaN; } - - results.Add(r); } return results; diff --git a/src/a-d/Beta/Beta.Models.cs b/src/a-d/Beta/Beta.Models.cs index 820808ea6..2a1dc5257 100644 --- a/src/a-d/Beta/Beta.Models.cs +++ b/src/a-d/Beta/Beta.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class BetaResult : ResultBase, IReusableResult { + public BetaResult(DateTime date) + { + Date = date; + } + public double? Beta { get; set; } public double? BetaUp { get; set; } public double? BetaDown { get; set; } diff --git a/src/a-d/Beta/Beta.Series.cs b/src/a-d/Beta/Beta.Series.cs index 992708a7e..578a44179 100644 --- a/src/a-d/Beta/Beta.Series.cs +++ b/src/a-d/Beta/Beta.Series.cs @@ -50,9 +50,8 @@ internal static List CalcBeta( { (DateTime date, double _) = tpListEval[i]; - BetaResult r = new() + BetaResult r = new(date) { - Date = date, ReturnsEval = evalReturns[i], ReturnsMrkt = mrktReturns[i] }; @@ -106,7 +105,7 @@ private static void CalcBetaWindow( // note: BetaType.All is ineligible for this method // initialize - CorrResult c = new(); + CorrResult c = new(r.Date); List dataA = new(lookbackPeriods); List dataB = new(lookbackPeriods); diff --git a/src/a-d/BollingerBands/BollingerBands.Api.cs b/src/a-d/BollingerBands/BollingerBands.Api.cs index 13fe9caab..cdab49348 100644 --- a/src/a-d/BollingerBands/BollingerBands.Api.cs +++ b/src/a-d/BollingerBands/BollingerBands.Api.cs @@ -20,7 +20,8 @@ public static IEnumerable GetBollingerBands( int lookbackPeriods = 20, double standardDeviations = 2) => results .ToResultTuple() - .CalcBollingerBands(lookbackPeriods, standardDeviations); + .CalcBollingerBands(lookbackPeriods, standardDeviations) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetBollingerBands( diff --git a/src/a-d/BollingerBands/BollingerBands.Models.cs b/src/a-d/BollingerBands/BollingerBands.Models.cs index 85ee53e9c..9260a0618 100644 --- a/src/a-d/BollingerBands/BollingerBands.Models.cs +++ b/src/a-d/BollingerBands/BollingerBands.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class BollingerBandsResult : ResultBase, IReusableResult { + public BollingerBandsResult(DateTime date) + { + Date = date; + } + public double? Sma { get; set; } public double? UpperBand { get; set; } public double? LowerBand { get; set; } diff --git a/src/a-d/BollingerBands/BollingerBands.Series.cs b/src/a-d/BollingerBands/BollingerBands.Series.cs index b296093d9..498a3f7d1 100644 --- a/src/a-d/BollingerBands/BollingerBands.Series.cs +++ b/src/a-d/BollingerBands/BollingerBands.Series.cs @@ -19,10 +19,8 @@ internal static List CalcBollingerBands( { (DateTime date, double value) = tpList[i]; - BollingerBandsResult r = new() - { - Date = date - }; + BollingerBandsResult r = new(date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -51,8 +49,6 @@ internal static List CalcBollingerBands( r.ZScore = (stdDev == 0) ? double.NaN : (value - r.Sma) / stdDev; r.Width = (periodAvg == 0) ? double.NaN : (r.UpperBand - r.LowerBand) / periodAvg; } - - results.Add(r); } return results; diff --git a/src/a-d/Bop/Bop.Models.cs b/src/a-d/Bop/Bop.Models.cs index b8a89e50a..74df18931 100644 --- a/src/a-d/Bop/Bop.Models.cs +++ b/src/a-d/Bop/Bop.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class BopResult : ResultBase, IReusableResult { + public BopResult(DateTime date) + { + Date = date; + } + public double? Bop { get; set; } double? IReusableResult.Value => Bop; diff --git a/src/a-d/Bop/Bop.Series.cs b/src/a-d/Bop/Bop.Series.cs index ae55ac84a..a65493282 100644 --- a/src/a-d/Bop/Bop.Series.cs +++ b/src/a-d/Bop/Bop.Series.cs @@ -22,10 +22,8 @@ internal static List CalcBop( // roll through quotes for (int i = 0; i < length; i++) { - BopResult r = new() - { - Date = qdList[i].Date - }; + BopResult r = new(qdList[i].Date); + results.Add(r); if (i >= smoothPeriods - 1) { @@ -37,8 +35,6 @@ internal static List CalcBop( r.Bop = sum / smoothPeriods; } - - results.Add(r); } return results; diff --git a/src/a-d/Cci/Cci.Models.cs b/src/a-d/Cci/Cci.Models.cs index 36a530545..2f3f7a449 100644 --- a/src/a-d/Cci/Cci.Models.cs +++ b/src/a-d/Cci/Cci.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class CciResult : ResultBase, IReusableResult { + public CciResult(DateTime date) + { + Date = date; + } + public double? Cci { get; set; } double? IReusableResult.Value => Cci; diff --git a/src/a-d/Cci/Cci.Series.cs b/src/a-d/Cci/Cci.Series.cs index 13a2cbe15..40786c593 100644 --- a/src/a-d/Cci/Cci.Series.cs +++ b/src/a-d/Cci/Cci.Series.cs @@ -21,11 +21,8 @@ internal static List CalcCci( QuoteD q = qdList[i]; tp[i] = (q.High + q.Low + q.Close) / 3d; - CciResult result = new() - { - Date = q.Date - }; - results.Add(result); + CciResult r = new(q.Date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -47,7 +44,7 @@ internal static List CalcCci( avgDv /= lookbackPeriods; - result.Cci = (avgDv == 0) ? double.NaN + r.Cci = (avgDv == 0) ? double.NaN : (tp[i] - avgTp) / (0.015 * avgDv); } } diff --git a/src/a-d/ChaikinOsc/ChaikinOsc.Models.cs b/src/a-d/ChaikinOsc/ChaikinOsc.Models.cs index ad79639c4..686e2ed0b 100644 --- a/src/a-d/ChaikinOsc/ChaikinOsc.Models.cs +++ b/src/a-d/ChaikinOsc/ChaikinOsc.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ChaikinOscResult : ResultBase, IReusableResult { + public ChaikinOscResult(DateTime date) + { + Date = date; + } + public double? MoneyFlowMultiplier { get; set; } public double? MoneyFlowVolume { get; set; } public double? Adl { get; set; } diff --git a/src/a-d/ChaikinOsc/ChaikinOsc.Series.cs b/src/a-d/ChaikinOsc/ChaikinOsc.Series.cs index aa678291d..430651b33 100644 --- a/src/a-d/ChaikinOsc/ChaikinOsc.Series.cs +++ b/src/a-d/ChaikinOsc/ChaikinOsc.Series.cs @@ -13,9 +13,8 @@ internal static List CalcChaikinOsc( // money flow List results = qdList.CalcAdl(null) - .Select(r => new ChaikinOscResult + .Select(r => new ChaikinOscResult(r.Date) { - Date = r.Date, MoneyFlowMultiplier = r.MoneyFlowMultiplier, MoneyFlowVolume = r.MoneyFlowVolume, Adl = r.Adl diff --git a/src/a-d/Chandelier/Chandelier.Models.cs b/src/a-d/Chandelier/Chandelier.Models.cs index 30d442f6c..2239680cb 100644 --- a/src/a-d/Chandelier/Chandelier.Models.cs +++ b/src/a-d/Chandelier/Chandelier.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ChandelierResult : ResultBase, IReusableResult { + public ChandelierResult(DateTime date) + { + Date = date; + } + public double? ChandelierExit { get; set; } double? IReusableResult.Value => ChandelierExit; diff --git a/src/a-d/Chandelier/Chandelier.Series.cs b/src/a-d/Chandelier/Chandelier.Series.cs index 9a2d6c7a7..5720d3491 100644 --- a/src/a-d/Chandelier/Chandelier.Series.cs +++ b/src/a-d/Chandelier/Chandelier.Series.cs @@ -24,10 +24,8 @@ internal static List CalcChandelier( { QuoteD q = qdList[i]; - ChandelierResult result = new() - { - Date = q.Date - }; + ChandelierResult r = new(q.Date); + results.Add(r); // add exit values if (i + 1 >= lookbackPeriods) @@ -48,7 +46,7 @@ internal static List CalcChandelier( } } - result.ChandelierExit = maxHigh - (atr * multiplier); + r.ChandelierExit = maxHigh - (atr * multiplier); break; case ChandelierType.Short: @@ -63,15 +61,13 @@ internal static List CalcChandelier( } } - result.ChandelierExit = minLow + (atr * multiplier); + r.ChandelierExit = minLow + (atr * multiplier); break; default: break; } } - - results.Add(result); } return results; diff --git a/src/a-d/Chop/Chop.Models.cs b/src/a-d/Chop/Chop.Models.cs index fb24d8ff4..a444acc58 100644 --- a/src/a-d/Chop/Chop.Models.cs +++ b/src/a-d/Chop/Chop.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ChopResult : ResultBase, IReusableResult { + public ChopResult(DateTime date) + { + Date = date; + } + public double? Chop { get; set; } double? IReusableResult.Value => Chop; diff --git a/src/a-d/Chop/Chop.Series.cs b/src/a-d/Chop/Chop.Series.cs index c22ff95f4..1329d2e23 100644 --- a/src/a-d/Chop/Chop.Series.cs +++ b/src/a-d/Chop/Chop.Series.cs @@ -25,10 +25,7 @@ internal static List CalcChop( // roll through quotes for (int i = 0; i < qdList.Count; i++) { - ChopResult r = new() - { - Date = qdList[i].Date - }; + ChopResult r = new(qdList[i].Date); results.Add(r); if (i > 0) diff --git a/src/a-d/Cmf/Cmf.Models.cs b/src/a-d/Cmf/Cmf.Models.cs index e17cf6505..914ac667a 100644 --- a/src/a-d/Cmf/Cmf.Models.cs +++ b/src/a-d/Cmf/Cmf.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class CmfResult : ResultBase, IReusableResult { + public CmfResult(DateTime date) + { + Date = date; + } + public double? MoneyFlowMultiplier { get; set; } public double? MoneyFlowVolume { get; set; } public double? Cmf { get; set; } diff --git a/src/a-d/Cmf/Cmf.Series.cs b/src/a-d/Cmf/Cmf.Series.cs index 6c5e718f6..3f647f0dc 100644 --- a/src/a-d/Cmf/Cmf.Series.cs +++ b/src/a-d/Cmf/Cmf.Series.cs @@ -21,14 +21,14 @@ internal static List CalcCmf( // roll through quotes for (int i = 0; i < length; i++) { - AdlResult r = adlResults[i]; + AdlResult adl = adlResults[i]; - CmfResult result = new() + CmfResult r = new(adl.Date) { - Date = r.Date, - MoneyFlowMultiplier = r.MoneyFlowMultiplier, - MoneyFlowVolume = r.MoneyFlowVolume + MoneyFlowMultiplier = adl.MoneyFlowMultiplier, + MoneyFlowVolume = adl.MoneyFlowVolume }; + results.Add(r); if (i >= lookbackPeriods - 1) { @@ -49,11 +49,9 @@ internal static List CalcCmf( if (avgVol != 0) { - result.Cmf = avgMfv / avgVol; + r.Cmf = avgMfv / avgVol; } } - - results.Add(result); } return results; diff --git a/src/a-d/ConnorsRsi/ConnorsRsi.Api.cs b/src/a-d/ConnorsRsi/ConnorsRsi.Api.cs index 957104edb..7e5424dd8 100644 --- a/src/a-d/ConnorsRsi/ConnorsRsi.Api.cs +++ b/src/a-d/ConnorsRsi/ConnorsRsi.Api.cs @@ -22,7 +22,8 @@ public static IEnumerable GetConnorsRsi( int streakPeriods = 2, int rankPeriods = 100) => results .ToResultTuple() - .CalcConnorsRsi(rsiPeriods, streakPeriods, rankPeriods); + .CalcConnorsRsi(rsiPeriods, streakPeriods, rankPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetConnorsRsi( diff --git a/src/a-d/ConnorsRsi/ConnorsRsi.Models.cs b/src/a-d/ConnorsRsi/ConnorsRsi.Models.cs index ae584df50..8f7556e57 100644 --- a/src/a-d/ConnorsRsi/ConnorsRsi.Models.cs +++ b/src/a-d/ConnorsRsi/ConnorsRsi.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ConnorsRsiResult : ResultBase, IReusableResult { + public ConnorsRsiResult(DateTime date) + { + Date = date; + } + public double? Rsi { get; set; } public double? RsiStreak { get; set; } public double? PercentRank { get; set; } diff --git a/src/a-d/ConnorsRsi/ConnorsRsi.Series.cs b/src/a-d/ConnorsRsi/ConnorsRsi.Series.cs index fa5ce583e..ef7f2caf4 100644 --- a/src/a-d/ConnorsRsi/ConnorsRsi.Series.cs +++ b/src/a-d/ConnorsRsi/ConnorsRsi.Series.cs @@ -63,9 +63,8 @@ private static List CalcStreak( { (DateTime date, double value) = tpList[i]; - ConnorsRsiResult r = new() + ConnorsRsiResult r = new(date) { - Date = date, Rsi = rsiResults[i].Rsi }; results.Add(r); diff --git a/src/a-d/Correlation/Correlation.Models.cs b/src/a-d/Correlation/Correlation.Models.cs index 792d44c1d..04ef2516b 100644 --- a/src/a-d/Correlation/Correlation.Models.cs +++ b/src/a-d/Correlation/Correlation.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class CorrResult : ResultBase, IReusableResult { + public CorrResult(DateTime date) + { + Date = date; + } + public double? VarianceA { get; set; } public double? VarianceB { get; set; } public double? Covariance { get; set; } diff --git a/src/a-d/Correlation/Correlation.Series.cs b/src/a-d/Correlation/Correlation.Series.cs index 6b40eb773..eef289a6c 100644 --- a/src/a-d/Correlation/Correlation.Series.cs +++ b/src/a-d/Correlation/Correlation.Series.cs @@ -27,10 +27,8 @@ internal static List CalcCorrelation( "Date sequence does not match. Correlation requires matching dates in provided histories."); } - CorrResult r = new() - { - Date = aDate - }; + CorrResult r = new(aDate); + results.Add(r); // calculate correlation if (i >= lookbackPeriods - 1) @@ -49,8 +47,6 @@ internal static List CalcCorrelation( r.PeriodCorrelation(dataA, dataB); } - - results.Add(r); } return results; diff --git a/src/a-d/Dema/Dema.Api.cs b/src/a-d/Dema/Dema.Api.cs index 6a03aa3ce..e8ce84a62 100644 --- a/src/a-d/Dema/Dema.Api.cs +++ b/src/a-d/Dema/Dema.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetDema( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcDema(lookbackPeriods); + .CalcDema(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetDema( diff --git a/src/a-d/Dema/Dema.Models.cs b/src/a-d/Dema/Dema.Models.cs index ca8b84d6f..9d8fe3379 100644 --- a/src/a-d/Dema/Dema.Models.cs +++ b/src/a-d/Dema/Dema.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class DemaResult : ResultBase, IReusableResult { + public DemaResult(DateTime date) + { + Date = date; + } + public double? Dema { get; set; } double? IReusableResult.Value => Dema; diff --git a/src/a-d/Dema/Dema.Series.cs b/src/a-d/Dema/Dema.Series.cs index c3fb9b637..1575d1578 100644 --- a/src/a-d/Dema/Dema.Series.cs +++ b/src/a-d/Dema/Dema.Series.cs @@ -33,27 +33,23 @@ internal static List CalcDema( { (DateTime date, double value) = tpList[i]; - DemaResult result = new() - { - Date = date - }; + DemaResult r = new(date); + results.Add(r); if (i > lookbackPeriods - 1) { double? ema1 = lastEma1 + (k * (value - lastEma1)); double? ema2 = lastEma2 + (k * (ema1 - lastEma2)); - result.Dema = (2d * ema1) - ema2; + r.Dema = (2d * ema1) - ema2; lastEma1 = ema1; lastEma2 = ema2; } else if (i == lookbackPeriods - 1) { - result.Dema = (2d * lastEma1) - lastEma2; + r.Dema = (2d * lastEma1) - lastEma2; } - - results.Add(result); } return results; diff --git a/src/a-d/Donchian/Donchian.Models.cs b/src/a-d/Donchian/Donchian.Models.cs index 30d20951f..33594a24e 100644 --- a/src/a-d/Donchian/Donchian.Models.cs +++ b/src/a-d/Donchian/Donchian.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class DonchianResult : ResultBase { + public DonchianResult(DateTime date) + { + Date = date; + } + public decimal? UpperBand { get; set; } public decimal? Centerline { get; set; } public decimal? LowerBand { get; set; } diff --git a/src/a-d/Donchian/Donchian.Series.cs b/src/a-d/Donchian/Donchian.Series.cs index cdae1fd57..4e7a87194 100644 --- a/src/a-d/Donchian/Donchian.Series.cs +++ b/src/a-d/Donchian/Donchian.Series.cs @@ -20,10 +20,8 @@ internal static List CalcDonchian( { TQuote q = quotesList[i]; - DonchianResult result = new() - { - Date = q.Date - }; + DonchianResult r = new(q.Date); + results.Add(r); if (i >= lookbackPeriods) { @@ -46,14 +44,12 @@ internal static List CalcDonchian( } } - result.UpperBand = highHigh; - result.LowerBand = lowLow; - result.Centerline = (result.UpperBand + result.LowerBand) / 2m; - result.Width = (result.Centerline == 0) ? null - : (result.UpperBand - result.LowerBand) / result.Centerline; + r.UpperBand = highHigh; + r.LowerBand = lowLow; + r.Centerline = (r.UpperBand + r.LowerBand) / 2m; + r.Width = (r.Centerline == 0) ? null + : (r.UpperBand - r.LowerBand) / r.Centerline; } - - results.Add(result); } return results; diff --git a/src/a-d/Dpo/Dpo.Api.cs b/src/a-d/Dpo/Dpo.Api.cs index b94ec875e..ee721d443 100644 --- a/src/a-d/Dpo/Dpo.Api.cs +++ b/src/a-d/Dpo/Dpo.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetDpo( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcDpo(lookbackPeriods); + .CalcDpo(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetDpo( diff --git a/src/a-d/Dpo/Dpo.Models.cs b/src/a-d/Dpo/Dpo.Models.cs index 21a07aa7f..0526c7ae6 100644 --- a/src/a-d/Dpo/Dpo.Models.cs +++ b/src/a-d/Dpo/Dpo.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class DpoResult : ResultBase, IReusableResult { + public DpoResult(DateTime date) + { + Date = date; + } + public double? Sma { get; set; } public double? Dpo { get; set; } diff --git a/src/a-d/Dpo/Dpo.Series.cs b/src/a-d/Dpo/Dpo.Series.cs index d9ef5b5ce..bc8a00888 100644 --- a/src/a-d/Dpo/Dpo.Series.cs +++ b/src/a-d/Dpo/Dpo.Series.cs @@ -22,10 +22,7 @@ internal static List CalcDpo( { (DateTime date, double value) = tpList[i]; - DpoResult r = new() - { - Date = date - }; + DpoResult r = new(date); results.Add(r); if (i >= lookbackPeriods - offset - 1 && i < length - offset) diff --git a/src/e-k/ElderRay/ElderRay.Models.cs b/src/e-k/ElderRay/ElderRay.Models.cs index 591635f3d..1ffd29543 100644 --- a/src/e-k/ElderRay/ElderRay.Models.cs +++ b/src/e-k/ElderRay/ElderRay.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ElderRayResult : ResultBase, IReusableResult { + public ElderRayResult(DateTime date) + { + Date = date; + } + public double? Ema { get; set; } public double? BullPower { get; set; } public double? BearPower { get; set; } diff --git a/src/e-k/ElderRay/ElderRay.Series.cs b/src/e-k/ElderRay/ElderRay.Series.cs index 380661fa8..983af5690 100644 --- a/src/e-k/ElderRay/ElderRay.Series.cs +++ b/src/e-k/ElderRay/ElderRay.Series.cs @@ -14,9 +14,8 @@ internal static List CalcElderRay( List results = qdList .ToBasicTuple(CandlePart.Close) .CalcEma(lookbackPeriods) - .Select(x => new ElderRayResult + .Select(x => new ElderRayResult(x.Date) { - Date = x.Date, Ema = x.Ema }) .ToList(); diff --git a/src/e-k/Ema/Ema.Api.cs b/src/e-k/Ema/Ema.Api.cs index 2f5de10c7..122eb1059 100644 --- a/src/e-k/Ema/Ema.Api.cs +++ b/src/e-k/Ema/Ema.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetEma( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcEma(lookbackPeriods); + .CalcEma(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetEma( diff --git a/src/e-k/Ema/Ema.Models.cs b/src/e-k/Ema/Ema.Models.cs index dd40afb49..9d94b7d9f 100644 --- a/src/e-k/Ema/Ema.Models.cs +++ b/src/e-k/Ema/Ema.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class EmaResult : ResultBase, IReusableResult { + public EmaResult(DateTime date) + { + Date = date; + } + public double? Ema { get; set; } double? IReusableResult.Value => Ema; diff --git a/src/e-k/Ema/Ema.Series.cs b/src/e-k/Ema/Ema.Series.cs index ca8dd3a8f..96dd94a11 100644 --- a/src/e-k/Ema/Ema.Series.cs +++ b/src/e-k/Ema/Ema.Series.cs @@ -30,7 +30,7 @@ internal static List CalcEma( for (int i = 0; i < length; i++) { (DateTime date, double value) = tpList[i]; - EmaResult r = new() { Date = date }; + EmaResult r = new(date); if (i + 1 > lookbackPeriods) { diff --git a/src/e-k/Ema/Ema.Stream.cs b/src/e-k/Ema/Ema.Stream.cs index 0009043e0..8a73ef21d 100644 --- a/src/e-k/Ema/Ema.Stream.cs +++ b/src/e-k/Ema/Ema.Stream.cs @@ -57,7 +57,7 @@ public IEnumerable Add( double lastEma = (last.Ema == null) ? double.NaN : (double)last.Ema; double newEma = Increment(tuple.Value, lastEma, K); - EmaResult r = new() { Date = tuple.Date, Ema = newEma }; + EmaResult r = new(tuple.Date) { Ema = newEma }; ProtectedResults.Add(r); } diff --git a/src/e-k/Epma/Epma.Api.cs b/src/e-k/Epma/Epma.Api.cs index e11812f0d..846e3b0b1 100644 --- a/src/e-k/Epma/Epma.Api.cs +++ b/src/e-k/Epma/Epma.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetEpma( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcEpma(lookbackPeriods); + .CalcEpma(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetEpma( diff --git a/src/e-k/Epma/Epma.Models.cs b/src/e-k/Epma/Epma.Models.cs index 718430ad5..eeabaabf6 100644 --- a/src/e-k/Epma/Epma.Models.cs +++ b/src/e-k/Epma/Epma.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class EpmaResult : ResultBase, IReusableResult { + public EpmaResult(DateTime date) + { + Date = date; + } + public double? Epma { get; set; } double? IReusableResult.Value => Epma; diff --git a/src/e-k/Epma/Epma.Series.cs b/src/e-k/Epma/Epma.Series.cs index 2a8769389..d487c2d3c 100644 --- a/src/e-k/Epma/Epma.Series.cs +++ b/src/e-k/Epma/Epma.Series.cs @@ -24,9 +24,8 @@ internal static List CalcEpma( { SlopeResult s = slopeResults[i]; - EpmaResult r = new() + EpmaResult r = new(s.Date) { - Date = s.Date, Epma = (s.Slope * (i + 1)) + s.Intercept }; diff --git a/src/e-k/Fcb/Fcb.Models.cs b/src/e-k/Fcb/Fcb.Models.cs index 255321934..ba4c20d4f 100644 --- a/src/e-k/Fcb/Fcb.Models.cs +++ b/src/e-k/Fcb/Fcb.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class FcbResult : ResultBase { + public FcbResult(DateTime date) + { + Date = date; + } + public decimal? UpperBand { get; set; } public decimal? LowerBand { get; set; } } diff --git a/src/e-k/Fcb/Fcb.Series.cs b/src/e-k/Fcb/Fcb.Series.cs index 4ed3fdcc5..19f68c8aa 100644 --- a/src/e-k/Fcb/Fcb.Series.cs +++ b/src/e-k/Fcb/Fcb.Series.cs @@ -25,10 +25,8 @@ internal static List CalcFcb( { FractalResult f = fractals[i]; - FcbResult r = new() - { - Date = f.Date - }; + FcbResult r = new(f.Date); + results.Add(r); if (i >= 2 * windowSpan) { @@ -40,8 +38,6 @@ internal static List CalcFcb( r.UpperBand = upperLine; r.LowerBand = lowerLine; } - - results.Add(r); } return results; diff --git a/src/e-k/FisherTransform/FisherTransform.Api.cs b/src/e-k/FisherTransform/FisherTransform.Api.cs index df4fdacc3..0ff0d22e4 100644 --- a/src/e-k/FisherTransform/FisherTransform.Api.cs +++ b/src/e-k/FisherTransform/FisherTransform.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetFisherTransform( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcFisherTransform(lookbackPeriods); + .CalcFisherTransform(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetFisherTransform( diff --git a/src/e-k/FisherTransform/FisherTransform.Models.cs b/src/e-k/FisherTransform/FisherTransform.Models.cs index 04ff0c5fd..379d958be 100644 --- a/src/e-k/FisherTransform/FisherTransform.Models.cs +++ b/src/e-k/FisherTransform/FisherTransform.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class FisherTransformResult : ResultBase, IReusableResult { + public FisherTransformResult(DateTime date) + { + Date = date; + } + public double? Fisher { get; set; } public double? Trigger { get; set; } diff --git a/src/e-k/FisherTransform/FisherTransform.Series.cs b/src/e-k/FisherTransform/FisherTransform.Series.cs index f9269a966..b149198d7 100644 --- a/src/e-k/FisherTransform/FisherTransform.Series.cs +++ b/src/e-k/FisherTransform/FisherTransform.Series.cs @@ -31,10 +31,8 @@ internal static List CalcFisherTransform( maxPrice = Math.Max(pr[p], maxPrice); } - FisherTransformResult r = new() - { - Date = date - }; + FisherTransformResult r = new(date); + results.Add(r); if (i > 0) { @@ -56,8 +54,6 @@ internal static List CalcFisherTransform( xv[i] = 0; r.Fisher = 0; } - - results.Add(r); } return results; diff --git a/src/e-k/ForceIndex/ForceIndex.Models.cs b/src/e-k/ForceIndex/ForceIndex.Models.cs index 5eff40940..06f061c4a 100644 --- a/src/e-k/ForceIndex/ForceIndex.Models.cs +++ b/src/e-k/ForceIndex/ForceIndex.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ForceIndexResult : ResultBase, IReusableResult { + public ForceIndexResult(DateTime date) + { + Date = date; + } + public double? ForceIndex { get; set; } double? IReusableResult.Value => ForceIndex; diff --git a/src/e-k/ForceIndex/ForceIndex.Series.cs b/src/e-k/ForceIndex/ForceIndex.Series.cs index b0e8bc6a0..72b5affc5 100644 --- a/src/e-k/ForceIndex/ForceIndex.Series.cs +++ b/src/e-k/ForceIndex/ForceIndex.Series.cs @@ -21,10 +21,7 @@ internal static List CalcForceIndex( { QuoteD q = qdList[i]; - ForceIndexResult r = new() - { - Date = q.Date - }; + ForceIndexResult r = new(q.Date); results.Add(r); // skip first period diff --git a/src/e-k/Fractal/Fractal.Models.cs b/src/e-k/Fractal/Fractal.Models.cs index 5e7cb59c9..406feb5e6 100644 --- a/src/e-k/Fractal/Fractal.Models.cs +++ b/src/e-k/Fractal/Fractal.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class FractalResult : ResultBase { + public FractalResult(DateTime date) + { + Date = date; + } + public decimal? FractalBear { get; set; } public decimal? FractalBull { get; set; } } diff --git a/src/e-k/Fractal/Fractal.Series.cs b/src/e-k/Fractal/Fractal.Series.cs index c69dc246b..66abf1e3c 100644 --- a/src/e-k/Fractal/Fractal.Series.cs +++ b/src/e-k/Fractal/Fractal.Series.cs @@ -21,10 +21,8 @@ internal static List CalcFractal( { TQuote q = quotesList[i]; - FractalResult r = new() - { - Date = q.Date - }; + FractalResult r = new(q.Date); + results.Add(r); if (i + 1 > leftSpan && i + 1 <= quotesList.Count - rightSpan) { @@ -78,8 +76,6 @@ internal static List CalcFractal( r.FractalBull = evalLow; } } - - results.Add(r); } return results; diff --git a/src/e-k/Gator/Gator.Api.cs b/src/e-k/Gator/Gator.Api.cs index 999877d2f..eba223120 100644 --- a/src/e-k/Gator/Gator.Api.cs +++ b/src/e-k/Gator/Gator.Api.cs @@ -26,7 +26,8 @@ public static IEnumerable GetGator( .ToResultTuple() .GetAlligator() .ToList() - .CalcGator(); + .CalcGator() + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetGator( diff --git a/src/e-k/Gator/Gator.Models.cs b/src/e-k/Gator/Gator.Models.cs index c2acc868c..3cf27e8eb 100644 --- a/src/e-k/Gator/Gator.Models.cs +++ b/src/e-k/Gator/Gator.Models.cs @@ -1,8 +1,13 @@ -namespace Skender.Stock.Indicators; +namespace Skender.Stock.Indicators; [Serializable] public class GatorResult : ResultBase { + public GatorResult(DateTime date) + { + Date = date; + } + public double? Upper { get; set; } public double? Lower { get; set; } diff --git a/src/e-k/Gator/Gator.Series.cs b/src/e-k/Gator/Gator.Series.cs index a638e405e..59382d2fa 100644 --- a/src/e-k/Gator/Gator.Series.cs +++ b/src/e-k/Gator/Gator.Series.cs @@ -7,9 +7,8 @@ internal static List CalcGator( this List alligator) { List results = alligator - .Select(x => new GatorResult + .Select(x => new GatorResult(x.Date) { - Date = x.Date, Upper = NullMath.Abs(x.Jaw - x.Teeth), Lower = -NullMath.Abs(x.Teeth - x.Lips) }) diff --git a/src/e-k/HeikinAshi/HeikinAshi.Models.cs b/src/e-k/HeikinAshi/HeikinAshi.Models.cs index 41e12c755..4cb917ac5 100644 --- a/src/e-k/HeikinAshi/HeikinAshi.Models.cs +++ b/src/e-k/HeikinAshi/HeikinAshi.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class HeikinAshiResult : ResultBase, IQuote { + public HeikinAshiResult(DateTime date) + { + Date = date; + } + public decimal Open { get; set; } public decimal High { get; set; } public decimal Low { get; set; } diff --git a/src/e-k/HeikinAshi/HeikinAshi.Series.cs b/src/e-k/HeikinAshi/HeikinAshi.Series.cs index 958881a8f..62eeb19bf 100644 --- a/src/e-k/HeikinAshi/HeikinAshi.Series.cs +++ b/src/e-k/HeikinAshi/HeikinAshi.Series.cs @@ -34,16 +34,15 @@ internal static List CalcHeikinAshi( decimal[] arrL = { q.Low, open, close }; decimal low = arrL.Min(); - HeikinAshiResult result = new() + HeikinAshiResult r = new(q.Date) { - Date = q.Date, Open = open, High = high, Low = low, Close = close, Volume = q.Volume }; - results.Add(result); + results.Add(r); // save for next iteration prevOpen = open; diff --git a/src/e-k/Hma/Hma.Api.cs b/src/e-k/Hma/Hma.Api.cs index f31882992..d0353dacc 100644 --- a/src/e-k/Hma/Hma.Api.cs +++ b/src/e-k/Hma/Hma.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetHma( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcHma(lookbackPeriods); + .CalcHma(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetHma( diff --git a/src/e-k/Hma/Hma.Models.cs b/src/e-k/Hma/Hma.Models.cs index a8d2e5a9c..f63a82743 100644 --- a/src/e-k/Hma/Hma.Models.cs +++ b/src/e-k/Hma/Hma.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class HmaResult : ResultBase, IReusableResult { + public HmaResult(DateTime date) + { + Date = date; + } + public double? Hma { get; set; } double? IReusableResult.Value => Hma; diff --git a/src/e-k/Hma/Hma.Series.cs b/src/e-k/Hma/Hma.Series.cs index e45105a8c..f5a4ed767 100644 --- a/src/e-k/Hma/Hma.Series.cs +++ b/src/e-k/Hma/Hma.Series.cs @@ -43,17 +43,13 @@ internal static List CalcHma( List results = tpList .Take(shiftQty) - .Select(x => new HmaResult - { - Date = x.Item1 - }) + .Select(x => new HmaResult(x.Item1)) .ToList(); // calculate final HMA = WMA with period SQRT(n) List hmaResults = synthHistory.GetWma(sqN) - .Select(x => new HmaResult + .Select(x => new HmaResult(x.Date) { - Date = x.Date, Hma = x.Wma }) .ToList(); diff --git a/src/e-k/HtTrendline/HtTrendline.Api.cs b/src/e-k/HtTrendline/HtTrendline.Api.cs index 543ff1fc6..a3dd6a746 100644 --- a/src/e-k/HtTrendline/HtTrendline.Api.cs +++ b/src/e-k/HtTrendline/HtTrendline.Api.cs @@ -16,7 +16,8 @@ public static IEnumerable GetHtTrendline( public static IEnumerable GetHtTrendline( this IEnumerable results) => results .ToResultTuple() - .CalcHtTrendline(); + .CalcHtTrendline() + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetHtTrendline( diff --git a/src/e-k/HtTrendline/HtTrendline.Models.cs b/src/e-k/HtTrendline/HtTrendline.Models.cs index 07b1166a4..ccfc28a6e 100644 --- a/src/e-k/HtTrendline/HtTrendline.Models.cs +++ b/src/e-k/HtTrendline/HtTrendline.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class HtlResult : ResultBase, IReusableResult { + public HtlResult(DateTime date) + { + Date = date; + } + public double? Trendline { get; set; } public double? SmoothPrice { get; set; } diff --git a/src/e-k/HtTrendline/HtTrendline.Series.cs b/src/e-k/HtTrendline/HtTrendline.Series.cs index 33c5876e0..f85dd2779 100644 --- a/src/e-k/HtTrendline/HtTrendline.Series.cs +++ b/src/e-k/HtTrendline/HtTrendline.Series.cs @@ -36,10 +36,8 @@ internal static List CalcHtTrendline( (DateTime date, double value) = tpList[i]; pr[i] = value; - HtlResult r = new() - { - Date = date, - }; + HtlResult r = new(date); + results.Add(r); if (i > 5) { @@ -133,8 +131,6 @@ internal static List CalcHtTrendline( sd[i] = 0; } - - results.Add(r); } return results; diff --git a/src/e-k/Hurst/Hurst.Api.cs b/src/e-k/Hurst/Hurst.Api.cs index 3cd46f4ef..5a5c938ad 100644 --- a/src/e-k/Hurst/Hurst.Api.cs +++ b/src/e-k/Hurst/Hurst.Api.cs @@ -17,7 +17,8 @@ public static IEnumerable GetHurst( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcHurst(lookbackPeriods); + .CalcHurst(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetHurst( diff --git a/src/e-k/Hurst/Hurst.Models.cs b/src/e-k/Hurst/Hurst.Models.cs index 79a51e65f..3c6b82b15 100644 --- a/src/e-k/Hurst/Hurst.Models.cs +++ b/src/e-k/Hurst/Hurst.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class HurstResult : ResultBase, IReusableResult { + public HurstResult(DateTime date) + { + Date = date; + } + public double? HurstExponent { get; set; } double? IReusableResult.Value => HurstExponent; diff --git a/src/e-k/Hurst/Hurst.Series.cs b/src/e-k/Hurst/Hurst.Series.cs index cc6642f82..9920cb41a 100644 --- a/src/e-k/Hurst/Hurst.Series.cs +++ b/src/e-k/Hurst/Hurst.Series.cs @@ -19,10 +19,8 @@ internal static List CalcHurst( { (DateTime date, double _) = tpList[i]; - HurstResult result = new() - { - Date = date - }; + HurstResult r = new(date); + results.Add(r); if (i + 1 > lookbackPeriods) { @@ -44,10 +42,8 @@ internal static List CalcHurst( } // calculate hurst exponent - result.HurstExponent = CalcHurstWindow(values); + r.HurstExponent = CalcHurstWindow(values); } - - results.Add(result); } return results; diff --git a/src/e-k/Ichimoku/Ichimoku.Models.cs b/src/e-k/Ichimoku/Ichimoku.Models.cs index 57dcc64a9..5fb1692c3 100644 --- a/src/e-k/Ichimoku/Ichimoku.Models.cs +++ b/src/e-k/Ichimoku/Ichimoku.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class IchimokuResult : ResultBase { + public IchimokuResult(DateTime date) + { + Date = date; + } + public decimal? TenkanSen { get; set; } // conversion line public decimal? KijunSen { get; set; } // base line public decimal? SenkouSpanA { get; set; } // leading span A diff --git a/src/e-k/Ichimoku/Ichimoku.Series.cs b/src/e-k/Ichimoku/Ichimoku.Series.cs index 3bc30db47..ab276f947 100644 --- a/src/e-k/Ichimoku/Ichimoku.Series.cs +++ b/src/e-k/Ichimoku/Ichimoku.Series.cs @@ -32,17 +32,14 @@ internal static List CalcIchimoku( { TQuote q = quotesList[i]; - IchimokuResult result = new() - { - Date = q.Date - }; - results.Add(result); + IchimokuResult r = new(q.Date); + results.Add(r); // tenkan-sen conversion line - CalcIchimokuTenkanSen(i, quotesList, result, tenkanPeriods); + CalcIchimokuTenkanSen(i, quotesList, r, tenkanPeriods); // kijun-sen base line - CalcIchimokuKijunSen(i, quotesList, result, kijunPeriods); + CalcIchimokuKijunSen(i, quotesList, r, kijunPeriods); // senkou span A if (i >= senkouStartPeriod) @@ -51,17 +48,17 @@ internal static List CalcIchimoku( if (skq != null && skq.TenkanSen != null && skq.KijunSen != null) { - result.SenkouSpanA = (skq.TenkanSen + skq.KijunSen) / 2; + r.SenkouSpanA = (skq.TenkanSen + skq.KijunSen) / 2; } } // senkou span B - CalcIchimokuSenkouB(i, quotesList, result, senkouOffset, senkouBPeriods); + CalcIchimokuSenkouB(i, quotesList, r, senkouOffset, senkouBPeriods); // chikou line if (i + chikouOffset < quotesList.Count) { - result.ChikouSpan = quotesList[i + chikouOffset].Close; + r.ChikouSpan = quotesList[i + chikouOffset].Close; } } diff --git a/src/e-k/Kama/Kama.Api.cs b/src/e-k/Kama/Kama.Api.cs index 537f7b03d..c24b844da 100644 --- a/src/e-k/Kama/Kama.Api.cs +++ b/src/e-k/Kama/Kama.Api.cs @@ -21,7 +21,8 @@ public static IEnumerable GetKama( int fastPeriods = 2, int slowPeriods = 30) => results .ToResultTuple() - .CalcKama(erPeriods, fastPeriods, slowPeriods); + .CalcKama(erPeriods, fastPeriods, slowPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetKama( diff --git a/src/e-k/Kama/Kama.Models.cs b/src/e-k/Kama/Kama.Models.cs index 4b4097a69..e5e3e0e23 100644 --- a/src/e-k/Kama/Kama.Models.cs +++ b/src/e-k/Kama/Kama.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class KamaResult : ResultBase, IReusableResult { + public KamaResult(DateTime date) + { + Date = date; + } + public double? ER { get; set; } public double? Kama { get; set; } diff --git a/src/e-k/Kama/Kama.Series.cs b/src/e-k/Kama/Kama.Series.cs index b360e7980..53cadc3b0 100644 --- a/src/e-k/Kama/Kama.Series.cs +++ b/src/e-k/Kama/Kama.Series.cs @@ -23,10 +23,8 @@ internal static List CalcKama( { (DateTime date, double value) = tpList[i]; - KamaResult r = new() - { - Date = date - }; + KamaResult r = new(date); + results.Add(r); if (i + 1 > erPeriods) { @@ -67,8 +65,6 @@ internal static List CalcKama( { r.Kama = value; } - - results.Add(r); } return results; diff --git a/src/e-k/Keltner/Keltner.Models.cs b/src/e-k/Keltner/Keltner.Models.cs index a4f3cc31d..ba9d79fbe 100644 --- a/src/e-k/Keltner/Keltner.Models.cs +++ b/src/e-k/Keltner/Keltner.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class KeltnerResult : ResultBase { + public KeltnerResult(DateTime date) + { + Date = date; + } + public double? UpperBand { get; set; } public double? Centerline { get; set; } public double? LowerBand { get; set; } diff --git a/src/e-k/Keltner/Keltner.Series.cs b/src/e-k/Keltner/Keltner.Series.cs index f16356ec2..be0407ec3 100644 --- a/src/e-k/Keltner/Keltner.Series.cs +++ b/src/e-k/Keltner/Keltner.Series.cs @@ -32,10 +32,8 @@ internal static List CalcKeltner( { QuoteD q = qdList[i]; - KeltnerResult result = new() - { - Date = q.Date - }; + KeltnerResult r = new(q.Date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -43,14 +41,12 @@ internal static List CalcKeltner( AtrResult atr = atrResults[i]; double? atrSpan = atr.Atr * multiplier; - result.UpperBand = ema.Ema + atrSpan; - result.LowerBand = ema.Ema - atrSpan; - result.Centerline = ema.Ema; - result.Width = (result.Centerline == 0) ? null - : (result.UpperBand - result.LowerBand) / result.Centerline; + r.UpperBand = ema.Ema + atrSpan; + r.LowerBand = ema.Ema - atrSpan; + r.Centerline = ema.Ema; + r.Width = (r.Centerline == 0) ? null + : (r.UpperBand - r.LowerBand) / r.Centerline; } - - results.Add(result); } return results; diff --git a/src/e-k/Kvo/Kvo.Models.cs b/src/e-k/Kvo/Kvo.Models.cs index 8f0d034ed..030bd1a31 100644 --- a/src/e-k/Kvo/Kvo.Models.cs +++ b/src/e-k/Kvo/Kvo.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class KvoResult : ResultBase, IReusableResult { + internal KvoResult(DateTime date) + { + Date = date; + } + public double? Oscillator { get; set; } public double? Signal { get; set; } diff --git a/src/e-k/Kvo/Kvo.Series.cs b/src/e-k/Kvo/Kvo.Series.cs index b0096eedc..b27ae2b49 100644 --- a/src/e-k/Kvo/Kvo.Series.cs +++ b/src/e-k/Kvo/Kvo.Series.cs @@ -34,10 +34,7 @@ internal static List CalcKvo( { QuoteD q = qdList[i]; - KvoResult r = new() - { - Date = q.Date - }; + KvoResult r = new(q.Date); results.Add(r); // trend basis comparator diff --git a/src/m-r/MaEnvelopes/MaEnvelopes.Api.cs b/src/m-r/MaEnvelopes/MaEnvelopes.Api.cs index aaf77a3ad..ba80a2cdc 100644 --- a/src/m-r/MaEnvelopes/MaEnvelopes.Api.cs +++ b/src/m-r/MaEnvelopes/MaEnvelopes.Api.cs @@ -22,7 +22,8 @@ public static IEnumerable GetMaEnvelopes( double percentOffset = 2.5, MaType movingAverageType = MaType.SMA) => results .ToResultTuple() - .CalcMaEnvelopes(lookbackPeriods, percentOffset, movingAverageType); + .CalcMaEnvelopes(lookbackPeriods, percentOffset, movingAverageType) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetMaEnvelopes( diff --git a/src/m-r/MaEnvelopes/MaEnvelopes.Models.cs b/src/m-r/MaEnvelopes/MaEnvelopes.Models.cs index ba83fea45..399d39c12 100644 --- a/src/m-r/MaEnvelopes/MaEnvelopes.Models.cs +++ b/src/m-r/MaEnvelopes/MaEnvelopes.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class MaEnvelopeResult : ResultBase { + public MaEnvelopeResult(DateTime date) + { + Date = date; + } + public double? Centerline { get; set; } public double? UpperEnvelope { get; set; } public double? LowerEnvelope { get; set; } diff --git a/src/m-r/MaEnvelopes/MaEnvelopes.Series.cs b/src/m-r/MaEnvelopes/MaEnvelopes.Series.cs index 34b89bebf..58634bdc6 100644 --- a/src/m-r/MaEnvelopes/MaEnvelopes.Series.cs +++ b/src/m-r/MaEnvelopes/MaEnvelopes.Series.cs @@ -44,9 +44,8 @@ private static IEnumerable MaEnvAlma( int lookbackPeriods, double offsetRatio) => tpList.GetAlma(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Alma, UpperEnvelope = x.Alma + (x.Alma * offsetRatio), LowerEnvelope = x.Alma - (x.Alma * offsetRatio) @@ -57,9 +56,8 @@ private static IEnumerable MaEnvDema( int lookbackPeriods, double offsetRatio) => tpList.GetDema(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Dema, UpperEnvelope = x.Dema + (x.Dema * offsetRatio), LowerEnvelope = x.Dema - (x.Dema * offsetRatio) @@ -70,9 +68,8 @@ private static IEnumerable MaEnvEma( int lookbackPeriods, double offsetRatio) => tpList.GetEma(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Ema, UpperEnvelope = x.Ema + (x.Ema * offsetRatio), LowerEnvelope = x.Ema - (x.Ema * offsetRatio) @@ -83,9 +80,8 @@ private static IEnumerable MaEnvEpma( int lookbackPeriods, double offsetRatio) => tpList.GetEpma(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Epma, UpperEnvelope = x.Epma + (x.Epma * offsetRatio), LowerEnvelope = x.Epma - (x.Epma * offsetRatio) @@ -96,9 +92,8 @@ private static IEnumerable MaEnvHma( int lookbackPeriods, double offsetRatio) => tpList.GetHma(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Hma, UpperEnvelope = x.Hma + (x.Hma * offsetRatio), LowerEnvelope = x.Hma - (x.Hma * offsetRatio) @@ -109,9 +104,8 @@ private static IEnumerable MaEnvSma( int lookbackPeriods, double offsetRatio) => tpList.GetSma(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Sma, UpperEnvelope = x.Sma + (x.Sma * offsetRatio), LowerEnvelope = x.Sma - (x.Sma * offsetRatio) @@ -122,9 +116,8 @@ private static IEnumerable MaEnvSmma( int lookbackPeriods, double offsetRatio) => tpList.GetSmma(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Smma, UpperEnvelope = x.Smma + (x.Smma * offsetRatio), LowerEnvelope = x.Smma - (x.Smma * offsetRatio) @@ -135,9 +128,8 @@ private static IEnumerable MaEnvTema( int lookbackPeriods, double offsetRatio) => tpList.GetTema(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Tema, UpperEnvelope = x.Tema + (x.Tema * offsetRatio), LowerEnvelope = x.Tema - (x.Tema * offsetRatio) @@ -148,9 +140,8 @@ private static IEnumerable MaEnvWma( int lookbackPeriods, double offsetRatio) => tpList.GetWma(lookbackPeriods) - .Select(x => new MaEnvelopeResult + .Select(x => new MaEnvelopeResult(x.Date) { - Date = x.Date, Centerline = x.Wma, UpperEnvelope = x.Wma + (x.Wma * offsetRatio), LowerEnvelope = x.Wma - (x.Wma * offsetRatio) diff --git a/src/m-r/Macd/Macd.Models.cs b/src/m-r/Macd/Macd.Models.cs index 47060cb93..e989b1a5e 100644 --- a/src/m-r/Macd/Macd.Models.cs +++ b/src/m-r/Macd/Macd.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class MacdResult : ResultBase, IReusableResult { + public MacdResult(DateTime date) + { + Date = date; + } + public double? Macd { get; set; } public double? Signal { get; set; } public double? Histogram { get; set; } diff --git a/src/m-r/Macd/Macd.Series.cs b/src/m-r/Macd/Macd.Series.cs index 8dbbad40e..7708a4bb9 100644 --- a/src/m-r/Macd/Macd.Series.cs +++ b/src/m-r/Macd/Macd.Series.cs @@ -27,27 +27,25 @@ internal static List CalcMacd( EmaResult df = emaFast[i]; EmaResult ds = emaSlow[i]; - MacdResult result = new() + MacdResult r = new(date) { - Date = date, FastEma = df.Ema, SlowEma = ds.Ema }; + results.Add(r); if (i >= slowPeriods - 1 && df.Ema is not null && ds.Ema is not null) { double macd = (double)(df.Ema - ds.Ema); - result.Macd = macd; + r.Macd = macd; // temp data for interim EMA of macd (DateTime, double) diff = (date, macd); emaDiff.Add(diff); } - - results.Add(result); } // add signal and histogram to result diff --git a/src/m-r/Macd/MacdApi.cs b/src/m-r/Macd/MacdApi.cs index ab2c16c47..ffcca6c8b 100644 --- a/src/m-r/Macd/MacdApi.cs +++ b/src/m-r/Macd/MacdApi.cs @@ -22,7 +22,8 @@ public static IEnumerable GetMacd( int slowPeriods = 26, int signalPeriods = 9) => results .ToResultTuple() - .CalcMacd(fastPeriods, slowPeriods, signalPeriods); + .CalcMacd(fastPeriods, slowPeriods, signalPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetMacd( diff --git a/src/m-r/Mama/Mama.Api.cs b/src/m-r/Mama/Mama.Api.cs index e826d1229..27262bd0f 100644 --- a/src/m-r/Mama/Mama.Api.cs +++ b/src/m-r/Mama/Mama.Api.cs @@ -20,7 +20,8 @@ public static IEnumerable GetMama( double fastLimit = 0.5, double slowLimit = 0.05) => results .ToResultTuple() - .CalcMama(fastLimit, slowLimit); + .CalcMama(fastLimit, slowLimit) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetMama( diff --git a/src/m-r/Mama/Mama.Models.cs b/src/m-r/Mama/Mama.Models.cs index 4333ee232..7b18f3b78 100644 --- a/src/m-r/Mama/Mama.Models.cs +++ b/src/m-r/Mama/Mama.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class MamaResult : ResultBase, IReusableResult { + public MamaResult(DateTime date) + { + Date = date; + } + public double? Mama { get; set; } public double? Fama { get; set; } diff --git a/src/m-r/Mama/Mama.Series.cs b/src/m-r/Mama/Mama.Series.cs index ce5f04289..87a8e3e47 100644 --- a/src/m-r/Mama/Mama.Series.cs +++ b/src/m-r/Mama/Mama.Series.cs @@ -42,10 +42,8 @@ internal static List CalcMama( (DateTime date, double value) = tpList[i]; pr[i] = value; - MamaResult r = new() - { - Date = date, - }; + MamaResult r = new(date); + results.Add(r); if (i > 5) { @@ -130,8 +128,6 @@ internal static List CalcMama( ph[i] = 0; } - - results.Add(r); } return results; diff --git a/src/m-r/Mfi/Mfi.Models.cs b/src/m-r/Mfi/Mfi.Models.cs index 86b6eb46f..e4d133454 100644 --- a/src/m-r/Mfi/Mfi.Models.cs +++ b/src/m-r/Mfi/Mfi.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class MfiResult : ResultBase, IReusableResult { + public MfiResult(DateTime date) + { + Date = date; + } + public double? Mfi { get; set; } double? IReusableResult.Value => Mfi; diff --git a/src/m-r/Mfi/Mfi.Series.cs b/src/m-r/Mfi/Mfi.Series.cs index f74460d49..f47115438 100644 --- a/src/m-r/Mfi/Mfi.Series.cs +++ b/src/m-r/Mfi/Mfi.Series.cs @@ -24,10 +24,8 @@ internal static List CalcMfi( { QuoteD q = qdList[i]; - MfiResult result = new() - { - Date = q.Date - }; + MfiResult r = new(q.Date); + results.Add(r); // true price tp[i] = (q.High + q.Low + q.Close) / 3; @@ -49,8 +47,6 @@ internal static List CalcMfi( direction[i] = -1; } - results.Add(result); - prevTP = tp[i]; } diff --git a/src/m-r/Obv/Obv.Models.cs b/src/m-r/Obv/Obv.Models.cs index 84cc7f9ac..2f315ae4a 100644 --- a/src/m-r/Obv/Obv.Models.cs +++ b/src/m-r/Obv/Obv.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ObvResult : ResultBase, IReusableResult { + public ObvResult(DateTime date) + { + Date = date; + } + public double Obv { get; set; } public double? ObvSma { get; set; } diff --git a/src/m-r/Obv/Obv.Series.cs b/src/m-r/Obv/Obv.Series.cs index 69c0f37f5..e2feab466 100644 --- a/src/m-r/Obv/Obv.Series.cs +++ b/src/m-r/Obv/Obv.Series.cs @@ -34,12 +34,11 @@ internal static List CalcObv( obv -= q.Volume; } - ObvResult result = new() + ObvResult r = new(q.Date) { - Date = q.Date, Obv = obv }; - results.Add(result); + results.Add(r); prevClose = q.Close; @@ -52,7 +51,7 @@ internal static List CalcObv( sumSma += results[p].Obv; } - result.ObvSma = sumSma / smaPeriods; + r.ObvSma = sumSma / smaPeriods; } } diff --git a/src/m-r/ParabolicSar/ParabolicSar.Models.cs b/src/m-r/ParabolicSar/ParabolicSar.Models.cs index 71818f6d5..6b70d76b7 100644 --- a/src/m-r/ParabolicSar/ParabolicSar.Models.cs +++ b/src/m-r/ParabolicSar/ParabolicSar.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ParabolicSarResult : ResultBase, IReusableResult { + public ParabolicSarResult(DateTime date) + { + Date = date; + } + public double? Sar { get; set; } public bool? IsReversal { get; set; } diff --git a/src/m-r/ParabolicSar/ParabolicSar.Series.cs b/src/m-r/ParabolicSar/ParabolicSar.Series.cs index 51a7cd9c7..58f2f3a73 100644 --- a/src/m-r/ParabolicSar/ParabolicSar.Series.cs +++ b/src/m-r/ParabolicSar/ParabolicSar.Series.cs @@ -37,10 +37,7 @@ internal static List CalcParabolicSar( { QuoteD? q = qdList[i]; - ParabolicSarResult r = new() - { - Date = q.Date - }; + ParabolicSarResult r = new(q.Date); results.Add(r); // skip first one diff --git a/src/m-r/Pivots/Pivots.Models.cs b/src/m-r/Pivots/Pivots.Models.cs index 899a02bfe..d8231c267 100644 --- a/src/m-r/Pivots/Pivots.Models.cs +++ b/src/m-r/Pivots/Pivots.Models.cs @@ -1,8 +1,13 @@ -namespace Skender.Stock.Indicators; +namespace Skender.Stock.Indicators; [Serializable] public class PivotsResult : ResultBase { + public PivotsResult(DateTime date) + { + Date = date; + } + public decimal? HighPoint { get; set; } public decimal? LowPoint { get; set; } public decimal? HighLine { get; set; } diff --git a/src/m-r/Pivots/Pivots.Series.cs b/src/m-r/Pivots/Pivots.Series.cs index ab679211b..101bb0ddc 100644 --- a/src/m-r/Pivots/Pivots.Series.cs +++ b/src/m-r/Pivots/Pivots.Series.cs @@ -19,9 +19,8 @@ internal static List CalcPivots( List results = quotesList .CalcFractal(leftSpan, rightSpan, endType) - .Select(x => new PivotsResult + .Select(x => new PivotsResult(x.Date) { - Date = x.Date, HighPoint = x.FractalBear, LowPoint = x.FractalBull }) diff --git a/src/m-r/Pmo/Pmo.Api.cs b/src/m-r/Pmo/Pmo.Api.cs index b22bd873c..c8c5d6975 100644 --- a/src/m-r/Pmo/Pmo.Api.cs +++ b/src/m-r/Pmo/Pmo.Api.cs @@ -22,7 +22,8 @@ public static IEnumerable GetPmo( int smoothPeriods = 20, int signalPeriods = 10) => results .ToResultTuple() - .CalcPmo(timePeriods, smoothPeriods, signalPeriods); + .CalcPmo(timePeriods, smoothPeriods, signalPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetPmo( diff --git a/src/m-r/Pmo/Pmo.Models.cs b/src/m-r/Pmo/Pmo.Models.cs index e39d65e70..c46c40236 100644 --- a/src/m-r/Pmo/Pmo.Models.cs +++ b/src/m-r/Pmo/Pmo.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class PmoResult : ResultBase, IReusableResult { + public PmoResult(DateTime date) + { + Date = date; + } + public double? Pmo { get; set; } public double? Signal { get; set; } diff --git a/src/m-r/Pmo/Pmo.Series.cs b/src/m-r/Pmo/Pmo.Series.cs index b1cec36d4..0323e96a1 100644 --- a/src/m-r/Pmo/Pmo.Series.cs +++ b/src/m-r/Pmo/Pmo.Series.cs @@ -64,16 +64,14 @@ private static List CalcPmoRocEma( for (int i = 0; i < roc.Count; i++) { - RocResult r = roc[i]; + RocResult rocResult = roc[i]; - PmoResult result = new() - { - Date = r.Date - }; + PmoResult r = new(rocResult.Date); + results.Add(r); if (i + 1 > startIndex) { - result.RocEma = (r.Roc * smoothingMultiplier) + (lastRocEma * (1 - smoothingMultiplier)); + r.RocEma = (rocResult.Roc * smoothingMultiplier) + (lastRocEma * (1 - smoothingMultiplier)); } else if (i + 1 == startIndex) { @@ -84,12 +82,11 @@ private static List CalcPmoRocEma( sumRoc += d.Roc; } - result.RocEma = sumRoc / timePeriods; + r.RocEma = sumRoc / timePeriods; } - lastRocEma = result.RocEma; - result.RocEma *= 10; - results.Add(result); + lastRocEma = r.RocEma; + r.RocEma *= 10; } return results; diff --git a/src/m-r/Prs/Prs.Models.cs b/src/m-r/Prs/Prs.Models.cs index 38f8ab174..20c884fef 100644 --- a/src/m-r/Prs/Prs.Models.cs +++ b/src/m-r/Prs/Prs.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class PrsResult : ResultBase, IReusableResult { + public PrsResult(DateTime date) + { + Date = date; + } + public double? Prs { get; set; } public double? PrsSma { get; set; } public double? PrsPercent { get; set; } diff --git a/src/m-r/Prs/Prs.Series.cs b/src/m-r/Prs/Prs.Series.cs index f0b83bd59..f61cfc814 100644 --- a/src/m-r/Prs/Prs.Series.cs +++ b/src/m-r/Prs/Prs.Series.cs @@ -27,9 +27,8 @@ internal static List CalcPrs( "Date sequence does not match. Price Relative requires matching dates in provided histories."); } - PrsResult r = new() + PrsResult r = new(eDate) { - Date = eDate, Prs = (bValue == 0) ? null : (eValue / bValue) // relative strength ratio }; results.Add(r); diff --git a/src/m-r/Pvo/Pvo.Models.cs b/src/m-r/Pvo/Pvo.Models.cs index 83f5ed7a8..98e6966a8 100644 --- a/src/m-r/Pvo/Pvo.Models.cs +++ b/src/m-r/Pvo/Pvo.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class PvoResult : ResultBase, IReusableResult { + public PvoResult(DateTime date) + { + Date = date; + } + public double? Pvo { get; set; } public double? Signal { get; set; } public double? Histogram { get; set; } diff --git a/src/m-r/Pvo/Pvo.Series.cs b/src/m-r/Pvo/Pvo.Series.cs index ea9ae38ca..c1a574341 100644 --- a/src/m-r/Pvo/Pvo.Series.cs +++ b/src/m-r/Pvo/Pvo.Series.cs @@ -27,25 +27,21 @@ internal static List CalcPvo( EmaResult df = emaFast[i]; EmaResult ds = emaSlow[i]; - PvoResult result = new() - { - Date = date - }; + PvoResult r = new(date); + results.Add(r); if (i >= slowPeriods - 1) { double? pvo = (ds.Ema != 0) ? 100 * (double?)((df.Ema - ds.Ema) / ds.Ema) : null; - result.Pvo = pvo; + r.Pvo = pvo; // temp data for interim EMA of PVO (DateTime, double) diff = (date, (pvo == null) ? 0 : (double)pvo); emaDiff.Add(diff); } - - results.Add(result); } // add signal and histogram to result diff --git a/src/m-r/Renko/Renko.Models.cs b/src/m-r/Renko/Renko.Models.cs index a2afb1185..a85e45c78 100644 --- a/src/m-r/Renko/Renko.Models.cs +++ b/src/m-r/Renko/Renko.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class RenkoResult : ResultBase, IQuote { + public RenkoResult(DateTime date) + { + Date = date; + } + public decimal Open { get; set; } public decimal High { get; set; } public decimal Low { get; set; } diff --git a/src/m-r/Renko/Renko.Series.cs b/src/m-r/Renko/Renko.Series.cs index eb1db2072..8118d210e 100644 --- a/src/m-r/Renko/Renko.Series.cs +++ b/src/m-r/Renko/Renko.Series.cs @@ -68,9 +68,8 @@ internal static List CalcRenko( decimal brickClose = newBrickQty > 0 ? o + brickSize : o - brickSize; - RenkoResult result = new() + RenkoResult result = new(q.Date) { - Date = q.Date, Open = o, High = h, Low = l, diff --git a/src/m-r/Roc/Roc.Api.cs b/src/m-r/Roc/Roc.Api.cs index 38b5f0ecb..5450dd2dd 100644 --- a/src/m-r/Roc/Roc.Api.cs +++ b/src/m-r/Roc/Roc.Api.cs @@ -20,7 +20,8 @@ public static IEnumerable GetRoc( int lookbackPeriods, int? smaPeriods = null) => results .ToResultTuple() - .CalcRoc(lookbackPeriods, smaPeriods); + .CalcRoc(lookbackPeriods, smaPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetRoc( diff --git a/src/m-r/Roc/Roc.Models.cs b/src/m-r/Roc/Roc.Models.cs index 3bde09ca5..2c764a9a7 100644 --- a/src/m-r/Roc/Roc.Models.cs +++ b/src/m-r/Roc/Roc.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class RocResult : ResultBase, IReusableResult { + public RocResult(DateTime date) + { + Date = date; + } + public double? Roc { get; set; } public double? RocSma { get; set; } diff --git a/src/m-r/Roc/Roc.Series.cs b/src/m-r/Roc/Roc.Series.cs index eb48489fd..d222bb2b6 100644 --- a/src/m-r/Roc/Roc.Series.cs +++ b/src/m-r/Roc/Roc.Series.cs @@ -19,21 +19,17 @@ internal static List CalcRoc( { (DateTime date, double value) = tpList[i]; - RocResult result = new() - { - Date = date - }; + RocResult r = new(date); + results.Add(r); if (i + 1 > lookbackPeriods) { (DateTime _, double backValue) = tpList[i - lookbackPeriods]; - result.Roc = (backValue == 0) ? null + r.Roc = (backValue == 0) ? null : 100d * (value - backValue) / backValue; } - results.Add(result); - // optional SMA if (smaPeriods != null && i + 1 >= lookbackPeriods + smaPeriods) { @@ -43,7 +39,7 @@ internal static List CalcRoc( sumSma += results[p].Roc; } - result.RocSma = sumSma / smaPeriods; + r.RocSma = sumSma / smaPeriods; } } diff --git a/src/m-r/RocWb/Roc.Models.cs b/src/m-r/RocWb/Roc.Models.cs index b534ee5f0..3b46dd0b5 100644 --- a/src/m-r/RocWb/Roc.Models.cs +++ b/src/m-r/RocWb/Roc.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class RocWbResult : ResultBase, IReusableResult { + public RocWbResult(DateTime date) + { + Date = date; + } + public double? Roc { get; set; } public double? RocEma { get; set; } public double? UpperBand { get; set; } diff --git a/src/m-r/RocWb/RocWb.Api.cs b/src/m-r/RocWb/RocWb.Api.cs index 538ef2cf4..a69aae2bb 100644 --- a/src/m-r/RocWb/RocWb.Api.cs +++ b/src/m-r/RocWb/RocWb.Api.cs @@ -22,7 +22,8 @@ public static IEnumerable GetRocWb( int emaPeriods, int stdDevPeriods) => results .ToResultTuple() - .CalcRocWb(lookbackPeriods, emaPeriods, stdDevPeriods); + .CalcRocWb(lookbackPeriods, emaPeriods, stdDevPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetRocWb( diff --git a/src/m-r/RocWb/RocWb.Series.cs b/src/m-r/RocWb/RocWb.Series.cs index e71f8b268..5d6715ef1 100644 --- a/src/m-r/RocWb/RocWb.Series.cs +++ b/src/m-r/RocWb/RocWb.Series.cs @@ -15,9 +15,8 @@ internal static List CalcRocWb( // initialize List results = tpList .CalcRoc(lookbackPeriods, null) - .Select(x => new RocWbResult + .Select(x => new RocWbResult(x.Date) { - Date = x.Date, Roc = x.Roc }) .ToList(); diff --git a/src/m-r/Rsi/Rsi.Api.cs b/src/m-r/Rsi/Rsi.Api.cs index d56d75c25..c730605a8 100644 --- a/src/m-r/Rsi/Rsi.Api.cs +++ b/src/m-r/Rsi/Rsi.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetRsi( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcRsi(lookbackPeriods); + .CalcRsi(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetRsi( diff --git a/src/m-r/Rsi/Rsi.Models.cs b/src/m-r/Rsi/Rsi.Models.cs index 652ca3e2b..d0d2268e6 100644 --- a/src/m-r/Rsi/Rsi.Models.cs +++ b/src/m-r/Rsi/Rsi.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class RsiResult : ResultBase, IReusableResult { + public RsiResult(DateTime date) + { + Date = date; + } + public double? Rsi { get; set; } double? IReusableResult.Value => Rsi; diff --git a/src/m-r/Rsi/Rsi.Series.cs b/src/m-r/Rsi/Rsi.Series.cs index b138cd5c1..41b1dafb2 100644 --- a/src/m-r/Rsi/Rsi.Series.cs +++ b/src/m-r/Rsi/Rsi.Series.cs @@ -34,10 +34,7 @@ internal static List CalcRsi( { (DateTime date, double value) = tpList[i]; - RsiResult r = new() - { - Date = date - }; + RsiResult r = new(date); results.Add(r); gain[i] = (value > lastValue) ? value - lastValue : 0; diff --git a/src/s-z/Slope/Slope.Api.cs b/src/s-z/Slope/Slope.Api.cs index ed3ba3eb6..a6ed0f3dc 100644 --- a/src/s-z/Slope/Slope.Api.cs +++ b/src/s-z/Slope/Slope.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetSlope( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcSlope(lookbackPeriods); + .CalcSlope(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetSlope( diff --git a/src/s-z/Slope/Slope.Models.cs b/src/s-z/Slope/Slope.Models.cs index e661aa25f..202dd32db 100644 --- a/src/s-z/Slope/Slope.Models.cs +++ b/src/s-z/Slope/Slope.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class SlopeResult : ResultBase, IReusableResult { + public SlopeResult(DateTime date) + { + Date = date; + } + public double? Slope { get; set; } public double? Intercept { get; set; } public double? StdDev { get; set; } diff --git a/src/s-z/Slope/Slope.Series.cs b/src/s-z/Slope/Slope.Series.cs index cb8e1c5e8..ba6af575c 100644 --- a/src/s-z/Slope/Slope.Series.cs +++ b/src/s-z/Slope/Slope.Series.cs @@ -20,11 +20,7 @@ internal static List CalcSlope( { (DateTime date, double _) = tpList[i]; - SlopeResult r = new() - { - Date = date - }; - + SlopeResult r = new(date); results.Add(r); // skip initialization period diff --git a/src/s-z/Sma/Sma.Analysis.cs b/src/s-z/Sma/Sma.Analysis.cs index bd617dd87..296153f98 100644 --- a/src/s-z/Sma/Sma.Analysis.cs +++ b/src/s-z/Sma/Sma.Analysis.cs @@ -10,7 +10,7 @@ internal static IEnumerable CalcSmaAnalysis( // initialize List? results = tpList .CalcSma(lookbackPeriods) - .Select(x => new SmaAnalysis { Date = x.Date, Sma = x.Sma }) + .Select(x => new SmaAnalysis(x.Date) { Sma = x.Sma }) .ToList(); // roll through quotes diff --git a/src/s-z/Sma/Sma.Api.cs b/src/s-z/Sma/Sma.Api.cs index 82e552bed..999bec338 100644 --- a/src/s-z/Sma/Sma.Api.cs +++ b/src/s-z/Sma/Sma.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetSma( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcSma(lookbackPeriods); + .CalcSma(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetSma( @@ -42,7 +43,8 @@ public static IEnumerable GetSmaAnalysis( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcSmaAnalysis(lookbackPeriods); + .CalcSmaAnalysis(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // ANALYSIS, from TUPLE public static IEnumerable GetSmaAnalysis( diff --git a/src/s-z/Sma/Sma.Models.cs b/src/s-z/Sma/Sma.Models.cs index 9fd12b007..04f6371f5 100644 --- a/src/s-z/Sma/Sma.Models.cs +++ b/src/s-z/Sma/Sma.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class SmaResult : ResultBase, IReusableResult { + public SmaResult(DateTime date) + { + Date = date; + } + public double? Sma { get; set; } double? IReusableResult.Value => Sma; @@ -11,6 +16,11 @@ public sealed class SmaResult : ResultBase, IReusableResult [Serializable] public sealed class SmaAnalysis : ResultBase, IReusableResult { + public SmaAnalysis(DateTime date) + { + Date = date; + } + public double? Sma { get; set; } // simple moving average public double? Mad { get; set; } // mean absolute deviation public double? Mse { get; set; } // mean square error diff --git a/src/s-z/Sma/Sma.Series.cs b/src/s-z/Sma/Sma.Series.cs index f9b2b1bfa..ba7ff29c1 100644 --- a/src/s-z/Sma/Sma.Series.cs +++ b/src/s-z/Sma/Sma.Series.cs @@ -18,10 +18,8 @@ internal static List CalcSma( { (DateTime date, double _) = tpList[i]; - SmaResult result = new() - { - Date = date - }; + SmaResult result = new(date); + results.Add(result); if (i + 1 >= lookbackPeriods) { @@ -34,8 +32,6 @@ internal static List CalcSma( result.Sma = sumSma / lookbackPeriods; } - - results.Add(result); } return results; diff --git a/src/s-z/Smi/Smi.Models.cs b/src/s-z/Smi/Smi.Models.cs index 9360b1514..d0fc2018e 100644 --- a/src/s-z/Smi/Smi.Models.cs +++ b/src/s-z/Smi/Smi.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class SmiResult : ResultBase, IReusableResult { + public SmiResult(DateTime date) + { + Date = date; + } + public double? Smi { get; set; } public double? Signal { get; set; } diff --git a/src/s-z/Smi/Smi.Series.cs b/src/s-z/Smi/Smi.Series.cs index 1762d14f2..7eb6f3148 100644 --- a/src/s-z/Smi/Smi.Series.cs +++ b/src/s-z/Smi/Smi.Series.cs @@ -36,10 +36,8 @@ internal static List CalcSmi( { QuoteD q = qdList[i]; - SmiResult r = new() - { - Date = q.Date - }; + SmiResult r = new(q.Date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -102,8 +100,6 @@ internal static List CalcSmi( lastHlEma2 = hlEma2; lastSignal = signal; } - - results.Add(r); } return results; diff --git a/src/s-z/Smma/Smma.Api.cs b/src/s-z/Smma/Smma.Api.cs index ef7ee8e31..61e92572c 100644 --- a/src/s-z/Smma/Smma.Api.cs +++ b/src/s-z/Smma/Smma.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetSmma( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcSmma(lookbackPeriods); + .CalcSmma(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetSmma( diff --git a/src/s-z/Smma/Smma.Models.cs b/src/s-z/Smma/Smma.Models.cs index 0ca5e734d..d685792b4 100644 --- a/src/s-z/Smma/Smma.Models.cs +++ b/src/s-z/Smma/Smma.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class SmmaResult : ResultBase, IReusableResult { + public SmmaResult(DateTime date) + { + Date = date; + } + public double? Smma { get; set; } double? IReusableResult.Value => Smma; diff --git a/src/s-z/Smma/Smma.Series.cs b/src/s-z/Smma/Smma.Series.cs index 5c6895e93..10ed19e32 100644 --- a/src/s-z/Smma/Smma.Series.cs +++ b/src/s-z/Smma/Smma.Series.cs @@ -22,16 +22,14 @@ internal static List CalcSmma( double smma = double.NaN; (DateTime date, double value) = tpList[i]; - SmmaResult result = new() - { - Date = date - }; + SmmaResult r = new(date); + results.Add(r); // calculate SMMA if (i + 1 > lookbackPeriods) { smma = ((prevValue * (lookbackPeriods - 1)) + value) / lookbackPeriods; - result.Smma = smma; + r.Smma = smma; } // first SMMA calculated as simple SMA @@ -45,11 +43,10 @@ internal static List CalcSmma( } smma = sumClose / lookbackPeriods; - result.Smma = smma; + r.Smma = smma; } prevValue = smma; - results.Add(result); } return results; diff --git a/src/s-z/StarcBands/StarcBands.Models.cs b/src/s-z/StarcBands/StarcBands.Models.cs index e4ff4bcf1..09c275abf 100644 --- a/src/s-z/StarcBands/StarcBands.Models.cs +++ b/src/s-z/StarcBands/StarcBands.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class StarcBandsResult : ResultBase { + public StarcBandsResult(DateTime date) + { + Date = date; + } + public double? UpperBand { get; set; } public double? Centerline { get; set; } public double? LowerBand { get; set; } diff --git a/src/s-z/StarcBands/StarcBands.Series.cs b/src/s-z/StarcBands/StarcBands.Series.cs index 5605b2529..6c8a1c248 100644 --- a/src/s-z/StarcBands/StarcBands.Series.cs +++ b/src/s-z/StarcBands/StarcBands.Series.cs @@ -18,9 +18,8 @@ internal static List CalcStarcBands( List results = qdList .ToBasicTuple(CandlePart.Close) .CalcSma(smaPeriods) - .Select(x => new StarcBandsResult + .Select(x => new StarcBandsResult(x.Date) { - Date = x.Date, Centerline = x.Sma }) .ToList(); diff --git a/src/s-z/Stc/Stc.Api.cs b/src/s-z/Stc/Stc.Api.cs index 0dadd4870..80563c2b1 100644 --- a/src/s-z/Stc/Stc.Api.cs +++ b/src/s-z/Stc/Stc.Api.cs @@ -22,7 +22,8 @@ public static IEnumerable GetStc( int fastPeriods = 23, int slowPeriods = 50) => results .ToResultTuple() - .CalcStc(cyclePeriods, fastPeriods, slowPeriods); + .CalcStc(cyclePeriods, fastPeriods, slowPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetStc( diff --git a/src/s-z/Stc/Stc.Models.cs b/src/s-z/Stc/Stc.Models.cs index cb0c13501..51a781e9c 100644 --- a/src/s-z/Stc/Stc.Models.cs +++ b/src/s-z/Stc/Stc.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class StcResult : ResultBase, IReusableResult { + public StcResult(DateTime date) + { + Date = date; + } + public double? Stc { get; set; } double? IReusableResult.Value => Stc; diff --git a/src/s-z/Stc/Stc.Series.cs b/src/s-z/Stc/Stc.Series.cs index 671526e79..e54ad05e3 100644 --- a/src/s-z/Stc/Stc.Series.cs +++ b/src/s-z/Stc/Stc.Series.cs @@ -22,7 +22,7 @@ internal static List CalcStc( for (int i = 0; i < initPeriods; i++) { (DateTime date, double _) = tpList[i]; - results.Add(new StcResult() { Date = date }); + results.Add(new StcResult(date)); } // get stochastic of macd @@ -44,7 +44,7 @@ internal static List CalcStc( for (int i = 0; i < stochMacd.Count; i++) { StochResult r = stochMacd[i]; - results.Add(new StcResult { Date = r.Date, Stc = r.Oscillator }); + results.Add(new StcResult(r.Date) { Stc = r.Oscillator }); } return results; diff --git a/src/s-z/StdDev/StdDev.Api.cs b/src/s-z/StdDev/StdDev.Api.cs index 58f0ad2b3..9ae27e84f 100644 --- a/src/s-z/StdDev/StdDev.Api.cs +++ b/src/s-z/StdDev/StdDev.Api.cs @@ -20,7 +20,8 @@ public static IEnumerable GetStdDev( int lookbackPeriods, int? smaPeriods = null) => results .ToResultTuple() - .CalcStdDev(lookbackPeriods, smaPeriods); + .CalcStdDev(lookbackPeriods, smaPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetStdDev( diff --git a/src/s-z/StdDev/StdDev.Models.cs b/src/s-z/StdDev/StdDev.Models.cs index 91a9f209c..78768abfd 100644 --- a/src/s-z/StdDev/StdDev.Models.cs +++ b/src/s-z/StdDev/StdDev.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class StdDevResult : ResultBase, IReusableResult { + public StdDevResult(DateTime date) + { + Date = date; + } + public double? StdDev { get; set; } public double? Mean { get; set; } public double? ZScore { get; set; } diff --git a/src/s-z/StdDev/StdDev.Series.cs b/src/s-z/StdDev/StdDev.Series.cs index 9a460962d..66684ef1c 100644 --- a/src/s-z/StdDev/StdDev.Series.cs +++ b/src/s-z/StdDev/StdDev.Series.cs @@ -20,10 +20,8 @@ internal static List CalcStdDev( { (DateTime date, double value) = tpList[i]; - StdDevResult result = new() - { - Date = date, - }; + StdDevResult r = new(date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -41,15 +39,13 @@ internal static List CalcStdDev( double periodAvg = sum / lookbackPeriods; - result.StdDev = periodValues.StdDev(); - result.Mean = periodAvg; + r.StdDev = periodValues.StdDev(); + r.Mean = periodAvg; - result.ZScore = (result.StdDev == 0) ? double.NaN - : (value - periodAvg) / result.StdDev; + r.ZScore = (r.StdDev == 0) ? double.NaN + : (value - periodAvg) / r.StdDev; } - results.Add(result); - // optional SMA if (smaPeriods != null && i >= lookbackPeriods + smaPeriods - 2) { @@ -59,7 +55,7 @@ internal static List CalcStdDev( sumSma += results[p].StdDev; } - result.StdDevSma = sumSma / smaPeriods; + r.StdDevSma = sumSma / smaPeriods; } } diff --git a/src/s-z/StdDevChannels/StdDevChannels.Api.cs b/src/s-z/StdDevChannels/StdDevChannels.Api.cs index bf7a53102..ca51f3308 100644 --- a/src/s-z/StdDevChannels/StdDevChannels.Api.cs +++ b/src/s-z/StdDevChannels/StdDevChannels.Api.cs @@ -20,7 +20,8 @@ public static IEnumerable GetStdDevChannels( int? lookbackPeriods = 20, double standardDeviations = 2) => results .ToResultTuple() - .CalcStdDevChannels(lookbackPeriods, standardDeviations); + .CalcStdDevChannels(lookbackPeriods, standardDeviations) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetStdDevChannels( diff --git a/src/s-z/StdDevChannels/StdDevChannels.Models.cs b/src/s-z/StdDevChannels/StdDevChannels.Models.cs index 62fa2e122..00da6a900 100644 --- a/src/s-z/StdDevChannels/StdDevChannels.Models.cs +++ b/src/s-z/StdDevChannels/StdDevChannels.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class StdDevChannelsResult : ResultBase { + public StdDevChannelsResult(DateTime date) + { + Date = date; + } + public double? Centerline { get; set; } public double? UpperChannel { get; set; } public double? LowerChannel { get; set; } diff --git a/src/s-z/StdDevChannels/StdDevChannels.Series.cs b/src/s-z/StdDevChannels/StdDevChannels.Series.cs index 031e48c0e..f6727bb87 100644 --- a/src/s-z/StdDevChannels/StdDevChannels.Series.cs +++ b/src/s-z/StdDevChannels/StdDevChannels.Series.cs @@ -23,7 +23,7 @@ internal static List CalcStdDevChannels( int length = slopeResults.Count; List results = slopeResults - .Select(x => new StdDevChannelsResult { Date = x.Date }) + .Select(x => new StdDevChannelsResult(x.Date)) .ToList(); // roll through quotes in reverse diff --git a/src/s-z/Stoch/Stoch.Models.cs b/src/s-z/Stoch/Stoch.Models.cs index 4e2be1417..c1099e1df 100644 --- a/src/s-z/Stoch/Stoch.Models.cs +++ b/src/s-z/Stoch/Stoch.Models.cs @@ -5,6 +5,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class StochResult : ResultBase, IReusableResult { + public StochResult(DateTime date) + { + Date = date; + } + public double? Oscillator { get; set; } public double? Signal { get; set; } public double? PercentJ { get; set; } diff --git a/src/s-z/Stoch/Stoch.Series.cs b/src/s-z/Stoch/Stoch.Series.cs index 4fc657ef1..d3992a8c3 100644 --- a/src/s-z/Stoch/Stoch.Series.cs +++ b/src/s-z/Stoch/Stoch.Series.cs @@ -26,10 +26,8 @@ internal static List CalcStoch( { QuoteD q = qdList[i]; - StochResult result = new() - { - Date = q.Date - }; + StochResult r = new(q.Date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -51,12 +49,10 @@ internal static List CalcStoch( } } - result.Oscillator = lowLow != highHigh + r.Oscillator = lowLow != highHigh ? 100 * (q.Close - lowLow) / (highHigh - lowLow) : 0; } - - results.Add(result); } // smooth the oscillator diff --git a/src/s-z/StochRsi/StochRsi.Models.cs b/src/s-z/StochRsi/StochRsi.Models.cs index 6db2b62d9..96c2b4f04 100644 --- a/src/s-z/StochRsi/StochRsi.Models.cs +++ b/src/s-z/StochRsi/StochRsi.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class StochRsiResult : ResultBase, IReusableResult { + public StochRsiResult(DateTime date) + { + Date = date; + } + public double? StochRsi { get; set; } public double? Signal { get; set; } diff --git a/src/s-z/StochRsi/StochRsi.Series.cs b/src/s-z/StochRsi/StochRsi.Series.cs index 910ac8ca7..ecf554654 100644 --- a/src/s-z/StochRsi/StochRsi.Series.cs +++ b/src/s-z/StochRsi/StochRsi.Series.cs @@ -23,7 +23,7 @@ internal static List CalcStochRsi( for (int i = 0; i < initPeriods; i++) { (DateTime date, double _) = tpList[i]; - results.Add(new StochRsiResult() { Date = date }); + results.Add(new StochRsiResult(date)); } // get Stochastic of RSI @@ -50,9 +50,8 @@ internal static List CalcStochRsi( for (int i = rsiPeriods + stochPeriods - 1; i < length; i++) { StochResult r = stoResults[i - rsiPeriods]; - results.Add(new StochRsiResult + results.Add(new StochRsiResult(r.Date) { - Date = r.Date, StochRsi = r.Oscillator, Signal = r.Signal }); diff --git a/src/s-z/SuperTrend/SuperTrend.Models.cs b/src/s-z/SuperTrend/SuperTrend.Models.cs index 919db0e07..cd8063612 100644 --- a/src/s-z/SuperTrend/SuperTrend.Models.cs +++ b/src/s-z/SuperTrend/SuperTrend.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class SuperTrendResult : ResultBase { + public SuperTrendResult(DateTime date) + { + Date = date; + } + public decimal? SuperTrend { get; set; } public decimal? UpperBand { get; set; } public decimal? LowerBand { get; set; } diff --git a/src/s-z/SuperTrend/SuperTrend.Series.cs b/src/s-z/SuperTrend/SuperTrend.Series.cs index 0e92ef7ca..22de2b8d3 100644 --- a/src/s-z/SuperTrend/SuperTrend.Series.cs +++ b/src/s-z/SuperTrend/SuperTrend.Series.cs @@ -24,10 +24,8 @@ internal static List CalcSuperTrend( { QuoteD q = qdList[i]; - SuperTrendResult r = new() - { - Date = q.Date - }; + SuperTrendResult r = new(q.Date); + results.Add(r); if (i >= lookbackPeriods - 1) { @@ -74,8 +72,6 @@ internal static List CalcSuperTrend( isBullish = true; } } - - results.Add(r); } return results; diff --git a/src/s-z/T3/T3.Api.cs b/src/s-z/T3/T3.Api.cs index b98330022..25be8b7e4 100644 --- a/src/s-z/T3/T3.Api.cs +++ b/src/s-z/T3/T3.Api.cs @@ -20,7 +20,8 @@ public static IEnumerable GetT3( int lookbackPeriods = 5, double volumeFactor = 0.7) => results .ToResultTuple() - .CalcT3(lookbackPeriods, volumeFactor); + .CalcT3(lookbackPeriods, volumeFactor) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetT3( diff --git a/src/s-z/T3/T3.Models.cs b/src/s-z/T3/T3.Models.cs index e8a142a12..be3814a92 100644 --- a/src/s-z/T3/T3.Models.cs +++ b/src/s-z/T3/T3.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class T3Result : ResultBase, IReusableResult { + public T3Result(DateTime date) + { + Date = date; + } + public double? T3 { get; set; } double? IReusableResult.Value => T3; diff --git a/src/s-z/T3/T3.Series.cs b/src/s-z/T3/T3.Series.cs index 3d35aaa1a..02a19d403 100644 --- a/src/s-z/T3/T3.Series.cs +++ b/src/s-z/T3/T3.Series.cs @@ -29,10 +29,8 @@ internal static List CalcT3( for (int i = 0; i < length; i++) { (DateTime date, double value) = tpList[i]; - T3Result r = new() - { - Date = date - }; + T3Result r = new(date); + results.Add(r); // first smoothing if (i > lookbackPeriods - 1) @@ -141,8 +139,6 @@ internal static List CalcT3( sum2 = e1 = sum1 / lookbackPeriods; } } - - results.Add(r); } return results; diff --git a/src/s-z/Tema/Tema.Api.cs b/src/s-z/Tema/Tema.Api.cs index 959a77ec2..6353e3743 100644 --- a/src/s-z/Tema/Tema.Api.cs +++ b/src/s-z/Tema/Tema.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetTema( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcTema(lookbackPeriods); + .CalcTema(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetTema( diff --git a/src/s-z/Tema/Tema.Models.cs b/src/s-z/Tema/Tema.Models.cs index 2adbf5dca..145a7548a 100644 --- a/src/s-z/Tema/Tema.Models.cs +++ b/src/s-z/Tema/Tema.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class TemaResult : ResultBase, IReusableResult { + public TemaResult(DateTime date) + { + Date = date; + } + public double? Tema { get; set; } double? IReusableResult.Value => Tema; diff --git a/src/s-z/Tema/Tema.Series.cs b/src/s-z/Tema/Tema.Series.cs index 43b97f150..c10101adf 100644 --- a/src/s-z/Tema/Tema.Series.cs +++ b/src/s-z/Tema/Tema.Series.cs @@ -35,10 +35,8 @@ internal static List CalcTema( { (DateTime date, double value) = tpList[i]; - TemaResult result = new() - { - Date = date - }; + TemaResult r = new(date); + results.Add(r); if (i > lookbackPeriods - 1) { @@ -46,7 +44,7 @@ internal static List CalcTema( double? ema2 = lastEma2 + (k * (ema1 - lastEma2)); double? ema3 = lastEma3 + (k * (ema2 - lastEma3)); - result.Tema = (3 * ema1) - (3 * ema2) + ema3; + r.Tema = (3 * ema1) - (3 * ema2) + ema3; lastEma1 = ema1; lastEma2 = ema2; @@ -54,10 +52,8 @@ internal static List CalcTema( } else if (i == lookbackPeriods - 1) { - result.Tema = (3 * lastEma1) - (3 * lastEma2) + lastEma3; + r.Tema = (3 * lastEma1) - (3 * lastEma2) + lastEma3; } - - results.Add(result); } return results; diff --git a/src/s-z/Trix/Trix.Api.cs b/src/s-z/Trix/Trix.Api.cs index 98ace0f79..58b88f0c3 100644 --- a/src/s-z/Trix/Trix.Api.cs +++ b/src/s-z/Trix/Trix.Api.cs @@ -20,7 +20,8 @@ public static IEnumerable GetTrix( int lookbackPeriods, int? signalPeriods = null) => results .ToResultTuple() - .CalcTrix(lookbackPeriods, signalPeriods); + .CalcTrix(lookbackPeriods, signalPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetTrix( diff --git a/src/s-z/Trix/Trix.Models.cs b/src/s-z/Trix/Trix.Models.cs index c4e15c29f..de69555be 100644 --- a/src/s-z/Trix/Trix.Models.cs +++ b/src/s-z/Trix/Trix.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class TrixResult : ResultBase, IReusableResult { + public TrixResult(DateTime date) + { + Date = date; + } + public double? Ema3 { get; set; } public double? Trix { get; set; } public double? Signal { get; set; } diff --git a/src/s-z/Trix/Trix.Series.cs b/src/s-z/Trix/Trix.Series.cs index 427d3a15c..bbeb0ea59 100644 --- a/src/s-z/Trix/Trix.Series.cs +++ b/src/s-z/Trix/Trix.Series.cs @@ -34,10 +34,8 @@ internal static List CalcTrix( { (DateTime date, double value) = tpList[i]; - TrixResult result = new() - { - Date = date - }; + TrixResult r = new(date); + results.Add(r); if (i >= lookbackPeriods) { @@ -45,16 +43,14 @@ internal static List CalcTrix( double? ema2 = lastEma2 + (k * (ema1 - lastEma2)); double? ema3 = lastEma3 + (k * (ema2 - lastEma3)); - result.Ema3 = ema3; - result.Trix = 100 * (ema3 - lastEma3) / lastEma3; + r.Ema3 = ema3; + r.Trix = 100 * (ema3 - lastEma3) / lastEma3; lastEma1 = ema1; lastEma2 = ema2; lastEma3 = ema3; } - results.Add(result); - // optional SMA signal CalcTrixSignal(signalPeriods, i, lookbackPeriods, results); } diff --git a/src/s-z/Tsi/Tsi.Api.cs b/src/s-z/Tsi/Tsi.Api.cs index a39776df6..5507f7859 100644 --- a/src/s-z/Tsi/Tsi.Api.cs +++ b/src/s-z/Tsi/Tsi.Api.cs @@ -22,7 +22,8 @@ public static IEnumerable GetTsi( int smoothPeriods = 13, int signalPeriods = 7) => results .ToResultTuple() - .CalcTsi(lookbackPeriods, smoothPeriods, signalPeriods); + .CalcTsi(lookbackPeriods, smoothPeriods, signalPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetTsi( diff --git a/src/s-z/Tsi/Tsi.Models.cs b/src/s-z/Tsi/Tsi.Models.cs index 74629e38c..c01f12784 100644 --- a/src/s-z/Tsi/Tsi.Models.cs +++ b/src/s-z/Tsi/Tsi.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class TsiResult : ResultBase, IReusableResult { + public TsiResult(DateTime date) + { + Date = date; + } + public double? Tsi { get; set; } public double? Signal { get; set; } diff --git a/src/s-z/Tsi/Tsi.Series.cs b/src/s-z/Tsi/Tsi.Series.cs index bcb0f7f2c..7d255aacf 100644 --- a/src/s-z/Tsi/Tsi.Series.cs +++ b/src/s-z/Tsi/Tsi.Series.cs @@ -38,10 +38,7 @@ internal static List CalcTsi( { (DateTime date, double value) = tpList[i]; - TsiResult r = new() - { - Date = date - }; + TsiResult r = new(date); results.Add(r); // skip first period diff --git a/src/s-z/UlcerIndex/UlcerIndex.Api.cs b/src/s-z/UlcerIndex/UlcerIndex.Api.cs index 35c625948..57208577e 100644 --- a/src/s-z/UlcerIndex/UlcerIndex.Api.cs +++ b/src/s-z/UlcerIndex/UlcerIndex.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetUlcerIndex( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcUlcerIndex(lookbackPeriods); + .CalcUlcerIndex(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetUlcerIndex( diff --git a/src/s-z/UlcerIndex/UlcerIndex.Models.cs b/src/s-z/UlcerIndex/UlcerIndex.Models.cs index eee50091a..81064ae3b 100644 --- a/src/s-z/UlcerIndex/UlcerIndex.Models.cs +++ b/src/s-z/UlcerIndex/UlcerIndex.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class UlcerIndexResult : ResultBase, IReusableResult { + public UlcerIndexResult(DateTime date) + { + Date = date; + } + public double? UI { get; set; } // ulcer index double? IReusableResult.Value => UI; diff --git a/src/s-z/UlcerIndex/UlcerIndex.Series.cs b/src/s-z/UlcerIndex/UlcerIndex.Series.cs index 2ec42b9b6..54cb789ac 100644 --- a/src/s-z/UlcerIndex/UlcerIndex.Series.cs +++ b/src/s-z/UlcerIndex/UlcerIndex.Series.cs @@ -18,10 +18,8 @@ internal static List CalcUlcerIndex( { (DateTime date, double _) = tpList[i]; - UlcerIndexResult result = new() - { - Date = date - }; + UlcerIndexResult r = new(date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -47,10 +45,8 @@ internal static List CalcUlcerIndex( sumSquared += percentDrawdown * percentDrawdown; } - result.UI = Math.Sqrt(sumSquared / lookbackPeriods); + r.UI = Math.Sqrt(sumSquared / lookbackPeriods); } - - results.Add(result); } return results; diff --git a/src/s-z/Ultimate/Ultimate.Models.cs b/src/s-z/Ultimate/Ultimate.Models.cs index e054a11b4..4238d731a 100644 --- a/src/s-z/Ultimate/Ultimate.Models.cs +++ b/src/s-z/Ultimate/Ultimate.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class UltimateResult : ResultBase, IReusableResult { + public UltimateResult(DateTime date) + { + Date = date; + } + public double? Ultimate { get; set; } double? IReusableResult.Value => Ultimate; diff --git a/src/s-z/Ultimate/Ultimate.Series.cs b/src/s-z/Ultimate/Ultimate.Series.cs index 06a4a708e..a4a7828ba 100644 --- a/src/s-z/Ultimate/Ultimate.Series.cs +++ b/src/s-z/Ultimate/Ultimate.Series.cs @@ -25,10 +25,7 @@ internal static List CalcUltimate( { QuoteD q = qdList[i]; - UltimateResult r = new() - { - Date = q.Date - }; + UltimateResult r = new(q.Date); results.Add(r); if (i > 0) diff --git a/src/s-z/VolatilityStop/VolatilityStop.Models.cs b/src/s-z/VolatilityStop/VolatilityStop.Models.cs index 36495b770..1382b24e4 100644 --- a/src/s-z/VolatilityStop/VolatilityStop.Models.cs +++ b/src/s-z/VolatilityStop/VolatilityStop.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class VolatilityStopResult : ResultBase, IReusableResult { + public VolatilityStopResult(DateTime date) + { + Date = date; + } + public double? Sar { get; set; } public bool? IsStop { get; set; } diff --git a/src/s-z/VolatilityStop/VolatilityStop.Series.cs b/src/s-z/VolatilityStop/VolatilityStop.Series.cs index 793d7ace6..f434f5d97 100644 --- a/src/s-z/VolatilityStop/VolatilityStop.Series.cs +++ b/src/s-z/VolatilityStop/VolatilityStop.Series.cs @@ -35,7 +35,7 @@ internal static List CalcVolatilityStop( { (DateTime date, double value) = tpList[i]; sic = isLong ? Math.Max(sic, value) : Math.Min(sic, value); - results.Add(new VolatilityStopResult() { Date = date }); + results.Add(new VolatilityStopResult(date)); } // roll through quotes @@ -46,10 +46,8 @@ internal static List CalcVolatilityStop( // average true range × multiplier constant double? arc = atrList[i - 1].Atr * multiplier; - VolatilityStopResult r = new() + VolatilityStopResult r = new(date) { - Date = date, - // stop and reverse threshold Sar = isLong ? sic - arc : sic + arc }; diff --git a/src/s-z/Vortex/Vortex.Models.cs b/src/s-z/Vortex/Vortex.Models.cs index a041a39e2..1d46cce2b 100644 --- a/src/s-z/Vortex/Vortex.Models.cs +++ b/src/s-z/Vortex/Vortex.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class VortexResult : ResultBase { + public VortexResult(DateTime date) + { + Date = date; + } + public double? Pvi { get; set; } public double? Nvi { get; set; } } diff --git a/src/s-z/Vortex/Vortex.Series.cs b/src/s-z/Vortex/Vortex.Series.cs index 70b2858b8..c2eab9e30 100644 --- a/src/s-z/Vortex/Vortex.Series.cs +++ b/src/s-z/Vortex/Vortex.Series.cs @@ -27,15 +27,12 @@ internal static List CalcVortex( { QuoteD q = qdList[i]; - VortexResult result = new() - { - Date = q.Date - }; + VortexResult r = new(q.Date); + results.Add(r); // skip first period if (i == 0) { - results.Add(result); prevHigh = q.High; prevLow = q.Low; prevClose = q.Close; @@ -70,12 +67,10 @@ internal static List CalcVortex( if (sumTr is not 0) { - result.Pvi = sumPvm / sumTr; - result.Nvi = sumNvm / sumTr; + r.Pvi = sumPvm / sumTr; + r.Nvi = sumNvm / sumTr; } } - - results.Add(result); } return results; diff --git a/src/s-z/Vwap/Vwap.Models.cs b/src/s-z/Vwap/Vwap.Models.cs index 14e392007..b6df0b221 100644 --- a/src/s-z/Vwap/Vwap.Models.cs +++ b/src/s-z/Vwap/Vwap.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class VwapResult : ResultBase, IReusableResult { + public VwapResult(DateTime date) + { + Date = date; + } + public double? Vwap { get; set; } double? IReusableResult.Value => Vwap; diff --git a/src/s-z/Vwap/Vwap.Series.cs b/src/s-z/Vwap/Vwap.Series.cs index 1d693123b..36857f3c2 100644 --- a/src/s-z/Vwap/Vwap.Series.cs +++ b/src/s-z/Vwap/Vwap.Series.cs @@ -33,10 +33,8 @@ internal static List CalcVwap( double? l = q.Low; double? c = q.Close; - VwapResult r = new() - { - Date = q.Date - }; + VwapResult r = new(q.Date); + results.Add(r); if (q.Date >= startDate) { @@ -45,8 +43,6 @@ internal static List CalcVwap( r.Vwap = (cumVolume != 0) ? (cumVolumeTP / cumVolume) : null; } - - results.Add(r); } return results; diff --git a/src/s-z/Vwma/Vwma.Models.cs b/src/s-z/Vwma/Vwma.Models.cs index 3533c0b68..45774b6c4 100644 --- a/src/s-z/Vwma/Vwma.Models.cs +++ b/src/s-z/Vwma/Vwma.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class VwmaResult : ResultBase, IReusableResult { + public VwmaResult(DateTime date) + { + Date = date; + } + public double? Vwma { get; set; } double? IReusableResult.Value => Vwma; diff --git a/src/s-z/Vwma/Vwma.Series.cs b/src/s-z/Vwma/Vwma.Series.cs index 89e4a3643..632c13098 100644 --- a/src/s-z/Vwma/Vwma.Series.cs +++ b/src/s-z/Vwma/Vwma.Series.cs @@ -19,10 +19,8 @@ internal static List CalcVwma( { QuoteD q = qdList[i]; - VwmaResult result = new() - { - Date = q.Date - }; + VwmaResult r = new(q.Date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -38,10 +36,8 @@ internal static List CalcVwma( sumVl += v; } - result.Vwma = sumVl != 0 ? (sumCl / sumVl) : null; + r.Vwma = sumVl != 0 ? (sumCl / sumVl) : null; } - - results.Add(result); } return results; diff --git a/src/s-z/WilliamsR/WilliamsR.Models.cs b/src/s-z/WilliamsR/WilliamsR.Models.cs index 9d3a47b1a..a00b47754 100644 --- a/src/s-z/WilliamsR/WilliamsR.Models.cs +++ b/src/s-z/WilliamsR/WilliamsR.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class WilliamsResult : ResultBase, IReusableResult { + public WilliamsResult(DateTime date) + { + Date = date; + } + public double? WilliamsR { get; set; } double? IReusableResult.Value => WilliamsR; diff --git a/src/s-z/WilliamsR/WilliamsR.Series.cs b/src/s-z/WilliamsR/WilliamsR.Series.cs index 0df46e390..d6e1d13b2 100644 --- a/src/s-z/WilliamsR/WilliamsR.Series.cs +++ b/src/s-z/WilliamsR/WilliamsR.Series.cs @@ -12,9 +12,8 @@ internal static List CalcWilliamsR( // convert Fast Stochastic to William %R return qdList.CalcStoch(lookbackPeriods, 1, 1, 3, 2, MaType.SMA) - .Select(s => new WilliamsResult + .Select(s => new WilliamsResult(s.Date) { - Date = s.Date, WilliamsR = s.Oscillator - 100 }) .ToList(); diff --git a/src/s-z/Wma/Wma.Api.cs b/src/s-z/Wma/Wma.Api.cs index 82e5eca33..063bce5a4 100644 --- a/src/s-z/Wma/Wma.Api.cs +++ b/src/s-z/Wma/Wma.Api.cs @@ -18,7 +18,8 @@ public static IEnumerable GetWma( this IEnumerable results, int lookbackPeriods) => results .ToResultTuple() - .CalcWma(lookbackPeriods); + .CalcWma(lookbackPeriods) + .SyncIndex(results, SyncType.Prepend); // SERIES, from TUPLE public static IEnumerable GetWma( diff --git a/src/s-z/Wma/Wma.Models.cs b/src/s-z/Wma/Wma.Models.cs index a061e6ac5..551798d04 100644 --- a/src/s-z/Wma/Wma.Models.cs +++ b/src/s-z/Wma/Wma.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class WmaResult : ResultBase, IReusableResult { + public WmaResult(DateTime date) + { + Date = date; + } + public double? Wma { get; set; } double? IReusableResult.Value => Wma; diff --git a/src/s-z/Wma/Wma.Series.cs b/src/s-z/Wma/Wma.Series.cs index 226e747ad..cb7e9b621 100644 --- a/src/s-z/Wma/Wma.Series.cs +++ b/src/s-z/Wma/Wma.Series.cs @@ -19,10 +19,8 @@ internal static List CalcWma( { (DateTime date, double _) = tpList[i]; - WmaResult result = new() - { - Date = date - }; + WmaResult r = new(date); + results.Add(r); if (i + 1 >= lookbackPeriods) { @@ -33,10 +31,8 @@ internal static List CalcWma( wma += pValue * (lookbackPeriods - (i + 1 - p - 1)) / divisor; } - result.Wma = wma; + r.Wma = wma; } - - results.Add(result); } return results; diff --git a/src/s-z/ZigZag/ZigZag.Models.cs b/src/s-z/ZigZag/ZigZag.Models.cs index 33690caba..339b67d79 100644 --- a/src/s-z/ZigZag/ZigZag.Models.cs +++ b/src/s-z/ZigZag/ZigZag.Models.cs @@ -3,6 +3,11 @@ namespace Skender.Stock.Indicators; [Serializable] public sealed class ZigZagResult : ResultBase, IReusableResult { + public ZigZagResult(DateTime date) + { + Date = date; + } + public decimal? ZigZag { get; set; } // zig zag line public string? PointType { get; set; } // indicates a specific point and type e.g. H or L public decimal? RetraceHigh { get; set; } // zig zag retrace high line diff --git a/src/s-z/ZigZag/ZigZag.Series.cs b/src/s-z/ZigZag/ZigZag.Series.cs index 8963eacfc..4d84645f2 100644 --- a/src/s-z/ZigZag/ZigZag.Series.cs +++ b/src/s-z/ZigZag/ZigZag.Series.cs @@ -84,10 +84,7 @@ internal static List CalcZigZag( } // add first point to results - ZigZagResult firstResult = new() - { - Date = q0.Date - }; + ZigZagResult firstResult = new(q0.Date); results.Add(firstResult); // find and draw lines @@ -196,9 +193,8 @@ private static void DrawZigZagLine(List results, List(() => + quotes.GetAdx(14).RemoveWarmupPeriods(-1)); } [TestMethod] @@ -42,10 +46,86 @@ public void RemoveTooMany() } [TestMethod] - public void RemoveException() + public void SyncIndex() { - // bad remove period - Assert.ThrowsException(() => - quotes.GetAdx(14).RemoveWarmupPeriods(-1)); + // baseline for comparison + List baseline = new() + { + new SmaResult(DateTime.Parse("1/1/2000", EnglishCulture)) { Sma = null }, + new SmaResult(DateTime.Parse("1/2/2000", EnglishCulture)) { Sma = null }, + new SmaResult(DateTime.Parse("1/3/2000", EnglishCulture)) { Sma = 3 }, + new SmaResult(DateTime.Parse("1/4/2000", EnglishCulture)) { Sma = 4 }, + new SmaResult(DateTime.Parse("1/5/2000", EnglishCulture)) { Sma = 5 }, + new SmaResult(DateTime.Parse("1/6/2000", EnglishCulture)) { Sma = 6 }, + new SmaResult(DateTime.Parse("1/7/2000", EnglishCulture)) { Sma = 7 }, + new SmaResult(DateTime.Parse("1/8/2000", EnglishCulture)) { Sma = double.NaN }, + new SmaResult(DateTime.Parse("1/9/2000", EnglishCulture)) { Sma = null }, + }; + + // to be synced + List eval = new() + { + new EmaResult(DateTime.Parse("1/3/2000", EnglishCulture)) { Ema = 3 }, + new EmaResult(DateTime.Parse("1/4/2000", EnglishCulture)) { Ema = 4 }, + new EmaResult(DateTime.Parse("1/5/2000", EnglishCulture)) { Ema = 5 }, + new EmaResult(DateTime.Parse("1/6/2000", EnglishCulture)) { Ema = 6 }, + new EmaResult(DateTime.Parse("1/7/2000", EnglishCulture)) { Ema = 7 }, + new EmaResult(DateTime.Parse("1/9/2000", EnglishCulture)) { Ema = double.NaN }, + new EmaResult(DateTime.Parse("1/10/2000", EnglishCulture)) { Ema = null }, + }; + + // prepend option + List prepend = eval.SyncIndex(baseline, SyncType.Prepend).ToList(); + + Assert.AreEqual(9, prepend.Count); + Assert.AreEqual(3, prepend.Where(x => x.Ema is null).Count()); + + for (int i = 0; i < 6; i++) + { + SmaResult b = baseline[i]; + EmaResult r = prepend[i]; + + Assert.AreEqual(b.Date, r.Date); + } + + // append option + List append = eval.SyncIndex(baseline, SyncType.AppendOnly).ToList(); + + Assert.AreEqual(10, append.Count); + Assert.AreEqual(4, append.Where(x => x.Ema is null).Count()); + + for (int i = 0; i < 8; i++) + { + SmaResult b = baseline[i]; + EmaResult r = append[i]; + + // Console.WriteLine($"{b.Date:d} {r.Date:d} {r.Ema}"); + + Assert.AreEqual(b.Date, r.Date); + } + + // remove option + List remove = eval.SyncIndex(baseline, SyncType.RemoveOnly).ToList(); + + Assert.AreEqual(6, remove.Count); + Assert.AreEqual(0, remove.Where(x => x.Ema is null).Count()); + Assert.AreEqual(0, remove.Where(x => + x.Date == DateTime.Parse("1/10/2000", EnglishCulture)).Count()); + + // full option + List fullmatch = eval.SyncIndex(baseline, SyncType.FullMatch).ToList(); + + Assert.AreEqual(9, fullmatch.Count); + Assert.AreEqual(3, fullmatch.Where(x => x.Ema is null).Count()); + Assert.AreEqual(0, fullmatch.Where(x => + x.Date == DateTime.Parse("1/10/2000", EnglishCulture)).Count()); + + for (int i = 0; i < baseline.Count; i++) + { + SmaResult b = baseline[i]; + EmaResult r = fullmatch[i]; + + Assert.AreEqual(b.Date, r.Date); + } } } diff --git a/tests/indicators/a-d/Adx/Adx.Tests.cs b/tests/indicators/a-d/Adx/Adx.Tests.cs index cc5674b35..0b914fb2f 100644 --- a/tests/indicators/a-d/Adx/Adx.Tests.cs +++ b/tests/indicators/a-d/Adx/Adx.Tests.cs @@ -56,7 +56,7 @@ public void Chainor() .GetAdx(14) .GetSma(10); - Assert.AreEqual(475, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(466, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Alligator/Alligator.Tests.cs b/tests/indicators/a-d/Alligator/Alligator.Tests.cs index eba6bc564..ad75bf45d 100644 --- a/tests/indicators/a-d/Alligator/Alligator.Tests.cs +++ b/tests/indicators/a-d/Alligator/Alligator.Tests.cs @@ -65,11 +65,22 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetAlligator(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(482, results.Where(x => x.Jaw != null).Count()); + Assert.AreEqual(481, results.Where(x => x.Jaw != null).Count()); + } + + [TestMethod] + public void Sync() + { + IEnumerable results = quotes + .GetSma(3) + .GetAlligator(); + + Assert.AreEqual(502, results.Count()); + Assert.AreEqual(480, results.Where(x => x.Jaw != null).Count()); } [TestMethod] diff --git a/tests/indicators/a-d/Alma/Alma.Tests.cs b/tests/indicators/a-d/Alma/Alma.Tests.cs index 720c034f9..2e68f5767 100644 --- a/tests/indicators/a-d/Alma/Alma.Tests.cs +++ b/tests/indicators/a-d/Alma/Alma.Tests.cs @@ -61,11 +61,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetAlma(10, 0.85, 6); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(493, results.Where(x => x.Alma != null).Count()); + Assert.AreEqual(492, results.Where(x => x.Alma != null).Count()); } [TestMethod] @@ -80,7 +80,7 @@ public void Chainor() .GetSma(10) .ToList(); - Assert.AreEqual(493, results.Count); + Assert.AreEqual(502, results.Count); Assert.AreEqual(484, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Aroon/Aroon.Tests.cs b/tests/indicators/a-d/Aroon/Aroon.Tests.cs index 50e034441..d9031cdee 100644 --- a/tests/indicators/a-d/Aroon/Aroon.Tests.cs +++ b/tests/indicators/a-d/Aroon/Aroon.Tests.cs @@ -54,7 +54,7 @@ public void Chainor() .GetAroon(25) .GetSma(10); - Assert.AreEqual(477, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(468, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Atr/Atr.Tests.cs b/tests/indicators/a-d/Atr/Atr.Tests.cs index 345318857..6e6b8505d 100644 --- a/tests/indicators/a-d/Atr/Atr.Tests.cs +++ b/tests/indicators/a-d/Atr/Atr.Tests.cs @@ -52,7 +52,7 @@ public void Chainor() .GetAtr(10) .GetSma(10); - Assert.AreEqual(502 - 9, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(502 - 18, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Awesome/Awesome.Tests.cs b/tests/indicators/a-d/Awesome/Awesome.Tests.cs index d45f910c3..d47fe81e6 100644 --- a/tests/indicators/a-d/Awesome/Awesome.Tests.cs +++ b/tests/indicators/a-d/Awesome/Awesome.Tests.cs @@ -51,11 +51,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetAwesome(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(469, results.Where(x => x.Oscillator != null).Count()); + Assert.AreEqual(468, results.Where(x => x.Oscillator != null).Count()); } [TestMethod] @@ -65,7 +65,7 @@ public void Chainor() .GetAwesome() .GetSma(10); - Assert.AreEqual(469, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(460, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Beta/Beta.Tests.cs b/tests/indicators/a-d/Beta/Beta.Tests.cs index beafdd19e..8aa694232 100644 --- a/tests/indicators/a-d/Beta/Beta.Tests.cs +++ b/tests/indicators/a-d/Beta/Beta.Tests.cs @@ -129,7 +129,7 @@ public void Chainor() .GetBeta(quotes, 20) .GetSma(10); - Assert.AreEqual(482, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(473, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/BollingerBands/BollingerBands.Tests.cs b/tests/indicators/a-d/BollingerBands/BollingerBands.Tests.cs index 4635e822b..07a2d00ee 100644 --- a/tests/indicators/a-d/BollingerBands/BollingerBands.Tests.cs +++ b/tests/indicators/a-d/BollingerBands/BollingerBands.Tests.cs @@ -58,11 +58,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetBollingerBands(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.UpperBand != null).Count()); + Assert.AreEqual(482, results.Where(x => x.UpperBand != null).Count()); } [TestMethod] @@ -72,7 +72,7 @@ public void Chainor() .GetBollingerBands() .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Bop/Bop.Tests.cs b/tests/indicators/a-d/Bop/Bop.Tests.cs index c801f6838..48229f6e4 100644 --- a/tests/indicators/a-d/Bop/Bop.Tests.cs +++ b/tests/indicators/a-d/Bop/Bop.Tests.cs @@ -42,7 +42,7 @@ public void Chainor() .GetBop(14) .GetSma(10); - Assert.AreEqual(489, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(480, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Cci/Cci.Tests.cs b/tests/indicators/a-d/Cci/Cci.Tests.cs index e4fdf9ca4..3dca460a6 100644 --- a/tests/indicators/a-d/Cci/Cci.Tests.cs +++ b/tests/indicators/a-d/Cci/Cci.Tests.cs @@ -30,7 +30,7 @@ public void Chainor() .GetCci(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/ChaikinOsc/ChaikinOsc.Tests.cs b/tests/indicators/a-d/ChaikinOsc/ChaikinOsc.Tests.cs index 800c09e0e..fb0c7ac2b 100644 --- a/tests/indicators/a-d/ChaikinOsc/ChaikinOsc.Tests.cs +++ b/tests/indicators/a-d/ChaikinOsc/ChaikinOsc.Tests.cs @@ -37,7 +37,7 @@ public void Chainor() .GetChaikinOsc(3, 10) .GetSma(10); - Assert.AreEqual(493, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(484, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Chandelier/Chandelier.Tests.cs b/tests/indicators/a-d/Chandelier/Chandelier.Tests.cs index d27a13871..f82ba7496 100644 --- a/tests/indicators/a-d/Chandelier/Chandelier.Tests.cs +++ b/tests/indicators/a-d/Chandelier/Chandelier.Tests.cs @@ -45,7 +45,7 @@ public void Chainor() .GetChandelier(22) .GetSma(10); - Assert.AreEqual(481, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(472, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Chop/Chop.Tests.cs b/tests/indicators/a-d/Chop/Chop.Tests.cs index b320b1d28..0ba4f4af7 100644 --- a/tests/indicators/a-d/Chop/Chop.Tests.cs +++ b/tests/indicators/a-d/Chop/Chop.Tests.cs @@ -40,7 +40,7 @@ public void Chainor() .GetChop(14) .GetSma(10); - Assert.AreEqual(488, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(479, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Cmf/Cmf.Tests.cs b/tests/indicators/a-d/Cmf/Cmf.Tests.cs index 54317ec0f..b3c65a5fe 100644 --- a/tests/indicators/a-d/Cmf/Cmf.Tests.cs +++ b/tests/indicators/a-d/Cmf/Cmf.Tests.cs @@ -41,7 +41,7 @@ public void Chainor() .GetCmf(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/ConnorsRsi/ConnorsRsi.Tests.cs b/tests/indicators/a-d/ConnorsRsi/ConnorsRsi.Tests.cs index d85bba902..8f297ee7a 100644 --- a/tests/indicators/a-d/ConnorsRsi/ConnorsRsi.Tests.cs +++ b/tests/indicators/a-d/ConnorsRsi/ConnorsRsi.Tests.cs @@ -56,11 +56,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetConnorsRsi(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(401, results.Where(x => x.ConnorsRsi != null).Count()); + Assert.AreEqual(400, results.Where(x => x.ConnorsRsi != null).Count()); } [TestMethod] @@ -70,7 +70,7 @@ public void Chainor() .GetConnorsRsi() .GetSma(10); - Assert.AreEqual(401, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(392, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Correlation/Correlation.Tests.cs b/tests/indicators/a-d/Correlation/Correlation.Tests.cs index e858b68a1..891935088 100644 --- a/tests/indicators/a-d/Correlation/Correlation.Tests.cs +++ b/tests/indicators/a-d/Correlation/Correlation.Tests.cs @@ -54,7 +54,7 @@ public void Chainor() .GetCorrelation(otherQuotes, 20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Dema/Dema.Tests.cs b/tests/indicators/a-d/Dema/Dema.Tests.cs index a85b628c2..2c795ce8f 100644 --- a/tests/indicators/a-d/Dema/Dema.Tests.cs +++ b/tests/indicators/a-d/Dema/Dema.Tests.cs @@ -48,11 +48,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetDema(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.Dema != null).Count()); + Assert.AreEqual(482, results.Where(x => x.Dema != null).Count()); } [TestMethod] @@ -62,7 +62,7 @@ public void Chainor() .GetDema(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/a-d/Dpo/Dpo.Calc.xlsx b/tests/indicators/a-d/Dpo/Dpo.Calc.xlsx index b107a40b2..545007b65 100644 Binary files a/tests/indicators/a-d/Dpo/Dpo.Calc.xlsx and b/tests/indicators/a-d/Dpo/Dpo.Calc.xlsx differ diff --git a/tests/indicators/a-d/Dpo/Dpo.Tests.cs b/tests/indicators/a-d/Dpo/Dpo.Tests.cs index ccea1e067..91836aec6 100644 --- a/tests/indicators/a-d/Dpo/Dpo.Tests.cs +++ b/tests/indicators/a-d/Dpo/Dpo.Tests.cs @@ -28,9 +28,8 @@ public void Standard() Close = csv[5].ToDecimal() }); - exp.Add(new DpoResult + exp.Add(new DpoResult(date) { - Date = date, Sma = csv[6].ToDoubleNull(), Dpo = csv[7].ToDoubleNull() }); @@ -70,11 +69,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetDpo(14); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(489, results.Where(x => x.Dpo != null).Count()); + Assert.AreEqual(488, results.Where(x => x.Dpo != null).Count()); } [TestMethod] @@ -84,12 +83,8 @@ public void Chainor() .GetDpo(14) .GetSma(10); - foreach (SmaResult r in results) - { - Console.WriteLine($"{r.Date} {r.Sma}"); - } - - Assert.AreEqual(489, results.Where(x => x.Sma is not double.NaN).Count()); + Assert.AreEqual(502, results.Count()); + Assert.AreEqual(494, results.Where(x => x.Sma is not double.NaN).Count()); Assert.AreEqual(480, results.Where(x => x.Sma is not null and not double.NaN).Count()); } diff --git a/tests/indicators/e-k/ElderRay/ElderRay.Tests.cs b/tests/indicators/e-k/ElderRay/ElderRay.Tests.cs index 52e0d8e09..5a1829ddf 100644 --- a/tests/indicators/e-k/ElderRay/ElderRay.Tests.cs +++ b/tests/indicators/e-k/ElderRay/ElderRay.Tests.cs @@ -58,7 +58,7 @@ public void Chainor() .GetElderRay(13) .GetSma(10); - Assert.AreEqual(490, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(481, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/e-k/Ema/Ema.Tests.cs b/tests/indicators/e-k/Ema/Ema.Tests.cs index c4c8b005c..f7d72f6c3 100644 --- a/tests/indicators/e-k/Ema/Ema.Tests.cs +++ b/tests/indicators/e-k/Ema/Ema.Tests.cs @@ -45,11 +45,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetEma(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.Ema != null).Count()); + Assert.AreEqual(482, results.Where(x => x.Ema != null).Count()); } [TestMethod] @@ -59,7 +59,7 @@ public void Chainor() .GetEma(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } @@ -105,21 +105,21 @@ public void Chaining() .ToList(); // assertions - Assert.AreEqual(488, results.Count); + Assert.AreEqual(502, results.Count); Assert.AreEqual(469, results.Where(x => x.Ema != null).Count()); // sample values - EmaResult r18 = results[18]; - Assert.IsNull(r18.Ema); + EmaResult r32 = results[32]; + Assert.IsNull(r32.Ema); - EmaResult r19 = results[19]; - Assert.AreEqual(67.4565, NullMath.Round(r19.Ema, 4)); + EmaResult r33 = results[33]; + Assert.AreEqual(67.4565, NullMath.Round(r33.Ema, 4)); - EmaResult r235 = results[235]; - Assert.AreEqual(70.4659, NullMath.Round(r235.Ema, 4)); + EmaResult r249 = results[249]; + Assert.AreEqual(70.4659, NullMath.Round(r249.Ema, 4)); - EmaResult r487 = results[487]; - Assert.AreEqual(37.0728, NullMath.Round(r487.Ema, 4)); + EmaResult r501 = results[501]; + Assert.AreEqual(37.0728, NullMath.Round(r501.Ema, 4)); } [TestMethod] diff --git a/tests/indicators/e-k/Epma/Epma.Tests.cs b/tests/indicators/e-k/Epma/Epma.Tests.cs index 852b9f6db..b86bffc57 100644 --- a/tests/indicators/e-k/Epma/Epma.Tests.cs +++ b/tests/indicators/e-k/Epma/Epma.Tests.cs @@ -50,11 +50,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetEpma(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.Epma != null).Count()); + Assert.AreEqual(482, results.Where(x => x.Epma != null).Count()); } [TestMethod] @@ -64,7 +64,7 @@ public void Chainor() .GetEpma(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/e-k/FisherTransform/FisherTransform.Tests.cs b/tests/indicators/e-k/FisherTransform/FisherTransform.Tests.cs index e2d2dd64a..3db9465c4 100644 --- a/tests/indicators/e-k/FisherTransform/FisherTransform.Tests.cs +++ b/tests/indicators/e-k/FisherTransform/FisherTransform.Tests.cs @@ -66,7 +66,7 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetFisherTransform(10); Assert.AreEqual(502, results.Count()); diff --git a/tests/indicators/e-k/ForceIndex/ForceIndex.Tests.cs b/tests/indicators/e-k/ForceIndex/ForceIndex.Tests.cs index 6893ec53d..62cc8cac7 100644 --- a/tests/indicators/e-k/ForceIndex/ForceIndex.Tests.cs +++ b/tests/indicators/e-k/ForceIndex/ForceIndex.Tests.cs @@ -35,7 +35,7 @@ public void Chainor() .GetForceIndex(13) .GetSma(10); - Assert.AreEqual(489, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(480, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/e-k/Gator/Gator.Tests.cs b/tests/indicators/e-k/Gator/Gator.Tests.cs index 31075753c..42ba4fdad 100644 --- a/tests/indicators/e-k/Gator/Gator.Tests.cs +++ b/tests/indicators/e-k/Gator/Gator.Tests.cs @@ -166,11 +166,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetGator(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(482, results.Where(x => x.Upper != null).Count()); + Assert.AreEqual(481, results.Where(x => x.Upper != null).Count()); } [TestMethod] diff --git a/tests/indicators/e-k/Hma/Hma.Tests.cs b/tests/indicators/e-k/Hma/Hma.Tests.cs index 9c6770162..e909dad7c 100644 --- a/tests/indicators/e-k/Hma/Hma.Tests.cs +++ b/tests/indicators/e-k/Hma/Hma.Tests.cs @@ -41,11 +41,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetHma(19); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(481, results.Where(x => x.Hma != null).Count()); + Assert.AreEqual(480, results.Where(x => x.Hma != null).Count()); } [TestMethod] @@ -55,7 +55,7 @@ public void Chainor() .GetHma(20) .GetSma(10); - Assert.AreEqual(480, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(471, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/e-k/HtTrendline/HtTrendline.Tests.cs b/tests/indicators/e-k/HtTrendline/HtTrendline.Tests.cs index 9f6494189..c0b609f6c 100644 --- a/tests/indicators/e-k/HtTrendline/HtTrendline.Tests.cs +++ b/tests/indicators/e-k/HtTrendline/HtTrendline.Tests.cs @@ -64,11 +64,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetHtTrendline(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(502, results.Where(x => x.Trendline != null).Count()); + Assert.AreEqual(501, results.Where(x => x.Trendline != null).Count()); } [TestMethod] diff --git a/tests/indicators/e-k/Hurst/Hurst.Tests.cs b/tests/indicators/e-k/Hurst/Hurst.Tests.cs index 788e80181..fc293365c 100644 --- a/tests/indicators/e-k/Hurst/Hurst.Tests.cs +++ b/tests/indicators/e-k/Hurst/Hurst.Tests.cs @@ -42,7 +42,7 @@ public void Chainor() .GetHurst(100) .GetSma(10); - Assert.AreEqual(402, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(393, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/e-k/Kama/Kama.Tests.cs b/tests/indicators/e-k/Kama/Kama.Tests.cs index 55bd2ec59..a9aeb0fbb 100644 --- a/tests/indicators/e-k/Kama/Kama.Tests.cs +++ b/tests/indicators/e-k/Kama/Kama.Tests.cs @@ -69,11 +69,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetKama(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(493, results.Where(x => x.Kama != null).Count()); + Assert.AreEqual(492, results.Where(x => x.Kama != null).Count()); } [TestMethod] @@ -83,7 +83,7 @@ public void Chainor() .GetKama() .GetSma(10); - Assert.AreEqual(493, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(484, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/e-k/Kvo/Kvo.Tests.cs b/tests/indicators/e-k/Kvo/Kvo.Tests.cs index a08f4229b..4544c84a6 100644 --- a/tests/indicators/e-k/Kvo/Kvo.Tests.cs +++ b/tests/indicators/e-k/Kvo/Kvo.Tests.cs @@ -58,7 +58,7 @@ public void Chainor() .GetKvo() .GetSma(10); - Assert.AreEqual(446, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(437, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/MaEnvelopes/MaEnvelopes.Tests.cs b/tests/indicators/m-r/MaEnvelopes/MaEnvelopes.Tests.cs index 0c0516b94..5072747e8 100644 --- a/tests/indicators/m-r/MaEnvelopes/MaEnvelopes.Tests.cs +++ b/tests/indicators/m-r/MaEnvelopes/MaEnvelopes.Tests.cs @@ -290,11 +290,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetMaEnvelopes(10, 2.5, MaType.SMA); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(493, results.Where(x => x.Centerline != null).Count()); + Assert.AreEqual(492, results.Where(x => x.Centerline != null).Count()); } [TestMethod] diff --git a/tests/indicators/m-r/Macd/Macd.Tests.cs b/tests/indicators/m-r/Macd/Macd.Tests.cs index ecab0343e..d994027c1 100644 --- a/tests/indicators/m-r/Macd/Macd.Tests.cs +++ b/tests/indicators/m-r/Macd/Macd.Tests.cs @@ -64,11 +64,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetMacd(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(477, results.Where(x => x.Macd != null).Count()); + Assert.AreEqual(476, results.Where(x => x.Macd != null).Count()); } [TestMethod] @@ -78,7 +78,7 @@ public void Chainor() .GetMacd() .GetSma(10); - Assert.AreEqual(477, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(468, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/Mama/Mama.Tests.cs b/tests/indicators/m-r/Mama/Mama.Tests.cs index 2226c77a4..4263e83a6 100644 --- a/tests/indicators/m-r/Mama/Mama.Tests.cs +++ b/tests/indicators/m-r/Mama/Mama.Tests.cs @@ -67,11 +67,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetMama(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(497, results.Where(x => x.Mama != null).Count()); + Assert.AreEqual(496, results.Where(x => x.Mama != null).Count()); } [TestMethod] @@ -81,7 +81,7 @@ public void Chainor() .GetMama() .GetSma(10); - Assert.AreEqual(497, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(488, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/Mfi/Mfi.Tests.cs b/tests/indicators/m-r/Mfi/Mfi.Tests.cs index 37c6773e7..b2768d592 100644 --- a/tests/indicators/m-r/Mfi/Mfi.Tests.cs +++ b/tests/indicators/m-r/Mfi/Mfi.Tests.cs @@ -34,7 +34,7 @@ public void Chainor() .GetMfi() .GetSma(10); - Assert.AreEqual(488, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(479, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs b/tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs index c6b1d6d41..017c83358 100644 --- a/tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs +++ b/tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs @@ -89,7 +89,7 @@ public void Chainor() .GetParabolicSar() .GetSma(10); - Assert.AreEqual(488, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(479, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/Pmo/Pmo.Tests.cs b/tests/indicators/m-r/Pmo/Pmo.Tests.cs index 1d9fd82b9..b3ea3c378 100644 --- a/tests/indicators/m-r/Pmo/Pmo.Tests.cs +++ b/tests/indicators/m-r/Pmo/Pmo.Tests.cs @@ -44,11 +44,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetPmo(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(448, results.Where(x => x.Pmo != null).Count()); + Assert.AreEqual(447, results.Where(x => x.Pmo != null).Count()); } [TestMethod] @@ -58,7 +58,7 @@ public void Chainor() .GetPmo() .GetSma(10); - Assert.AreEqual(448, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(439, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/Pvo/Pvo.Tests.cs b/tests/indicators/m-r/Pvo/Pvo.Tests.cs index cff7629c3..8eb50dd46 100644 --- a/tests/indicators/m-r/Pvo/Pvo.Tests.cs +++ b/tests/indicators/m-r/Pvo/Pvo.Tests.cs @@ -60,7 +60,7 @@ public void Chainor() .GetPvo() .GetSma(10); - Assert.AreEqual(477, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(468, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/Roc/Roc.Tests.cs b/tests/indicators/m-r/Roc/Roc.Tests.cs index 4004a74da..e15860ae7 100644 --- a/tests/indicators/m-r/Roc/Roc.Tests.cs +++ b/tests/indicators/m-r/Roc/Roc.Tests.cs @@ -71,11 +71,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetRoc(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(482, results.Where(x => x.Roc != null).Count()); + Assert.AreEqual(481, results.Where(x => x.Roc != null).Count()); } [TestMethod] @@ -85,7 +85,7 @@ public void Chainor() .GetRoc(20) .GetSma(10); - Assert.AreEqual(482, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(473, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/RocWb/RocWb.Tests.cs b/tests/indicators/m-r/RocWb/RocWb.Tests.cs index 0b3745e2b..2a66d150a 100644 --- a/tests/indicators/m-r/RocWb/RocWb.Tests.cs +++ b/tests/indicators/m-r/RocWb/RocWb.Tests.cs @@ -86,11 +86,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetRocWb(20, 3, 20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(482, results.Where(x => x.Roc != null).Count()); + Assert.AreEqual(481, results.Where(x => x.Roc != null).Count()); } [TestMethod] @@ -100,7 +100,7 @@ public void Chainor() .GetRocWb(20, 3, 20) .GetSma(10); - Assert.AreEqual(482, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(473, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/m-r/Rsi/Rsi.Calc.xlsx b/tests/indicators/m-r/Rsi/Rsi.Calc.xlsx index d78bb6d65..b663290cd 100644 Binary files a/tests/indicators/m-r/Rsi/Rsi.Calc.xlsx and b/tests/indicators/m-r/Rsi/Rsi.Calc.xlsx differ diff --git a/tests/indicators/m-r/Rsi/Rsi.Tests.cs b/tests/indicators/m-r/Rsi/Rsi.Tests.cs index ea7a5d400..7e416c0c7 100644 --- a/tests/indicators/m-r/Rsi/Rsi.Tests.cs +++ b/tests/indicators/m-r/Rsi/Rsi.Tests.cs @@ -77,11 +77,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetRsi(14); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(488, results.Where(x => x.Rsi != null).Count()); + Assert.AreEqual(487, results.Where(x => x.Rsi != null).Count()); } [TestMethod] @@ -91,7 +91,7 @@ public void Chainor() .GetRsi(14) .GetSma(10); - Assert.AreEqual(488, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(479, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Slope/Slope.Tests.cs b/tests/indicators/s-z/Slope/Slope.Tests.cs index 98070dd0a..feddf7b7d 100644 --- a/tests/indicators/s-z/Slope/Slope.Tests.cs +++ b/tests/indicators/s-z/Slope/Slope.Tests.cs @@ -58,11 +58,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetSlope(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.Slope != null).Count()); + Assert.AreEqual(482, results.Where(x => x.Slope != null).Count()); } [TestMethod] @@ -72,7 +72,7 @@ public void Chainor() .GetSlope(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Sma/Sma.Analysis.Tests.cs b/tests/indicators/s-z/Sma/Sma.Analysis.Tests.cs index abc03d908..06ce04785 100644 --- a/tests/indicators/s-z/Sma/Sma.Analysis.Tests.cs +++ b/tests/indicators/s-z/Sma/Sma.Analysis.Tests.cs @@ -41,11 +41,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetSmaAnalysis(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.Sma != null).Count()); + Assert.AreEqual(482, results.Where(x => x.Sma != null).Count()); } [TestMethod] @@ -55,7 +55,7 @@ public void Chainor() .GetSmaAnalysis(10) .GetEma(10); - Assert.AreEqual(493, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(484, results.Where(x => x.Ema != null).Count()); } diff --git a/tests/indicators/s-z/Sma/Sma.Tests.cs b/tests/indicators/s-z/Sma/Sma.Tests.cs index 273fd9f83..3219288a8 100644 --- a/tests/indicators/s-z/Sma/Sma.Tests.cs +++ b/tests/indicators/s-z/Sma/Sma.Tests.cs @@ -78,7 +78,7 @@ public void Chainor() .GetSma(10) .GetEma(10); - Assert.AreEqual(493, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(484, results.Where(x => x.Ema != null).Count()); } @@ -111,11 +111,9 @@ public void Removed() Assert.AreEqual(251.8600, Math.Round(results.LastOrDefault().Sma.Value, 4)); } + // bad lookback period [TestMethod] public void Exceptions() - { - // bad lookback period - Assert.ThrowsException(() => - Indicator.GetSma(quotes, 0)); - } + => Assert.ThrowsException(() + => Indicator.GetSma(quotes, 0)); } diff --git a/tests/indicators/s-z/Smi/Smi.Tests.cs b/tests/indicators/s-z/Smi/Smi.Tests.cs index 34e681977..da100317e 100644 --- a/tests/indicators/s-z/Smi/Smi.Tests.cs +++ b/tests/indicators/s-z/Smi/Smi.Tests.cs @@ -57,7 +57,7 @@ public void Chainor() .GetSmi(14, 20, 5, 3) .GetSma(10); - Assert.AreEqual(489, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(480, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Smma/Smma.Tests.cs b/tests/indicators/s-z/Smma/Smma.Tests.cs index 44a6e0ffe..0fcd08cf1 100644 --- a/tests/indicators/s-z/Smma/Smma.Tests.cs +++ b/tests/indicators/s-z/Smma/Smma.Tests.cs @@ -45,11 +45,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetSmma(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.Smma != null).Count()); + Assert.AreEqual(482, results.Where(x => x.Smma != null).Count()); } [TestMethod] @@ -59,7 +59,7 @@ public void Chainor() .GetSmma(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Stc/Stc.Tests.cs b/tests/indicators/s-z/Stc/Stc.Tests.cs index 764c24c2c..88caa0b13 100644 --- a/tests/indicators/s-z/Stc/Stc.Tests.cs +++ b/tests/indicators/s-z/Stc/Stc.Tests.cs @@ -61,11 +61,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetStc(9, 12, 26); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(467, results.Where(x => x.Stc != null).Count()); + Assert.AreEqual(466, results.Where(x => x.Stc != null).Count()); } [TestMethod] @@ -75,7 +75,7 @@ public void Chainor() .GetStc(9, 12, 26) .GetSma(10); - Assert.AreEqual(467, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(458, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/StdDev/StdDev.Tests.cs b/tests/indicators/s-z/StdDev/StdDev.Tests.cs index 62e14fb5f..4f3656ca6 100644 --- a/tests/indicators/s-z/StdDev/StdDev.Tests.cs +++ b/tests/indicators/s-z/StdDev/StdDev.Tests.cs @@ -61,11 +61,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetStdDev(10); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(493, results.Where(x => x.StdDev != null).Count()); + Assert.AreEqual(492, results.Where(x => x.StdDev != null).Count()); } [TestMethod] @@ -75,7 +75,7 @@ public void Chainor() .GetStdDev(10) .GetSma(10); - Assert.AreEqual(493, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(484, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/StdDevChannels/StdDevChannels.Tests.cs b/tests/indicators/s-z/StdDevChannels/StdDevChannels.Tests.cs index ef32906be..6b9de0a80 100644 --- a/tests/indicators/s-z/StdDevChannels/StdDevChannels.Tests.cs +++ b/tests/indicators/s-z/StdDevChannels/StdDevChannels.Tests.cs @@ -121,7 +121,7 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetStdDevChannels(20, 2); Assert.AreEqual(502, results.Count()); diff --git a/tests/indicators/s-z/Stoch/Stoch.Tests.cs b/tests/indicators/s-z/Stoch/Stoch.Tests.cs index b95e4da71..74e23f02e 100644 --- a/tests/indicators/s-z/Stoch/Stoch.Tests.cs +++ b/tests/indicators/s-z/Stoch/Stoch.Tests.cs @@ -106,7 +106,7 @@ public void Chainor() .GetStoch() .GetSma(10); - Assert.AreEqual(487, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(478, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/StochRsi/StochRsi.Tests.cs b/tests/indicators/s-z/StochRsi/StochRsi.Tests.cs index cf804806e..4217d704d 100644 --- a/tests/indicators/s-z/StochRsi/StochRsi.Tests.cs +++ b/tests/indicators/s-z/StochRsi/StochRsi.Tests.cs @@ -87,7 +87,7 @@ public void Chainor() .GetStochRsi(14, 14, 3, 3) .GetSma(10); - Assert.AreEqual(473, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(464, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/T3/T3.Tests.cs b/tests/indicators/s-z/T3/T3.Tests.cs index 7369b387f..3ac3ae88b 100644 --- a/tests/indicators/s-z/T3/T3.Tests.cs +++ b/tests/indicators/s-z/T3/T3.Tests.cs @@ -53,11 +53,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetT3(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(478, results.Where(x => x.T3 != null).Count()); + Assert.AreEqual(477, results.Where(x => x.T3 != null).Count()); } [TestMethod] @@ -67,7 +67,7 @@ public void Chainor() .GetT3() .GetSma(10); - Assert.AreEqual(478, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(469, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Tema/Tema.Tests.cs b/tests/indicators/s-z/Tema/Tema.Tests.cs index ad027456f..455662135 100644 --- a/tests/indicators/s-z/Tema/Tema.Tests.cs +++ b/tests/indicators/s-z/Tema/Tema.Tests.cs @@ -47,11 +47,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetTema(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.Tema != null).Count()); + Assert.AreEqual(482, results.Where(x => x.Tema != null).Count()); } [TestMethod] @@ -61,7 +61,7 @@ public void Chainor() .GetTema(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Trix/Trix.Tests.cs b/tests/indicators/s-z/Trix/Trix.Tests.cs index 939984142..20d4bbc72 100644 --- a/tests/indicators/s-z/Trix/Trix.Tests.cs +++ b/tests/indicators/s-z/Trix/Trix.Tests.cs @@ -57,11 +57,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetTrix(20, 5); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(482, results.Where(x => x.Trix != null).Count()); + Assert.AreEqual(481, results.Where(x => x.Trix != null).Count()); } [TestMethod] @@ -71,7 +71,7 @@ public void Chainor() .GetTrix(20, 5) .GetSma(10); - Assert.AreEqual(482, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(473, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Tsi/Tsi.Tests.cs b/tests/indicators/s-z/Tsi/Tsi.Tests.cs index f096eca53..f2074c78a 100644 --- a/tests/indicators/s-z/Tsi/Tsi.Tests.cs +++ b/tests/indicators/s-z/Tsi/Tsi.Tests.cs @@ -60,11 +60,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetTsi(); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(465, results.Where(x => x.Tsi != null).Count()); + Assert.AreEqual(464, results.Where(x => x.Tsi != null).Count()); } [TestMethod] @@ -74,7 +74,7 @@ public void Chainor() .GetTsi() .GetSma(10); - Assert.AreEqual(465, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(456, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/UlcerIndex/UlcerIndex.Tests.cs b/tests/indicators/s-z/UlcerIndex/UlcerIndex.Tests.cs index 009f3abf6..7fc7f055b 100644 --- a/tests/indicators/s-z/UlcerIndex/UlcerIndex.Tests.cs +++ b/tests/indicators/s-z/UlcerIndex/UlcerIndex.Tests.cs @@ -39,11 +39,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetUlcerIndex(14); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(489, results.Where(x => x.UI != null).Count()); + Assert.AreEqual(488, results.Where(x => x.UI != null).Count()); } [TestMethod] @@ -53,7 +53,7 @@ public void Chainor() .GetUlcerIndex(14) .GetSma(10); - Assert.AreEqual(489, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(480, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Ultimate/Ultimate.Tests.cs b/tests/indicators/s-z/Ultimate/Ultimate.Tests.cs index 5c4fad60e..32592456f 100644 --- a/tests/indicators/s-z/Ultimate/Ultimate.Tests.cs +++ b/tests/indicators/s-z/Ultimate/Ultimate.Tests.cs @@ -37,7 +37,7 @@ public void Chainor() .GetUltimate() .GetSma(10); - Assert.AreEqual(474, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(465, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/VolatilityStop/VolatilityStop.Tests.cs b/tests/indicators/s-z/VolatilityStop/VolatilityStop.Tests.cs index f75a13549..08f1ca6d9 100644 --- a/tests/indicators/s-z/VolatilityStop/VolatilityStop.Tests.cs +++ b/tests/indicators/s-z/VolatilityStop/VolatilityStop.Tests.cs @@ -74,7 +74,7 @@ public void Chainor() .GetVolatilityStop() .GetSma(10); - Assert.AreEqual(448, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(439, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Vortex/Vortex.Tests.cs b/tests/indicators/s-z/Vortex/Vortex.Tests.cs index 190f21991..aa9b255f2 100644 --- a/tests/indicators/s-z/Vortex/Vortex.Tests.cs +++ b/tests/indicators/s-z/Vortex/Vortex.Tests.cs @@ -72,11 +72,9 @@ public void Removed() Assert.AreEqual(1.1163, NullMath.Round(last.Nvi, 4)); } + // bad lookback period [TestMethod] public void Exceptions() - { - // bad lookback period - Assert.ThrowsException(() => - Indicator.GetVortex(quotes, 1)); - } + => Assert.ThrowsException(() + => Indicator.GetVortex(quotes, 1)); } diff --git a/tests/indicators/s-z/Vwma/Vwma.Tests.cs b/tests/indicators/s-z/Vwma/Vwma.Tests.cs index ad9b4e7dd..3a18e9ab0 100644 --- a/tests/indicators/s-z/Vwma/Vwma.Tests.cs +++ b/tests/indicators/s-z/Vwma/Vwma.Tests.cs @@ -37,7 +37,7 @@ public void Chainor() .GetVwma(10) .GetSma(10); - Assert.AreEqual(493, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(484, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/WilliamsR/WilliamsR.Tests.cs b/tests/indicators/s-z/WilliamsR/WilliamsR.Tests.cs index f66c5a324..3eb09993c 100644 --- a/tests/indicators/s-z/WilliamsR/WilliamsR.Tests.cs +++ b/tests/indicators/s-z/WilliamsR/WilliamsR.Tests.cs @@ -34,7 +34,7 @@ public void Chainor() .GetWilliamsR() .GetSma(10); - Assert.AreEqual(489, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(480, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/Wma/Wma.Tests.cs b/tests/indicators/s-z/Wma/Wma.Tests.cs index 76fb4a853..67407a0ba 100644 --- a/tests/indicators/s-z/Wma/Wma.Tests.cs +++ b/tests/indicators/s-z/Wma/Wma.Tests.cs @@ -41,11 +41,11 @@ public void UseTuple() public void Chainee() { IEnumerable results = quotes - .GetSma(1) + .GetSma(2) .GetWma(20); Assert.AreEqual(502, results.Count()); - Assert.AreEqual(483, results.Where(x => x.Wma != null).Count()); + Assert.AreEqual(482, results.Where(x => x.Wma != null).Count()); } [TestMethod] @@ -55,7 +55,7 @@ public void Chainor() .GetWma(20) .GetSma(10); - Assert.AreEqual(483, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(474, results.Where(x => x.Sma != null).Count()); } diff --git a/tests/indicators/s-z/ZigZag/ZigZag.Tests.cs b/tests/indicators/s-z/ZigZag/ZigZag.Tests.cs index a220007c4..a6867ef44 100644 --- a/tests/indicators/s-z/ZigZag/ZigZag.Tests.cs +++ b/tests/indicators/s-z/ZigZag/ZigZag.Tests.cs @@ -124,7 +124,7 @@ public void Chainor() .GetZigZag(EndType.Close, 3) .GetSma(10); - Assert.AreEqual(234, results.Count()); + Assert.AreEqual(502, results.Count()); Assert.AreEqual(225, results.Where(x => x.Sma != null).Count()); }