ZSCORE, CORR

This commit is contained in:
Miha Kralj
2022-11-15 21:26:58 -08:00
13 changed files with 1310 additions and 1205 deletions
+356 -355
View File
@@ -1,355 +1,356 @@
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
## ##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files # User-specific files
*.rsuser *.rsuser
*.suo *.suo
*.user *.user
*.userosscache *.userosscache
*.sln.docstates *.sln.docstates
.vscode/ .vscode/
*.deps.json *.deps.json
.Sandbox/ .Sandbox/
.DS_Store .sonarlint/
.DS_Store
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs # User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.* # Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/ # Build results
[Dd]ebugPublic/ [Dd]ebug/
[Rr]elease/ [Dd]ebugPublic/
[Rr]eleases/ [Rr]elease/
x64/ [Rr]eleases/
x86/ x64/
[Aa][Rr][Mm]/ x86/
[Aa][Rr][Mm]64/ [Aa][Rr][Mm]/
bld/ [Aa][Rr][Mm]64/
[Bb]in/ bld/
[Oo]bj/ [Bb]in/
[Ll]og/ [Oo]bj/
[Ll]ogs/ [Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/ # Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot .vs/
#wwwroot/ # Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/ # Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/ # MSTest test Results
[Bb]uild[Ll]og.* [Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml # NUnit
TestResult.xml *.VisualState.xml
nunit-*.xml TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/ # Build Results of an ATL Project
[Rr]eleasePS/ [Dd]ebugPS/
dlldata.c [Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/ # Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json # .NET Core
project.fragment.lock.json project.lock.json
artifacts/ project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml # StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c # Files built by Visual Studio
*_p.c *_i.c
*_h.h *_p.c
*.ilk *_h.h
*.meta *.ilk
*.obj *.meta
*.iobj *.obj
*.pch *.iobj
*.pdb *.pch
*.ipdb *.pdb
*.pgc *.ipdb
*.pgd *.pgc
*.rsp *.pgd
*.sbr *.rsp
*.tlb *.sbr
*.tli *.tlb
*.tlh *.tli
*.tmp *.tlh
*.tmp_proj *.tmp
*_wpftmp.csproj *.tmp_proj
*.log *_wpftmp.csproj
*.vspscc *.log
*.vssscc *.vspscc
.builds *.vssscc
*.pidb .builds
*.svclog *.pidb
*.scc *.svclog
*.scc
# Chutzpah Test files
_Chutzpah* # Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/ # Visual C++ cache files
*.aps ipch/
*.ncb *.aps
*.opendb *.ncb
*.opensdf *.opendb
*.sdf *.opensdf
*.cachefile *.sdf
*.VC.db *.cachefile
*.VC.VC.opendb *.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess # Visual Studio profiler
*.vsp *.psess
*.vspx *.vsp
*.sap *.vspx
*.sap
# Visual Studio Trace Files
*.e2e # Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/ # TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState # Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/ # ReSharper is a .NET coding add-in
*.[Rr]e[Ss]harper _ReSharper*/
*.DotSettings.user *.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity* # TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover # DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/* # AxoCover is a Code Coverage Tool
!.axoCover/settings.json .axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage # Visual Studio code coverage results
*.coveragexml *.coverage
*.coveragexml
# NCrunch
_NCrunch_* # NCrunch
.*crunch*.local.xml _NCrunch_*
nCrunchTemp_* .*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.* # MightyMoose
AutoTest.Net/ *.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/ # Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/ # Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/ # DocProject is a documentation generator add-in
DocProject/Help/*.HxT DocProject/buildhelp/
DocProject/Help/*.HxC DocProject/Help/*.HxT
DocProject/Help/*.hhc DocProject/Help/*.HxC
DocProject/Help/*.hhk DocProject/Help/*.hhc
DocProject/Help/*.hhp DocProject/Help/*.hhk
DocProject/Help/Html2 DocProject/Help/*.hhp
DocProject/Help/html DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/ # Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml # Publish Web Output
*.azurePubxml *.[Pp]ublish.xml
# Note: Comment the next line if you want to checkin your web deploy settings, *.azurePubxml
# but database connection strings (with potential passwords) will be unencrypted # Note: Comment the next line if you want to checkin your web deploy settings,
*.pubxml # but database connection strings (with potential passwords) will be unencrypted
*.publishproj *.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained # Microsoft Azure Web App publish settings. Comment the next line if you want to
# in these scripts will be unencrypted # checkin your Azure Web App publish settings, but sensitive information contained
PublishScripts/ # in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg # NuGet Packages
# NuGet Symbol Packages *.nupkg
*.snupkg # NuGet Symbol Packages
# The packages folder can be ignored because of Package Restore *.snupkg
**/[Pp]ackages/* # The packages folder can be ignored because of Package Restore
# except build/, which is used as an MSBuild target. **/[Pp]ackages/*
!**/[Pp]ackages/build/ # except build/, which is used as an MSBuild target.
# Uncomment if necessary however generally it will be regenerated when needed !**/[Pp]ackages/build/
#!**/[Pp]ackages/repositories.config # Uncomment if necessary however generally it will be regenerated when needed
# NuGet v3's project.json files produces more ignorable files #!**/[Pp]ackages/repositories.config
*.nuget.props # NuGet v3's project.json files produces more ignorable files
*.nuget.targets *.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/ # Microsoft Azure Build Output
*.build.csdef csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/ # Microsoft Azure Emulator
rcf/ ecf/
rcf/
# Windows Store app package directories and files
AppPackages/ # Windows Store app package directories and files
BundleArtifacts/ AppPackages/
Package.StoreAssociation.xml BundleArtifacts/
_pkginfo.txt Package.StoreAssociation.xml
*.appx _pkginfo.txt
*.appxbundle *.appx
*.appxupload *.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored # Visual Studio cache files
*.[Cc]ache # files ending in .cache can be ignored
# but keep track of directories ending in .cache *.[Cc]ache
!?*.[Cc]ache/ # but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/ # Others
~$* ClientBin/
*~ ~$*
*.dbmdl *~
*.dbproj.schemaview *.dbmdl
*.jfm *.dbproj.schemaview
*.pfx *.jfm
*.publishsettings *.pfx
orleans.codegen.cs *.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424) # Including strong name files can present a security risk
#*.snk # (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) # Since there are multiple workflows, uncomment next line to ignore bower_components
#bower_components/ # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/ # RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed, # Backup & report files from converting an old project file
# because we have git ;-) # to a newer Visual Studio version. Backup files are not needed,
_UpgradeReport_Files/ # because we have git ;-)
Backup*/ _UpgradeReport_Files/
UpgradeLog*.XML Backup*/
UpgradeLog*.htm UpgradeLog*.XML
ServiceFabricBackup/ UpgradeLog*.htm
*.rptproj.bak ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf # SQL Server files
*.ldf *.mdf
*.ndf *.ldf
*.ndf
# Business Intelligence projects
*.rdl.data # Business Intelligence projects
*.bim.layout *.rdl.data
*.bim_*.settings *.bim.layout
*.rptproj.rsuser *.bim_*.settings
*- [Bb]ackup.rdl *.rptproj.rsuser
*- [Bb]ackup ([0-9]).rdl *- [Bb]ackup.rdl
*- [Bb]ackup ([0-9][0-9]).rdl *- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/ # Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml # GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat # Node.js Tools for Visual Studio
node_modules/ .ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg # Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt # Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts # Visual Studio LightSwitch build output
**/*.DesktopClient/GeneratedArtifacts **/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml **/*.DesktopClient/GeneratedArtifacts
**/*.Server/GeneratedArtifacts **/*.DesktopClient/ModelManifest.xml
**/*.Server/ModelManifest.xml **/*.Server/GeneratedArtifacts
_Pvt_Extensions **/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe # Paket dependency manager
paket-files/ .paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/ # FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal # CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/ # Python Tools for Visual Studio (PTVS)
*.pyc __pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/** # Cake - Uncomment if you are using it
# !tools/packages.config # tools/**
# !tools/packages.config
# Tabs Studio
*.tss # Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig # Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs # BizTalk build output
*.btm.cs *.btp.cs
*.odx.cs *.btm.cs
*.xsd.cs *.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/ # OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/ # Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog # MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser # NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/ # MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/ # Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb # BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/ # Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/ # Ionide (cross platform F# VS Code tools) working folder
dotCover.Output.dcvr .ionide/
dotCover.Output.dcvr
+2 -1
View File
@@ -1,3 +1,4 @@
next-version: 0.1.19
minor-version-bump-message: \+semver:\s?(feature|new) minor-version-bump-message: \+semver:\s?(feature|new)
branches: branches:
main: main:
@@ -11,6 +12,6 @@ branches:
regex: ^dev(elop)?(ment)?$ regex: ^dev(elop)?(ment)?$
is-release-branch: false is-release-branch: false
mode: ContinuousDelivery mode: ContinuousDelivery
tag: 'v' tag: 'nightly'
increment: Inherit increment: Inherit
update-build-number: true update-build-number: true
+15 -2
View File
@@ -2,13 +2,13 @@
using System; using System;
/* <summary> /* <summary>
Abstract classes with all scaffolding required to build indicators. Abstract classes with all scaffolding required to build indicators.
All abstracts support period, NaN, and all permutations of Add() methods. All abstracts support period, NaN, and all permutations of Add() methods.
Indicator classess need to implement: Indicator classess need to implement:
- Chaining constructor (Abstract's constructor executes first) - Chaining constructor (Abstract's constructor executes first)
- Default Add(value) class - Default Add(value) class
- optional Add(series) bulk insert class (for optimization of historical analysis) - optional Add(series) bulk insert class (for optimization of historical analysis)
Single_TSeries_Indicator - one single-value TSeries in, one TSeries out. Single_TSeries_Indicator - one single-value TSeries in, one TSeries out.
Pair_TSeries_Indicator - Two TSeries in, one TSeries out. (includes simple semaphoring) Pair_TSeries_Indicator - Two TSeries in, one TSeries out. (includes simple semaphoring)
Single_TBars_Indicator - One OHLCV TBars in, one TSeries out. Single_TBars_Indicator - One OHLCV TBars in, one TSeries out.
@@ -42,11 +42,24 @@ public abstract class Single_TSeries_Indicator : TSeries
public abstract class Pair_TSeries_Indicator : TSeries public abstract class Pair_TSeries_Indicator : TSeries
{ {
protected readonly int _p;
protected readonly bool _NaN;
protected readonly TSeries _d1; protected readonly TSeries _d1;
protected readonly TSeries _d2; protected readonly TSeries _d2;
protected readonly double _dd1, _dd2; protected readonly double _dd1, _dd2;
// Chainable Constructors - add them at the end of primary constructors if needed // Chainable Constructors - add them at the end of primary constructors if needed
protected Pair_TSeries_Indicator(TSeries source1, TSeries source2, int period, bool useNaN)
{
this._p = period;
this._NaN = useNaN;
this._d1 = source1;
this._d2 = source2;
this._dd1 = double.NaN;
this._dd2 = double.NaN;
this._d1.Pub += this.Sub;
this._d2.Pub += this.Sub;
}
protected Pair_TSeries_Indicator(TSeries source1, TSeries source2) protected Pair_TSeries_Indicator(TSeries source1, TSeries source2)
{ {
this._d1 = source1; this._d1 = source1;
+46 -53
View File
@@ -1,54 +1,47 @@
namespace QuanTAlib; namespace QuanTAlib;
using System; using System;
using System.Text.Json; using System.Text.Json;
/* <summary> /* <summary>
Yahoo Finance - Free API feed to collect daily market quotes Yahoo Finance - Free API feed to collect daily market quotes
Parameters: Parameters:
Symbol: stock symbol (default: "IBM") Symbol: stock symbol (default: "IBM")
Period: number of days of collected history (default: 252) Period: number of days of collected history (default: 252)
Usage: Usage:
Yahoo_Feed ticker = new("MSFT", 20) Yahoo_Feed ticker = new("MSFT", 20)
</summary> */ </summary> */
public class Yahoo_Feed : TBars public class Yahoo_Feed : TBars
{ {
public Yahoo_Feed(string Symbol = "IBM", int Period = 252) { public Yahoo_Feed(string Symbol = "IBM", int Period = 252) {
string requestUrl = "https://query1.finance.yahoo.com/v8/finance/chart/"+ string requestUrl = "https://query1.finance.yahoo.com/v8/finance/chart/"+
Symbol+"?interval=1d&period1="+ Symbol+"?interval=1d&period1="+
(int)new DateTimeOffset(DateTime.UtcNow.AddDays(-Period+1)).ToUnixTimeSeconds()+"&period2="+ (int)new DateTimeOffset(DateTime.UtcNow.AddDays(-Period+1)).ToUnixTimeSeconds()+"&period2="+
(int)new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds(); (int)new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds();
System.Net.Http.HttpClient client = new(); System.Net.Http.HttpClient client = new();
var msg = client.GetStringAsync(requestUrl).Result; var msg = client.GetStringAsync(requestUrl).Result;
var jresult = JsonSerializer.Deserialize<JsonDocument>(msg).RootElement; var jresult = JsonSerializer.Deserialize<JsonDocument>(msg).RootElement;
JsonElement json = new();
JsonElement datetime = new(); jresult.TryGetProperty("chart",out JsonElement json);
JsonElement open = new(); json.TryGetProperty("result",out json);
JsonElement high = new(); json[0].TryGetProperty("timestamp",out JsonElement datetime);
JsonElement low = new(); json[0].TryGetProperty("indicators",out json);
JsonElement close = new(); json.TryGetProperty("quote",out json);
JsonElement volume = new(); json[0].TryGetProperty("open",out JsonElement open);
json[0].TryGetProperty("high",out JsonElement high);
jresult.TryGetProperty("chart",out json); json[0].TryGetProperty("low",out JsonElement low);
json.TryGetProperty("result",out json); json[0].TryGetProperty("close",out JsonElement close);
json[0].TryGetProperty("timestamp",out datetime); json[0].TryGetProperty("volume",out JsonElement volume);
json[0].TryGetProperty("indicators",out json);
json.TryGetProperty("quote",out json); for (int i=0; i<datetime.GetArrayLength(); i++) {
json[0].TryGetProperty("open",out open); DateTime d = DateTimeOffset.FromUnixTimeSeconds(long.Parse(datetime[i].GetRawText())).DateTime;
json[0].TryGetProperty("high",out high); double o = Math.Round(double.Parse(open[i].GetRawText()),3);
json[0].TryGetProperty("low",out low); double h = Math.Round(double.Parse(high[i].GetRawText()),3);
json[0].TryGetProperty("close",out close); double l = Math.Round(double.Parse(low[i].GetRawText()),3);
json[0].TryGetProperty("volume",out volume); double c = Math.Round(double.Parse(close[i].GetRawText()),3);
double v = Math.Round(double.Parse(volume[i].GetRawText()),3);
for (int i=0; i<datetime.GetArrayLength(); i++) { base.Add(d, o, h, l, c, v);
DateTime d = DateTimeOffset.FromUnixTimeSeconds(long.Parse(datetime[i].GetRawText())).DateTime; }
double o = Math.Round(double.Parse(open[i].GetRawText()),3); }
double h = Math.Round(double.Parse(high[i].GetRawText()),3);
double l = Math.Round(double.Parse(low[i].GetRawText()),3);
double c = Math.Round(double.Parse(close[i].GetRawText()),3);
double v = Math.Round(double.Parse(volume[i].GetRawText()),3);
base.Add(d, o, h, l, c, v);
}
}
} }
+7 -2
View File
@@ -51,7 +51,11 @@
<PackageIcon>QuanTAlib2.png</PackageIcon> <PackageIcon>QuanTAlib2.png</PackageIcon>
<PackageIconUrl>https://raw.githubusercontent.com/mihakralj/QuanTAlib/main/.github/QuanTAlib2.png</PackageIconUrl> <PackageIconUrl>https://raw.githubusercontent.com/mihakralj/QuanTAlib/main/.github/QuanTAlib2.png</PackageIconUrl>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild> <EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<CodeAnalysisRuleSet>..\.sonarlint\mihakralj_quantalibcsharp.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="..\.sonarlint\mihakralj_quantalib\CSharp\SonarLint.xml" Link="SonarLint.xml" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\Docs\readme.md"> <None Include="..\Docs\readme.md">
<Pack>True</Pack> <Pack>True</Pack>
@@ -64,10 +68,11 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.0" />
<PackageReference Include="GitVersion.MsBuild" Version="5.11.1"> <PackageReference Include="GitVersion.MsBuild" Version="5.11.1">
<PrivateAssets>All</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="System.Text.Json" Version="7.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+70
View File
@@ -0,0 +1,70 @@
namespace QuanTAlib;
using System;
/* <summary>
CORR: Pearson's Correlation Coefficient
PCC is a measure of linear correlation between two sets of data.
It is the ratio between the covariance of two variables and the product of
their standard deviations; it is essentially a normalized measurement of
the covariance, such that the result always has a value between 1 and 1.
Sources:
https://en.wikipedia.org/wiki/Pearson_correlation_coefficient
</summary> */
public class CORR_Series : Pair_TSeries_Indicator
{
public CORR_Series(TSeries d1, TSeries d2, int period, bool useNaN = false) : base(d1, d2, period, useNaN)
{
if (base._d1.Count > 0 && base._d2.Count > 0) { for (int i = 0; i < base._d1.Count; i++) { this.Add(base._d1[i], base._d2[i], false); } }
}
private readonly System.Collections.Generic.List<double> _x = new();
private readonly System.Collections.Generic.List<double> _xx = new();
private readonly System.Collections.Generic.List<double> _y = new();
private readonly System.Collections.Generic.List<double> _yy = new();
private readonly System.Collections.Generic.List<double> _xy = new();
public override void Add((System.DateTime t, double v) TValue1, (System.DateTime t, double v) TValue2, bool update)
{
if (update)
{
_x[_x.Count - 1] = TValue1.v;
_xx[_xx.Count - 1] = TValue1.v * TValue1.v;
_y[_y.Count - 1] = TValue2.v;
_y[_yy.Count - 1] = TValue2.v * TValue2.v;
_xy[_xy.Count - 1] = TValue1.v * TValue2.v;
}
else
{
_x.Add(TValue1.v);
_xx.Add(TValue1.v * TValue1.v);
_y.Add(TValue2.v);
_yy.Add(TValue2.v * TValue2.v);
_xy.Add(TValue1.v * TValue2.v);
}
if (_x.Count > this._p) { _x.RemoveAt(0); }
if (_xx.Count > this._p) { _xx.RemoveAt(0); }
if (_y.Count > this._p) { _y.RemoveAt(0); }
if (_yy.Count > this._p) { _yy.RemoveAt(0); }
if (_xy.Count > this._p) { _xy.RemoveAt(0); }
double _sumx = 0;
for (int i = 0; i < _x.Count; i++) { _sumx += _x[i]; }
double _sumxx = 0;
for (int i = 0; i < _xx.Count; i++) { _sumxx += _xx[i]; }
double _sumy = 0;
for (int i = 0; i < _y.Count; i++) { _sumy += _y[i]; }
double _sumyy = 0;
for (int i = 0; i < _yy.Count; i++) { _sumyy += _yy[i]; }
double _sumxy = 0;
for (int i = 0; i < _xy.Count; i++) { _sumxy += _xy[i]; }
double _div = (_sumxx - _sumx * _sumx / _p) * (_sumyy - _sumy * _sumy / _p);
double _cor = (_div != 0) ? (_sumxy - _sumx * _sumy / _p) / Math.Sqrt(_div) : 0.0;
var result = (TValue1.t, (this.Count < this._p - 1 && this._NaN) ? double.NaN : _cor);
if (update) { base[base.Count - 1] = result; } else { base.Add(result); }
}
}
+92 -95
View File
@@ -1,96 +1,93 @@
namespace QuanTAlib; namespace QuanTAlib;
using System; using System;
/* <summary> /* <summary>
LINREG: Linear Regression (using Least Square Method) LINREG: Linear Regression (using Least Square Method)
Linear Regression provides a slope of a straight line that is the best approximation of the given set of data. Linear Regression provides a slope of a straight line that is the best approximation of the given set of data.
The method of least squares is a standard approach in linear regression analysis to approximate the solution The method of least squares is a standard approach in linear regression analysis to approximate the solution
by minimizing the sum of the squares of the residuals made in the results of each individual equation. by minimizing the sum of the squares of the residuals made in the results of each individual equation.
Additional outputs provided by LINREG: Additional outputs provided by LINREG:
.Intercept - y-intercept point of the best fit line .Intercept - y-intercept point of the best fit line
.RSquared - R-Squared (R²), Coefficient of Determination .RSquared - R-Squared (R²), Coefficient of Determination
.StdDev - Standard Deviation of data over given periods .StdDev - Standard Deviation of data over given periods
y = Slope * x + Intercept y = Slope * x + Intercept
Sources: Sources:
https://en.wikipedia.org/wiki/Least_squares https://en.wikipedia.org/wiki/Least_squares
</summary> */ </summary> */
public class LINREG_Series : Single_TSeries_Indicator public class LINREG_Series : Single_TSeries_Indicator
{ {
public TSeries Intercept { get; } public readonly TSeries Intercept = new();
public TSeries RSquared { get; } public readonly TSeries RSquared = new();
public TSeries StdDev { get; } public readonly TSeries StdDev = new();
private readonly System.Collections.Generic.List<double> _buffer = new(); private readonly System.Collections.Generic.List<double> _buffer = new();
public LINREG_Series(TSeries source, int period, bool useNaN = false) public LINREG_Series(TSeries source, int period, bool useNaN = false)
: base(source, period, useNaN) : base(source, period, useNaN)
{ {
this.Intercept = new(); if (this._data.Count > 0) { base.Add(this._data); }
this.RSquared = new(); }
this.StdDev = new();
if (this._data.Count > 0) { base.Add(this._data); } public override void Add((System.DateTime t, double v) TValue, bool update)
} {
if (update) { this._buffer[this._buffer.Count - 1] = TValue.v; }
public override void Add((System.DateTime t, double v) TValue, bool update) else { this._buffer.Add(TValue.v); }
{ if (this._buffer.Count > this._p) { this._buffer.RemoveAt(0); }
if (update) { this._buffer[this._buffer.Count - 1] = TValue.v; }
else { this._buffer.Add(TValue.v); } int _len = this._buffer.Count;
if (this._buffer.Count > this._p) { this._buffer.RemoveAt(0); }
// get averages for period
int _len = this._buffer.Count; double sumX = 0;
double sumY = 0;
// get averages for period
double sumX = 0; for (int p = 0; p < _len; p++)
double sumY = 0; {
sumX += this.Count - _len + 2 + p;
for (int p = 0; p < _len; p++) sumY += _buffer[p];
{ }
sumX += this.Count - _len + 2 + p; double avgX = sumX / _len;
sumY += _buffer[p]; double avgY = sumY / _len;
}
double avgX = sumX / _len; // least squares method
double avgY = sumY / _len; double sumSqX = 0;
double sumSqY = 0;
// least squares method double sumSqXY = 0;
double sumSqX = 0;
double sumSqY = 0; for (int p = 0; p < _len; p++)
double sumSqXY = 0; {
double devX = this.Count - _len + 2 + p - avgX;
for (int p = 0; p < _len; p++) double devY = _buffer[p] - avgY;
{
double devX = this.Count - _len + 2 + p - avgX; sumSqX += devX * devX;
double devY = _buffer[p] - avgY; sumSqY += devY * devY;
sumSqXY += devX * devY;
sumSqX += devX * devX; }
sumSqY += devY * devY;
sumSqXY += devX * devY; double _slope = sumSqXY / sumSqX;
} double _intercept = avgY - (_slope * avgX);
double _slope = sumSqXY / sumSqX; // calculate Standard Deviation and R-Squared
double _intercept = avgY - (_slope * avgX); double stdDevX = Math.Sqrt(sumSqX / _len);
double stdDevY = Math.Sqrt(sumSqY / _len);
// calculate Standard Deviation and R-Squared double _StdDev = stdDevY;
double stdDevX = Math.Sqrt(sumSqX / _len);
double stdDevY = Math.Sqrt(sumSqY / _len); double arrr = (stdDevX * stdDevY != 0) ? sumSqXY / (stdDevX * stdDevY) / _len : 0;
double _StdDev = stdDevY; double _RSquared = arrr * arrr;
double arrr = (stdDevX * stdDevY != 0) ? sumSqXY / (stdDevX * stdDevY) / _len : 0; var ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _slope);
double _RSquared = arrr * arrr; base.Add(ret, update);
var ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _slope); ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _intercept);
base.Add(ret, update); Intercept.Add(ret, update);
ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _intercept); ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _StdDev);
Intercept.Add(ret, update); StdDev.Add(ret, update);
ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _StdDev); ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _RSquared);
StdDev.Add(ret, update); RSquared.Add(ret, update);
}
ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _RSquared);
RSquared.Add(ret, update);
}
} }
+51
View File
@@ -0,0 +1,51 @@
namespace QuanTAlib;
using System;
/* <summary>
ZSCORE: number of standard deviations from SMA
Z-score describes a value's relationship to the mean of a series, as measured in
terms of standard deviations from the mean. If a Z-score is 0, it indicates that
the data point's score is identical to the mean score. A Z-score of 1.0 would
indicate a value that is one standard deviation from the mean. Z-scores may be
positive or negative, with a positive value indicating the score is above the
mean and a negative score indicating it is below the mean.
Sources:
https://en.wikipedia.org/wiki/Z-score
https://www.investopedia.com/terms/z/zscore.asp
Calculation:
std = std * STDEV(close, length)
mean = SMA(close, length)
ZSCORE = (close - mean) / std
</summary> */
public class ZSCORE_Series : Single_TSeries_Indicator
{
public ZSCORE_Series(TSeries source, int period, bool useNaN = false) : base(source, period, useNaN)
{
if (base._data.Count > 0) { base.Add(base._data); }
}
private readonly System.Collections.Generic.List<double> _buffer = new();
public override void Add((System.DateTime t, double v) TValue, bool update)
{
if (update) { _buffer[_buffer.Count - 1] = TValue.v; }
else { _buffer.Add(TValue.v); }
if (_buffer.Count > this._p && this._p != 0) { _buffer.RemoveAt(0); }
double _sma = 0;
for (int i = 0; i < _buffer.Count; i++) { _sma += _buffer[i]; }
_sma /= this._buffer.Count;
double _pvar = 0;
for (int i = 0; i < _buffer.Count; i++) { _pvar += (_buffer[i] - _sma) * (_buffer[i] - _sma); }
_pvar /= this._buffer.Count;
double _psdev = Math.Sqrt(_pvar);
double _zscore = (_psdev == 0) ? double.NaN : (TValue.v - _sma) / _psdev;
var result = (TValue.t, (this.Count < this._p - 1 && this._NaN) ? double.NaN : _zscore);
base.Add(result, update);
}
}
+31 -6
View File
@@ -57,8 +57,9 @@ public class PandasTA : IDisposable
public void Dispose() public void Dispose()
{ {
PythonEngine.Shutdown(); PythonEngine.Shutdown();
} GC.SuppressFinalize(this);
}
[Fact] [Fact]
void HL2() void HL2()
@@ -191,10 +192,34 @@ public class PandasTA : IDisposable
{ {
TEMA_Series QL = new(bars.Close, period, false); TEMA_Series QL = new(bars.Close, period, false);
var pta = df.ta.tema(close: df.close, length: period); var pta = df.ta.tema(close: df.close, length: period);
Assert.Equal(Math.Round((double)pta.tail(1), 4), Math.Round(QL.Last().v, 4)); Assert.Equal(Math.Round((double)pta.tail(1), 7), Math.Round(QL.Last().v, 7));
} }
[Fact] [Fact]
void SDEV()
{
SDEV_Series QL = new(bars.Close, period, useNaN: false);
var pta = df.ta.stdev(close: df.close, length: period, ddof: 0);
Assert.Equal(Math.Round((double)pta.tail(1), 4), Math.Round(QL.Last().v, 4));
}
[Fact]
void SSDEV()
{
SSDEV_Series QL = new(bars.Close, period, useNaN: false);
var pta = df.ta.stdev(close: df.close, length: period, ddof: 1);
Assert.Equal(Math.Round((double)pta.tail(1), 4), Math.Round(QL.Last().v, 4));
}
[Fact]
void ZSCORE()
{
ZSCORE_Series QL = new(bars.Close, period, useNaN: false);
var pta = df.ta.zscore(close: df.close, length: period, ddof: 0);
Assert.Equal(Math.Round((double)pta.tail(1), 4), Math.Round(QL.Last().v, 4));
}
[Fact]
void ENTP() void ENTP()
{ {
ENTP_Series QL = new(bars.Close, period, useNaN: false); ENTP_Series QL = new(bars.Close, period, useNaN: false);
+301 -274
View File
@@ -5,278 +5,305 @@ using Xunit;
namespace Validations; namespace Validations;
public class Skender_Stock public class Skender_Stock
{ {
private readonly GBM_Feed bars; private readonly GBM_Feed bars;
private readonly Random rnd = new(); private readonly Random rnd = new();
private readonly int period; private readonly int period;
private readonly IEnumerable<Quote> quotes; private readonly IEnumerable<Quote> quotes;
public Skender_Stock() public Skender_Stock()
{ {
bars = new(Bars: 5000, Volatility: 0.7, Drift: 0.0); bars = new(Bars: 5000, Volatility: 0.7, Drift: 0.0);
period = rnd.Next(28) + 3; period = rnd.Next(28) + 3;
quotes = bars.Select( quotes = bars.Select(
q => new Quote q => new Quote
{ {
Date = q.t, Date = q.t,
Open = (decimal)q.o, Open = (decimal)q.o,
High = (decimal)q.h, High = (decimal)q.h,
Low = (decimal)q.l, Low = (decimal)q.l,
Close = (decimal)q.c, Close = (decimal)q.c,
Volume = (decimal)q.v Volume = (decimal)q.v
}); });
} }
[Fact] [Fact]
public void SMA() public void SMA()
{ {
SMA_Series QL = new(bars.Close, period, false); SMA_Series QL = new(bars.Close, period, false);
var SK = quotes.GetSma(period); var SK = quotes.GetSma(period);
Assert.Equal(Math.Round((double)SK.Last().Sma!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Sma!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void EMA() public void EMA()
{ {
EMA_Series QL = new(bars.Close, period, false); EMA_Series QL = new(bars.Close, period, false);
var SK = quotes.GetEma(period); var SK = quotes.GetEma(period);
Assert.Equal(Math.Round((double)SK.Last().Ema!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Ema!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void WMA() public void WMA()
{ {
WMA_Series QL = new(bars.Close, period, false); WMA_Series QL = new(bars.Close, period, false);
var SK = quotes.GetWma(period); var SK = quotes.GetWma(period);
Assert.Equal(Math.Round((double)SK.Last().Wma!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Wma!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void DEMA() public void DEMA()
{ {
DEMA_Series QL = new(bars.Close, period, false); DEMA_Series QL = new(bars.Close, period, false);
var SK = quotes.GetDema(period); var SK = quotes.GetDema(period);
Assert.Equal(Math.Round((double)SK.Last().Dema!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Dema!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void TEMA() public void TEMA()
{ {
TEMA_Series QL = new(bars.Close, period, false); TEMA_Series QL = new(bars.Close, period, false);
var SK = quotes.GetTema(period); var SK = quotes.GetTema(period);
Assert.Equal(Math.Round((double)SK.Last().Tema!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Tema!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void MAD() public void MAD()
{ {
MAD_Series QL = new(bars.Close, period, false); MAD_Series QL = new(bars.Close, period, false);
var SK = quotes.GetSmaAnalysis(period); var SK = quotes.GetSmaAnalysis(period);
Assert.Equal(Math.Round((double)SK.Last().Mad!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Mad!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void MAPE() public void MSE()
{ {
MAPE_Series QL = new(bars.Close, period, false); MSE_Series QL = new(bars.Close, period, false);
var SK = quotes.GetSmaAnalysis(period); var SK = quotes.GetSmaAnalysis(period);
Assert.Equal(Math.Round((double)SK.Last().Mape!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Mse!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void ATR() public void MAPE()
{ {
ATR_Series QL = new(bars, period, false); MAPE_Series QL = new(bars.Close, period, false);
var SK = quotes.GetAtr(period); var SK = quotes.GetSmaAnalysis(period);
Assert.Equal(Math.Round((double)SK.Last().Atr!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Mape!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void OBV() public void CORR()
{ {
OBV_Series QL = new(bars, period, false); CORR_Series QL = new(bars.High, bars.Low, period, false);
var SK = quotes.GetObv(period); var SK = quotes.Use(CandlePart.High).GetCorrelation(quotes.Use(CandlePart.Low), period);
// adding volume[0] to OBV to pass the test and keep compatibility with TA-LIB Assert.Equal(Math.Round((double)SK.Last().Correlation!, 6), Math.Round(QL.Last().v, 6));
Assert.Equal(Math.Round(SK.Last().Obv! + (double)quotes.First().Volume!, 5), }
Math.Round(QL.Last().v, 5));
} [Fact]
public void ATR()
[Fact] {
public void ADL() ATR_Series QL = new(bars, period, false);
{ var SK = quotes.GetAtr(period);
ADL_Series QL = new(bars, false);
var SK = quotes.GetAdl(); Assert.Equal(Math.Round((double)SK.Last().Atr!, 6), Math.Round(QL.Last().v, 6));
}
Assert.Equal(Math.Round((double)SK.Last().Adl!, 5), Math.Round(QL.Last().v, 5));
} [Fact]
public void OBV()
[Fact] {
public void CCI() OBV_Series QL = new(bars, period, false);
{ var SK = quotes.GetObv(period);
CCI_Series QL = new(bars, period, false);
var SK = quotes.GetCci(period); // adding volume[0] to OBV to pass the test and keep compatibility with TA-LIB
Assert.Equal(Math.Round(SK.Last().Obv! + (double)quotes.First().Volume!, 5),
Assert.Equal(Math.Round((double)SK.Last().Cci!, 6), Math.Round(QL.Last().v, 6)); Math.Round(QL.Last().v, 5));
} }
[Fact] [Fact]
public void ATRP() public void ADL()
{ {
ATRP_Series QL = new(bars, period, false); ADL_Series QL = new(bars, false);
var SK = quotes.GetAtr(period); var SK = quotes.GetAdl();
Assert.Equal(Math.Round((double)SK.Last().Atrp!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round(SK.Last().Adl!, 5), Math.Round(QL.Last().v, 5));
} }
[Fact] [Fact]
public void KAMA() public void CCI()
{ {
KAMA_Series QL = new(bars.Close, period, useNaN: false); CCI_Series QL = new(bars, period, false);
var SK = quotes.GetKama(period); var SK = quotes.GetCci(period);
Assert.Equal(Math.Round((double)SK.Last().Kama!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Cci!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void HMA() public void ATRP()
{ {
HMA_Series QL = new(bars.Close, period, useNaN: false); ATRP_Series QL = new(bars, period, false);
var SK = quotes.GetHma(period); var SK = quotes.GetAtr(period);
Assert.Equal(Math.Round((double)SK.Last().Hma!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Atrp!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void SMMA() public void KAMA()
{ {
SMMA_Series QL = new(bars.Close, period, useNaN: false); KAMA_Series QL = new(bars.Close, period, useNaN: false);
var SK = quotes.GetSmma(period); var SK = quotes.GetKama(period);
Assert.Equal(Math.Round((double)SK.Last().Smma!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Kama!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void MACD() public void HMA()
{ {
MACD_Series QL = new(bars.Close, 26, 12, 9, useNaN: false); HMA_Series QL = new(bars.Close, period, useNaN: false);
var SK = quotes.GetMacd(12, 26, 9); var SK = quotes.GetHma(period);
Assert.Equal(Math.Round((double)SK.Last().Macd!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Hma!, 6), Math.Round(QL.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().Signal!, 6), Math.Round(QL.Signal.Last().v, 6)); }
}
[Fact]
[Fact] public void SMMA()
public void BBANDS() {
{ SMMA_Series QL = new(bars.Close, period, useNaN: false);
BBANDS_Series QL = new(bars.Close, period, 2.0, useNaN: false); var SK = quotes.GetSmma(period);
var SK = quotes.GetBollingerBands(period, 2.0);
Assert.Equal(Math.Round((double)SK.Last().Smma!, 6), Math.Round(QL.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().Sma!, 6), Math.Round(QL.Mid.Last().v, 6)); }
Assert.Equal(Math.Round((double)SK.Last().UpperBand!, 6), Math.Round(QL.Upper.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().LowerBand!, 6), Math.Round(QL.Lower.Last().v, 6)); [Fact]
Assert.Equal(Math.Round((double)SK.Last().Width!, 6), Math.Round(QL.Bandwidth.Last().v, 6)); public void MACD()
Assert.Equal(Math.Round((double)SK.Last().PercentB!, 6), Math.Round(QL.PercentB.Last().v, 6)); {
Assert.Equal(Math.Round((double)SK.Last().ZScore!, 6), Math.Round(QL.Zscore.Last().v, 6)); MACD_Series QL = new(bars.Close, 26, 12, 9, useNaN: false);
} var SK = quotes.GetMacd(12, 26, 9);
[Fact] Assert.Equal(Math.Round((double)SK.Last().Macd!, 6), Math.Round(QL.Last().v, 6));
public void RSI() Assert.Equal(Math.Round((double)SK.Last().Signal!, 6), Math.Round(QL.Signal.Last().v, 6));
{ }
RSI_Series QL = new(bars.Close, period, useNaN: false);
var SK = quotes.GetRsi(period); [Fact]
public void BBANDS()
Assert.Equal(Math.Round((double)SK.Last().Rsi!, 6), Math.Round(QL.Last().v, 6)); {
} BBANDS_Series QL = new(bars.Close, period, 2.0, useNaN: false);
var SK = quotes.GetBollingerBands(period, 2.0);
[Fact]
public void ALMA() Assert.Equal(Math.Round((double)SK.Last().Sma!, 6), Math.Round(QL.Mid.Last().v, 6));
{ Assert.Equal(Math.Round((double)SK.Last().UpperBand!, 6), Math.Round(QL.Upper.Last().v, 6));
ALMA_Series QL = new(bars.Close, period, useNaN: false); Assert.Equal(Math.Round((double)SK.Last().LowerBand!, 6), Math.Round(QL.Lower.Last().v, 6));
var SK = quotes.GetAlma(period); Assert.Equal(Math.Round((double)SK.Last().Width!, 6), Math.Round(QL.Bandwidth.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().PercentB!, 6), Math.Round(QL.PercentB.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().Alma!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().ZScore!, 6), Math.Round(QL.Zscore.Last().v, 6));
} }
[Fact] [Fact]
public void SDEV() public void RSI()
{ {
SDEV_Series QL = new(bars.Close, period, useNaN: false); RSI_Series QL = new(bars.Close, period, useNaN: false);
var SK = quotes.GetStdDev(period); var SK = quotes.GetRsi(period);
Assert.Equal(Math.Round((double)SK.Last().StdDev!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Rsi!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void LINREG() public void ALMA()
{ {
LINREG_Series QL = new(bars.Close, period, useNaN: false); ALMA_Series QL = new(bars.Close, period, useNaN: false);
var SK = quotes.GetSlope(period); var SK = quotes.GetAlma(period);
Assert.Equal(Math.Round((double)SK.Last().Slope!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Alma!, 6), Math.Round(QL.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().Intercept!, 6), Math.Round(QL.Intercept.Last().v, 6)); }
Assert.Equal(Math.Round((double)SK.Last().RSquared!, 6), Math.Round(QL.RSquared.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().StdDev!, 6), Math.Round(QL.StdDev.Last().v, 6)); [Fact]
} public void SDEV()
{
[Fact] SDEV_Series QL = new(bars.Close, period, useNaN: false);
public void TR() var SK = quotes.GetStdDev(period);
{
TR_Series QL = new(bars, useNaN: false); Assert.Equal(Math.Round((double)SK.Last().StdDev!, 6), Math.Round(QL.Last().v, 6));
var SK = quotes.GetTr(); }
Assert.Equal(Math.Round((double)SK.Last().Tr!, 6), Math.Round(QL.Last().v, 6)); [Fact]
} public void ZSCORE()
{
[Fact] ZSCORE_Series QL = new(bars.Close, period, useNaN: false);
public void HL2() var SK = quotes.GetStdDev(period);
{
TSeries QL = bars.HL2; Assert.Equal(Math.Round((double)SK.Last().ZScore!, 6), Math.Round(QL.Last().v, 6));
var SK = quotes.GetBaseQuote(CandlePart.HL2); }
Assert.Equal(Math.Round((double)SK.Last().Value!, 6), Math.Round(QL.Last().v, 6)); [Fact]
} public void LINREG()
{
[Fact] LINREG_Series QL = new(bars.Close, period, useNaN: false);
public void OC2() var SK = quotes.GetSlope(period);
{
TSeries QL = bars.OC2; Assert.Equal(Math.Round((double)SK.Last().Slope!, 6), Math.Round(QL.Last().v, 6));
var SK = quotes.GetBaseQuote(CandlePart.OC2); Assert.Equal(Math.Round((double)SK.Last().Intercept!, 6), Math.Round(QL.Intercept.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().RSquared!, 6), Math.Round(QL.RSquared.Last().v, 6));
Assert.Equal(Math.Round((double)SK.Last().Value!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().StdDev!, 6), Math.Round(QL.StdDev.Last().v, 6));
} }
[Fact] [Fact]
public void HLC3() public void TR()
{ {
TSeries QL = bars.HLC3; TR_Series QL = new(bars, useNaN: false);
var SK = quotes.GetBaseQuote(CandlePart.HLC3); var SK = quotes.GetTr();
Assert.Equal(Math.Round((double)SK.Last().Value!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round((double)SK.Last().Tr!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void OHL3() public void HL2()
{ {
TSeries QL = bars.OHL3; TSeries QL = bars.HL2;
var SK = quotes.GetBaseQuote(CandlePart.OHL3); var SK = quotes.GetBaseQuote(CandlePart.HL2);
Assert.Equal(Math.Round((double)SK.Last().Value!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round(SK.Last().Value!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact] [Fact]
public void OHLC4() public void OC2()
{ {
TSeries QL = bars.OHLC4; TSeries QL = bars.OC2;
var SK = quotes.GetBaseQuote(CandlePart.OHLC4); var SK = quotes.GetBaseQuote(CandlePart.OC2);
Assert.Equal(Math.Round((double)SK.Last().Value!, 6), Math.Round(QL.Last().v, 6)); Assert.Equal(Math.Round(SK.Last().Value!, 6), Math.Round(QL.Last().v, 6));
} }
[Fact]
public void HLC3()
{
TSeries QL = bars.HLC3;
var SK = quotes.GetBaseQuote(CandlePart.HLC3);
Assert.Equal(Math.Round(SK.Last().Value!, 6), Math.Round(QL.Last().v, 6));
}
[Fact]
public void OHL3()
{
TSeries QL = bars.OHL3;
var SK = quotes.GetBaseQuote(CandlePart.OHL3);
Assert.Equal(Math.Round(SK.Last().Value!, 6), Math.Round(QL.Last().v, 6));
}
[Fact]
public void OHLC4()
{
TSeries QL = bars.OHLC4;
var SK = quotes.GetBaseQuote(CandlePart.OHLC4);
Assert.Equal(Math.Round((double)SK.Last().Value!, 6), Math.Round(QL.Last().v, 6));
}
} }
+310 -301
View File
@@ -5,305 +5,314 @@ using QuanTAlib;
namespace Validations; namespace Validations;
public class TA_LIB public class TA_LIB
{ {
private readonly GBM_Feed bars; private readonly GBM_Feed bars;
private readonly Random rnd = new(); private readonly Random rnd = new();
private readonly int period; private readonly int period;
private readonly double[] TALIB; private readonly double[] TALIB;
private readonly double[] inopen; private readonly double[] inopen;
private readonly double[] inhigh; private readonly double[] inhigh;
private readonly double[] inlow; private readonly double[] inlow;
private readonly double[] inclose; private readonly double[] inclose;
private readonly double[] involume; private readonly double[] involume;
public TA_LIB() public TA_LIB()
{ {
bars = new(5000); bars = new(5000);
period = rnd.Next(28) + 3; period = rnd.Next(28) + 3;
TALIB = new double[bars.Count]; TALIB = new double[bars.Count];
inopen = bars.Open.v.ToArray(); inopen = bars.Open.v.ToArray();
inhigh = bars.High.v.ToArray(); inhigh = bars.High.v.ToArray();
inlow = bars.Low.v.ToArray(); inlow = bars.Low.v.ToArray();
inclose = bars.Close.v.ToArray(); inclose = bars.Close.v.ToArray();
involume = bars.Volume.v.ToArray(); involume = bars.Volume.v.ToArray();
} }
///////////////////////////////////////// /////////////////////////////////////////
[Fact] [Fact]
public void ADD() public void ADD()
{ {
ADD_Series QL = new(bars.Open, bars.Close); ADD_Series QL = new(bars.Open, bars.Close);
Core.Add(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.Add(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void SUB() public void SUB()
{ {
SUB_Series QL = new(bars.Open, bars.Close); SUB_Series QL = new(bars.Open, bars.Close);
Core.Sub(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.Sub(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void MUL() public void MUL()
{ {
MUL_Series QL = new(bars.Open, bars.Close); MUL_Series QL = new(bars.Open, bars.Close);
Core.Mult(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.Mult(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void DIV() public void DIV()
{ {
DIV_Series QL = new(bars.Open, bars.Close); DIV_Series QL = new(bars.Open, bars.Close);
Core.Div(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.Div(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void SDEV() public void CORR()
{ {
SDEV_Series QL = new(bars.Close, period, false); CORR_Series QL = new(bars.Open, bars.Close, period);
Core.StdDev(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Correl(inopen, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, optInTimePeriod: period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void SMA() public void SDEV()
{ {
SMA_Series QL = new(bars.Close, period, false); SDEV_Series QL = new(bars.Close, period, false);
Core.Sma(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.StdDev(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void SUM() public void SMA()
{ {
SUM_Series QL = new(bars.Close, period, false); SMA_Series QL = new(bars.Close, period, false);
Core.Sum(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Sma(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void MIDPRICE() public void SUM()
{ {
MIDPRICE_Series QL = new(bars, period, false); SUM_Series QL = new(bars.Close, period, false);
Core.MidPrice(inhigh, inlow, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Sum(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact]
[Fact] public void MIDPRICE()
public void VAR() {
{ MIDPRICE_Series QL = new(bars, period, false);
VAR_Series QL = new(bars.Close, period, false); Core.MidPrice(inhigh, inlow, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Core.Var(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 5, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 5)); }
}
[Fact] [Fact]
public void MIDPOINT() public void VAR()
{ {
MIDPOINT_Series QL = new(bars.Close, period, false); VAR_Series QL = new(bars.Close, period, false);
Core.MidPoint(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Var(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 5, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 5));
} }
[Fact] [Fact]
public void TRIMA() public void MIDPOINT()
{ {
TRIMA_Series QL = new(bars.Close, period, false); MIDPOINT_Series QL = new(bars.Close, period, false);
Core.Trima(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.MidPoint(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void EMA() public void TRIMA()
{ {
EMA_Series QL = new(bars.Close, period, false); TRIMA_Series QL = new(bars.Close, period, false);
Core.Ema(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Trima(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void WMA() public void EMA()
{ {
WMA_Series QL = new(bars.Close, period, false); EMA_Series QL = new(bars.Close, period, false);
Core.Wma(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Ema(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void DEMA() public void WMA()
{ {
DEMA_Series QL = new(bars.Close, period, false); WMA_Series QL = new(bars.Close, period, false);
Core.Dema(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Wma(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void TEMA() public void DEMA()
{ {
TEMA_Series QL = new(bars.Close, period, false); DEMA_Series QL = new(bars.Close, period, false);
Core.Tema(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Dema(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void MAX() public void TEMA()
{ {
MAX_Series QL = new(bars.Close, period, false); TEMA_Series QL = new(bars.Close, period, false);
Core.Max(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Tema(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void MIN() public void MAX()
{ {
MIN_Series QL = new(bars.Close, period, false); MAX_Series QL = new(bars.Close, period, false);
Core.Min(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Max(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void ADL() public void MIN()
{ {
ADL_Series QL = new(bars, false); MIN_Series QL = new(bars.Close, period, false);
Core.Ad(inhigh, inlow, inclose, involume, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.Min(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void OBV() public void ADL()
{ {
OBV_Series QL = new(bars, period, false); ADL_Series QL = new(bars, false);
Core.Obv(inclose, involume, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.Ad(inhigh, inlow, inclose, involume, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void ADOSC() public void OBV()
{ {
ADOSC_Series QL = new(bars, false); OBV_Series QL = new(bars, period, false);
Core.AdOsc(inhigh, inlow, inclose, involume, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.Obv(inclose, involume, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void ATR() public void ADOSC()
{ {
ATR_Series QL = new(bars, period, false); ADOSC_Series QL = new(bars, false);
Core.Atr(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.AdOsc(inhigh, inlow, inclose, involume, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void CCI() public void ATR()
{ {
CCI_Series QL = new(bars, period, false); ATR_Series QL = new(bars, period, false);
Core.Cci(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Atr(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void RSI() public void CCI()
{ {
RSI_Series QL = new(bars.Close, period, false); CCI_Series QL = new(bars, period, false);
Core.Rsi(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period); Core.Cci(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void TR() public void RSI()
{ {
TR_Series QL = new(bars, false); RSI_Series QL = new(bars.Close, period, false);
Core.TRange(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.Rsi(inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _, period);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void MACD() public void TR()
{ {
double[] macdSignal = new double[bars.Count]; TR_Series QL = new(bars, false);
double[] macdHist = new double[bars.Count]; Core.TRange(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
MACD_Series QL = new(bars.Close, slow: 26, fast: 12, signal: 9, false);
Core.Macd(inclose, 0, bars.Count - 1, outMacd: TALIB, outMacdSignal: macdSignal, outMacdHist: macdHist, out int outBegIdx, out _); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); }
Assert.Equal(Math.Round(macdSignal[macdSignal.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Signal.Last().v, 6, MidpointRounding.AwayFromZero));
} [Fact]
public void MACD()
[Fact] {
public void BBANDS() double[] macdSignal = new double[bars.Count];
{ double[] macdHist = new double[bars.Count];
double[] outMiddle = new double[bars.Count]; MACD_Series QL = new(bars.Close, slow: 26, fast: 12, signal: 9, false);
double[] outUpper = new double[bars.Count]; Core.Macd(inclose, 0, bars.Count - 1, outMacd: TALIB, outMacdSignal: macdSignal, outMacdHist: macdHist, out int outBegIdx, out _);
double[] outLower = new double[bars.Count]; Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
BBANDS_Series QL = new(bars.Close, period: 26, multiplier: 2.0, false); Assert.Equal(Math.Round(macdSignal[macdSignal.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Signal.Last().v, 6, MidpointRounding.AwayFromZero));
Core.Bbands(inclose, 0, bars.Count - 1, outRealUpperBand: outUpper, outRealMiddleBand: outMiddle, outRealLowerBand: outLower, out int outBegIdx, out _, optInTimePeriod: 26, optInNbDevUp: 2.0, optInNbDevDn: 2.0); }
Assert.Equal(Math.Round(outUpper[outUpper.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Upper.Last().v, 6, MidpointRounding.AwayFromZero));
Assert.Equal(Math.Round(outMiddle[outMiddle.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Mid.Last().v, 6, MidpointRounding.AwayFromZero)); [Fact]
Assert.Equal(Math.Round(outLower[outLower.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Lower.Last().v, 6, MidpointRounding.AwayFromZero)); public void BBANDS()
} {
double[] outMiddle = new double[bars.Count];
[Fact] double[] outUpper = new double[bars.Count];
public void HL2() double[] outLower = new double[bars.Count];
{ BBANDS_Series QL = new(bars.Close, period: 26, multiplier: 2.0, false);
TSeries QL = bars.HL2; Core.Bbands(inclose, 0, bars.Count - 1, outRealUpperBand: outUpper, outRealMiddleBand: outMiddle, outRealLowerBand: outLower, out int outBegIdx, out _, optInTimePeriod: 26, optInNbDevUp: 2.0, optInNbDevDn: 2.0);
Core.MedPrice(inhigh, inlow, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Assert.Equal(Math.Round(outUpper[outUpper.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Upper.Last().v, 6, MidpointRounding.AwayFromZero));
Assert.Equal(Math.Round(outMiddle[outMiddle.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Mid.Last().v, 6, MidpointRounding.AwayFromZero));
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(outLower[outLower.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Lower.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void HLC3() public void HL2()
{ {
TSeries QL = bars.HLC3; TSeries QL = bars.HL2;
Core.TypPrice(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.MedPrice(inhigh, inlow, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void OHLC4() public void HLC3()
{ {
TSeries QL = bars.OHLC4; TSeries QL = bars.HLC3;
Core.AvgPrice(inopen, inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.TypPrice(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact] [Fact]
public void HLCC4() public void OHLC4()
{ {
TSeries QL = bars.HLCC4; TSeries QL = bars.OHLC4;
Core.WclPrice(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _); Core.AvgPrice(inopen, inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero)); Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
} }
[Fact]
public void HLCC4()
{
TSeries QL = bars.HLCC4;
Core.WclPrice(inhigh, inlow, inclose, 0, bars.Count - 1, TALIB, out int outBegIdx, out _);
Assert.Equal(Math.Round(TALIB[TALIB.Length - outBegIdx - 1], 6, MidpointRounding.AwayFromZero), Math.Round(QL.Last().v, 6, MidpointRounding.AwayFromZero));
}
} }
-87
View File
@@ -1,87 +0,0 @@
## 1. Prepare the Peloton tablet
Stop Peloton overlay app:
- tap on Settings in the top right corner and select Device Settings
- tap Apps and scroll down to find and tap Peloton app (not Peloton Launcher, just Peloton)
- tap FORCE STOP to stop the app overlay
- confrm by tapping OK
Turn on developer mode
- return to Settings page
- tap About tablet in System section
- tap Build number repeatedly until you activate developer mode
Enable USB debugging
- return to Settings page
- tap (now visible) Developer options in System section
- scroll down to find USB Debugging option
- Enable USB debugging
- Confirm by tapping OK
## 3. Prepare the PC with Zwift/Rouvy
- Create your Splashtop account https://my.splashtop.com/login
- Download and install Splashtop Streamer https://www.splashtop.com/downloads#pers
- Download Android Platform Tools https://developer.android.com/studio/releases/platform-tools
- Download Nova launcher APK (or any other launcher that works on Android 7) https://apkpure.com/nova-launcher/com.teslacoilsw.launcher/download/62019-APK
- Download Splashtop APK https://apkpure.com/splashtop-personal-access/com.splashtop.remote.pad.v2
- Unzip Android tools into a new folder
- move both APKs to the same folder
- Run Command Prompt (CMD) and move to the same folder
- Launch Android Debuging Bridge: adb start-server
- Connect PC and Peloton tablet with USB cable
- Peloton tablet will check for confirmation; Accept debugging over USB
- Verify connectivity on PC in the Command window: adb devices
## 4. Side-load APKs
- Execute the following three commands on PC:
adb shell settings put secure install_non_market_apps 1
adb install <name_of_nova_launcher.apk>
adb install <name_of_splashtop.apk>
- Disconnect USB cable
- On Peloton tablet tap Peloton 'P' logo at the bottom
- Select Nova as a default launcher
- Accept all defaults for Nova launcher - you can customize it later
- (optional) Bring Peloton and Splashtop icons to the main page of Nova launcher
- Choosing Peloton launches Peloton app; Choosing Splashtop launches Splashtop app
- Swiping down from the top of the screen reveals the hidden 'P' launcher button
## 5. Connect Peloton tablet and PC
- Launch Splashtop app on Peloton tablet
- Login with Splashtop credentials
- Connect to PC that runs Splashtop streamer (and Zwift/Rouvy)
- Launch Zwift/Rouvy
## 5. Enable sensors
- (optional): buy ANT+ USB dongle https://www.amazon.com/s?k=ant%2B+USB+stick
Peloton Tread:
Speed: Runn https://npe-inc.com/runn-smart-treadmill-sensor-2/
(or Stryd https://www.stryd.com/us/en)
Cadence: Garmin foodpod (or Stryd)
Heartrate: any HR monitor (BT or ANT+) https://www.amazon.com/s?k=bluetooth+HR+monitor
Power: Stryd
Peloton Bike (gen1):
Power & Cadence: DFC (Data Fitness Connector) https://www.crowdsupply.com/intelligenate/data-fitness-connector
Heartrate:vany HR monitor (BT or ANT+)
## 6. Navigation
Nova is now a default launcher on Android tablet, but on Tread we need to run Peloton app in the background to prevent locking of treadmill:
- Launch Peloton app
- Swipe down from the top and return to Nova launcher
- Launch Splashtop app
- Connect to PC
- Launch Zwift or Rouvy
- Connect all sensors
- Run/Ride!
+29 -29
View File
@@ -38,13 +38,13 @@ See [Getting Started](https://github.com/mihakralj/QuanTAlib/blob/main/Docs/gett
| **BASIC TRANSFORMS** | **QuanTAlib** | **TA-LIB** | **Skender** | **Pandas TA** | | **BASIC TRANSFORMS** | **QuanTAlib** | **TA-LIB** | **Skender** | **Pandas TA** |
|--|:--:|:--:|:--:|:--:| |--|:--:|:--:|:--:|:--:|
| ⭐ OC2 - (Open+Close)/2 | `.OC2` || CandlePart.OC2 || | ⭐ OC2 - (Open+Close)/2 | `.OC2` || CandlePart.OC2 ||
| ⭐ HL2 - Median Price | `.HL2` | MEDPRICE | CandlePart.HL2 || | ⭐ HL2 - Median Price | `.HL2` | MEDPRICE | CandlePart.HL2 | hl2 |
| ⭐ HLC3 - Typical Price | `.HLC3` | TYPPRICE | CandlePart.HLC3 || | ⭐ HLC3 - Typical Price | `.HLC3` | TYPPRICE | CandlePart.HLC3 | hlc3 |
| ⭐ OHL3 - (Open+High+Low)/3 | `.OHL3` || CandlePart.OHL3 || | ⭐ OHL3 - (Open+High+Low)/3 | `.OHL3` || CandlePart.OHL3 ||
| ⭐ OHLC4 - Average Price | `.OHLC4` | AVGPRICE | CandlePart.OHLC4 || | ⭐ OHLC4 - Average Price | `.OHLC4` | AVGPRICE | CandlePart.OHLC4 | ohlc4 |
| ⭐ HLCC4 - Weighted Price | `.HLCC4` | WCLPRICE | CandlePart.HLCC4 || | ⭐ HLCC4 - Weighted Price | `.HLCC4` | WCLPRICE | CandlePart.HLCC4 ||
| ⭐ MIDPOINT - Midpoint value | `MIDPOINT_Series` | MIDPOINT ||| | ⭐ MIDPOINT - Midpoint value | `MIDPOINT_Series` | MIDPOINT || midpoint |
| ⭐ MIDPRICE - Midpoint price | `MIDPRICE_Series` | MIDPRICE ||| | ⭐ MIDPRICE - Midpoint price | `MIDPRICE_Series` | MIDPRICE || midprice |
| ⭐ MAX - Max value | `MAX_Series` | MAX ||| | ⭐ MAX - Max value | `MAX_Series` | MAX |||
| ⭐ MIN - Min value | `MIN_Series` | MIN ||| | ⭐ MIN - Min value | `MIN_Series` | MIN |||
| ⭐ SUM - Summation | `SUM_Series` | SUM ||| | ⭐ SUM - Summation | `SUM_Series` | SUM |||
@@ -55,7 +55,7 @@ See [Getting Started](https://github.com/mihakralj/QuanTAlib/blob/main/Docs/gett
||||| |||||
| **STATISTICS & NUMERICAL ANALYSIS** | **QuanTAlib** | **TA-LIB** | **Skender** | **Pandas TA** | | **STATISTICS & NUMERICAL ANALYSIS** | **QuanTAlib** | **TA-LIB** | **Skender** | **Pandas TA** |
| ⭐ BIAS - Bias | `BIAS_Series` ||| bias | | ⭐ BIAS - Bias | `BIAS_Series` ||| bias |
| CORREL - Pearson's Correlation Coefficient || CORREL | GetCorrelation || | CORR - Pearson's Correlation Coefficient | `CORR_Series` | CORREL | GetCorrelation ||
| ⛔ COVAR - Covariance ||| GetCorrelation || | ⛔ COVAR - Covariance ||| GetCorrelation ||
| ⭐ ENTP - Entropy | `ENTP_Series` ||| entropy | | ⭐ ENTP - Entropy | `ENTP_Series` ||| entropy |
| ⭐ KURT - Kurtosis | `KURT_Series` ||| kurtosis | | ⭐ KURT - Kurtosis | `KURT_Series` ||| kurtosis |
@@ -63,54 +63,54 @@ See [Getting Started](https://github.com/mihakralj/QuanTAlib/blob/main/Docs/gett
| ⭐ MAD - Mean Absolute Deviation | `MAD_Series` || GetSma | mad | | ⭐ MAD - Mean Absolute Deviation | `MAD_Series` || GetSma | mad |
| ⭐ MAPE - Mean Absolute Percent Error | `MAPE_Series` || GetSma || | ⭐ MAPE - Mean Absolute Percent Error | `MAPE_Series` || GetSma ||
| ⭐ MED - Median value | `MED_Series` ||| median | | ⭐ MED - Median value | `MED_Series` ||| median |
| ✔️ MSE - Mean Squared Error | `MSE_Series` || GetSma || | MSE - Mean Squared Error | `MSE_Series` || GetSma ||
| ⛔ SKEW - Skewness ||||| | ⛔ SKEW - Skewness |||| skew |
| ⭐ SDEV - Standard Deviation (Volatility) | `SDEV_Series` | STDDEV ||| | ⭐ SDEV - Standard Deviation (Volatility) | `SDEV_Series` | STDDEV | GetStdDev | stdev |
| ✔️ SSDEV - Sample Standard Deviation | `SSDEV_Series` |||| | SSDEV - Sample Standard Deviation | `SSDEV_Series` ||| stdev |
| ✔️ SMAPE - Symmetric Mean Absolute Percent Error | `SMAPE_Series` |||| | ✔️ SMAPE - Symmetric Mean Absolute Percent Error | `SMAPE_Series` ||||
| ⭐ VAR - Population Variance | `VAR_Series` | VAR || variance | | ⭐ VAR - Population Variance | `VAR_Series` | VAR || variance |
| ⭐ SVAR - Sample Variance | `SVAR_Series` ||| variance | | ⭐ SVAR - Sample Variance | `SVAR_Series` ||| variance |
| ⛔ QUANT - Quantile ||||| | ⛔ QUANTILE - Quantile |||| quantile |
| ✔️ WMAPE - Weighted Mean Absolute Percent Error | `WMAPE_Series` |||| | ✔️ WMAPE - Weighted Mean Absolute Percent Error | `WMAPE_Series` ||||
| ZSCORE - Number of standard deviations from mean ||||| | ZSCORE - Number of standard deviations from mean | `ZSCORE_Series` || GetStdDev | zscore |
|||||| ||||||
| **TREND INDICATORS & AVERAGES** | **QuanTAlib** | **TA-LIB** | **Skender** | **Pandas TA** | | **TREND INDICATORS & AVERAGES** | **QuanTAlib** | **TA-LIB** | **Skender** | **Pandas TA** |
| ⛔ AFIRMA - Autoregressive Finite Impulse Response Moving Average ||||| | ⛔ AFIRMA - Autoregressive Finite Impulse Response Moving Average |||||
| ⭐ ALMA - Arnaud Legoux Moving Average | `ALMA_Series` || GetAlma || | ⭐ ALMA - Arnaud Legoux Moving Average | `ALMA_Series` || GetAlma | alma |
| ⛔ ARIMA - Autoregressive Integrated Moving Average ||||| | ⛔ ARIMA - Autoregressive Integrated Moving Average |||||
| ⭐ DEMA - Double EMA Average | `DEMA_Series` | DEMA | GetDema | dema | | ⭐ DEMA - Double EMA Average | `DEMA_Series` | DEMA | GetDema | dema |
| ⭐ EMA - Exponential Moving Average | `EMA_Series` || GetEma | ema | | ⭐ EMA - Exponential Moving Average | `EMA_Series` || GetEma | ema |
| ⛔ EPMA - Endpoint Moving Average ||| GetEpma || | ⛔ EPMA - Endpoint Moving Average ||| GetEpma ||
| ⛔ FRAMA - Fractal Adaptive Moving Average ||||| | ⛔ FRAMA - Fractal Adaptive Moving Average |||||
| ⛔ FWMA - Fibonacci's Weighted Moving Average ||||| | ⛔ FWMA - Fibonacci's Weighted Moving Average |||| fwma |
| ⛔ HILO - Gann High-Low Activator ||||| | ⛔ HILO - Gann High-Low Activator |||| hilo |
| ✔️ HEMA - Hull/EMA Average | `HEMA_Series` |||| | ✔️ HEMA - Hull/EMA Average | `HEMA_Series` ||||
| ⛔ Hilbert Transform Instantaneous Trendline || HT_TRENDLINE | GetHtTrendline || | ⛔ Hilbert Transform Instantaneous Trendline || HT_TRENDLINE | GetHtTrendline ||
| ⭐ HMA - Hull Moving Average | `HMA_Series` || GetHma | hma | | ⭐ HMA - Hull Moving Average | `HMA_Series` || GetHma | hma |
| ⛔ HWMA - Holt-Winter Moving Average ||||| | ⛔ HWMA - Holt-Winter Moving Average |||| hwma |
| ✔️ JMA - Jurik Moving Average | `JMA_Series` |||| | ✔️ JMA - Jurik Moving Average | `JMA_Series` ||| jma |
| ⭐ KAMA - Kaufman's Adaptive Moving Average | `KAMA_Series` | KAMA | GetKama | kama | | ⭐ KAMA - Kaufman's Adaptive Moving Average | `KAMA_Series` | KAMA | GetKama | kama |
| ⛔ KDJ - KDJ Indicator (trend reversal) ||||| | ⛔ KDJ - KDJ Indicator (trend reversal) |||| kdj |
| ⛔ LSMA - Least Squares Moving Average ||||| | ⛔ LSMA - Least Squares Moving Average |||||
| ⭐ MACD - Moving Average Convergence/Divergence | `MACD_Series` | MACD | GetMacd || | ⭐ MACD - Moving Average Convergence/Divergence | `MACD_Series` | MACD | GetMacd | macd |
| ⛔ MAMA - MESA Adaptive Moving Average || MAMA | GetMama || | ⛔ MAMA - MESA Adaptive Moving Average || MAMA | GetMama ||
| ⛔ MCGD - McGinley Dynamic ||||| | ⛔ MCGD - McGinley Dynamic |||| mcgd |
| ⛔ MMA - Modified Moving Average ||||| | ⛔ MMA - Modified Moving Average |||||
| ⛔ PPMA - Pivot Point Moving Average ||||| | ⛔ PPMA - Pivot Point Moving Average |||||
| ⛔ PWMA - Pascal's Weighted Moving Average ||||| | ⛔ PWMA - Pascal's Weighted Moving Average |||| pwma |
| ⭐ RMA - WildeR's Moving Average | `RMA_Series` ||| rma | | ⭐ RMA - WildeR's Moving Average | `RMA_Series` ||| rma |
| ⛔ SINWMA - Sine Weighted Moving Average ||||| | ⛔ SINWMA - Sine Weighted Moving Average |||| sinwma |
| ⭐ SMA - Simple Moving Average | `SMA_Series` | SMA | GetSma | sma | | ⭐ SMA - Simple Moving Average | `SMA_Series` | SMA | GetSma | sma |
| ⭐ SMMA - Smoothed Moving Average | `SMMA_Series` || GetSmma || | ⭐ SMMA - Smoothed Moving Average | `SMMA_Series` || GetSmma ||
| ⛔ SSF - Ehler's Super Smoother Filter ||||| | ⛔ SSF - Ehler's Super Smoother Filter |||| ssf |
| ⛔ SUP - Supertrend ||||| | ⛔ SUPERTREND - Supertrend |||| supertrend |
| ⛔ SWMA - Symmetric Weighted Moving Average ||||| | ⛔ SWMA - Symmetric Weighted Moving Average |||| swma |
| ⛔ T3 - Tillson T3 Moving Average || T3 | GetT3 || | ⛔ T3 - Tillson T3 Moving Average || T3 | GetT3 | t3 |
| ⭐ TEMA - Triple EMA Average | `TEMA_Series` | TEMA | GetTema | tema | | ⭐ TEMA - Triple EMA Average | `TEMA_Series` | TEMA | GetTema | tema |
| ⭐ TRIMA - Triangular Moving Average | `TRIMA_Series` | TRIMA ||| | ⭐ TRIMA - Triangular Moving Average | `TRIMA_Series` | TRIMA || trima |
| ⛔ TSF - Time Series Forecast || TSF ||| | ⛔ TSF - Time Series Forecast || TSF |||
| ⛔ VIDYA - Variable Index Dynamic Average ||||| | ⛔ VIDYA - Variable Index Dynamic Average |||| vidya |
| ⛔ VOR - Vortex Indicator ||||| | ⛔ VORTEX - Vortex Indicator |||| vortex |
| ⭐ WMA - Weighted Moving Average | `WMA_Series` | WMA | GetWma | wma | | ⭐ WMA - Weighted Moving Average | `WMA_Series` | WMA | GetWma | wma |
| ⭐ ZLEMA - Zero Lag EMA Average | `ZLEMA_Series` ||| zlma | | ⭐ ZLEMA - Zero Lag EMA Average | `ZLEMA_Series` ||| zlma |
|||||| ||||||