Update file paths for QuanTAlib packages in main_automation.yml

This commit is contained in:
Miha Kralj
2023-04-12 13:10:00 -07:00
parent badea98dc0
commit b99d451ea8
22 changed files with 403 additions and 253 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
namespace QuanTAlib;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
/* <summary>
@@ -18,9 +19,9 @@ public class TSeries : List<(DateTime t, double v)> {
public static implicit operator (DateTime t, double v)(TSeries l) => l[^1];
public static implicit operator double(TSeries l) => l[^1].v;
public static implicit operator DateTime(TSeries l) => l[^1].t;
public List<DateTime> t => this.Select(item => item.t).ToList();
public List<double> v => this.Select(item => item.v).ToList();
public int Length => this.Count;
public ReadOnlyCollection<DateTime> t => this.Select(item => item.t).ToList().AsReadOnly();
public ReadOnlyCollection<double> v => this.Select(item => item.v).ToList().AsReadOnly();
public int Length => Count;
public TSeries Tail(int count = 10) {
var tailSeries = new TSeries();
+2 -1
View File
@@ -34,6 +34,7 @@
<AssemblyVersion>0.2.1.0</AssemblyVersion>
<FileVersion>0.2.1.0</FileVersion>
<InformationalVersion>0.2.1-dev.2+Branch.dev.Sha.cb5fe2dc86a78fe9358da810d17952c82299ed3d</InformationalVersion>
<SuppressNETSdkWarningProperty>NETSDK1057</SuppressNETSdkWarningProperty>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
@@ -60,7 +61,7 @@
<AdditionalFiles Include="..\.sonarlint\mihakralj_quantalib\CSharp\SonarLint.xml" Link="SonarLint.xml" />
</ItemGroup>
<ItemGroup>
<None Include="..\Docs\readme.md">
<None Include="..\docs\readme.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
+1 -1
View File
@@ -15,7 +15,7 @@ DECAY:
</summary> */
public class DECAY_Series : Single_TSeries_Indicator {
private bool _exp;
private readonly bool _exp;
private double _pdecay, _ppdecay;
private readonly double _dfactor;
+10 -8
View File
@@ -21,12 +21,14 @@ Sources:
public class LINREG_Series : Single_TSeries_Indicator
{
public readonly TSeries Intercept = new();
public readonly TSeries RSquared = new();
public readonly TSeries StdDev = new();
private readonly TSeries p_Intercept = new();
private readonly TSeries p_RSquared = new();
private readonly TSeries p_StdDev = new();
private readonly System.Collections.Generic.List<double> _buffer = new();
public LINREG_Series(TSeries source, int period, bool useNaN = false)
public TSeries Intercept => p_Intercept;
public TSeries RSquared => p_RSquared;
public TSeries StdDev => p_StdDev;
public LINREG_Series(TSeries source, int period, bool useNaN = false)
: base(source, period, useNaN)
{
if (this._data.Count > 0) { base.Add(this._data); }
@@ -80,12 +82,12 @@ public class LINREG_Series : Single_TSeries_Indicator
base.Add(ret, update, _NaN);
ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _intercept);
Intercept.Add(ret, update);
p_Intercept.Add(ret, update);
ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _StdDev);
StdDev.Add(ret, update);
p_StdDev.Add(ret, update);
ret = (TValue.t, this.Count < this._p - 1 && this._NaN ? double.NaN : _RSquared);
RSquared.Add(ret, update);
p_RSquared.Add(ret, update);
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ Sources:
https://phemex.com/academy/what-is-arnaud-legoux-moving-averages
https://www.prorealcode.com/prorealtime-indicators/alma-arnaud-legoux-moving-average/
TODO: Discrepancy with Pandas-TA (but passes the validation with Skender.GetAlma)
Discrepancy with Pandas-TA (but passes the validation with Skender.GetAlma)
</summary> */
+3 -3
View File
@@ -41,7 +41,7 @@ public class DEMA_Series : Single_TSeries_Indicator
_lastsum = _lastlastsum;
_lastema1 = _lastlastema1;
_lastema2 = _lastlastema2;
}
}
else {
_lastlastsum = _lastsum;
_lastlastema1 = _lastema1;
@@ -67,8 +67,8 @@ public class DEMA_Series : Single_TSeries_Indicator
}
_dema = 2*_ema1 - _ema2;
_lastema1 = _ema1;
_lastema2 = _ema2;
_lastema1 = Double.IsNaN(_ema1)?_lastema1:_ema1;
_lastema2 = Double.IsNaN(_ema2)?_lastema2:_ema2;
base.Add((TValue.t, _dema), update, _NaN);
}
+5 -7
View File
@@ -9,24 +9,22 @@ DWMA: Double Weighted Moving Average
</summary> */
public class DWMA_Series : Single_TSeries_Indicator {
private readonly System.Collections.Generic.List<double> _buffer1 = new();
private readonly System.Collections.Generic.List<double> _weights = new();
public DWMA_Series(TSeries source, int period, bool useNaN = false) : base(source, period, useNaN) {
for (int i = 0; i < this._p; i++) {
double _weight = (i + 1) * (i + 1);
this._weights.Add(_weight);
}
if (base._data.Count > 0) { base.Add(base._data); }
}
private readonly System.Collections.Generic.List<double> _buffer1 = new();
private readonly System.Collections.Generic.List<double> _weights = new();
public override void Add((System.DateTime t, double v) TValue, bool update) {
Add_Replace_Trim(_buffer1, TValue.v, _p, update);
double _wma1 = 0;
double _wsum = 0;
double _wma1 = 0, _wsum = 0;
for (int i = 0; i < _buffer1.Count; i++) {
_wma1 += _buffer1[i] * this._weights[i];
_wsum += this._weights[i];
_wma1 += _buffer1[i] * _weights[i];
_wsum += _weights[i];
}
_wma1 /= _wsum;
+1 -1
View File
@@ -60,7 +60,7 @@ public class EMA_Series : Single_TSeries_Indicator {
else {
_ema = _k * (TValue.v - _lastema) + _lastema;
}
_lastema = _ema;
_lastema = Double.IsNaN(_ema)?_lastema:_ema;
base.Add((TValue.t, _ema), update, _NaN);
}
+4 -2
View File
@@ -27,13 +27,14 @@ public class JMA_Series : Single_TSeries_Indicator {
public TSeries mma1 { get; }
public TSeries mma2 { get; }
private double upperBand, lowerBand, vsum, Kv, del1, del2;
private double upperBand, lowerBand, vsum, Kv;
private double prev_ma1, prev_det0, prev_det1, prev_vsum, prev_jma;
private double p_upperBand, p_lowerBand, p_Kv, p_prev_ma1, p_prev_det0, p_prev_det1, p_prev_vsum, p_prev_jma;
private readonly int _voltyS, _voltyL;
public JMA_Series(TSeries source, int period, double phase = 0.0, int vshort = 10, int vlong = 65, bool useNaN = false) : base(source, period, useNaN) {
upperBand = lowerBand = prev_ma1 = prev_det0 = prev_det1 = prev_vsum = prev_jma = Kv = del1 = del2 = 0.0;
upperBand = lowerBand = prev_ma1 = prev_det0 = prev_det1 = prev_vsum = prev_jma = Kv = 0.0;
Kv = 0;
pr = (phase * 0.01) + 1.5;
@@ -48,6 +49,7 @@ public class JMA_Series : Single_TSeries_Indicator {
}
public override void Add((System.DateTime t, double v) TValue, bool update) {
double del1 = 0.0, del2 = 0.0;
if (this.Count == 0) { prev_ma1 = prev_jma = TValue.v; }
if (update) {
upperBand = p_upperBand;
+1 -1
View File
@@ -33,7 +33,7 @@ public class MAMA_Series : Single_TSeries_Indicator
public override void Add((System.DateTime t, double v) TValue, bool update)
{
if (!update) {
// roll forward (oldx = x)
pr.io = pr.i6; pr.i6 = pr.i5; pr.i5 = pr.i4; pr.i4 = pr.i3; pr.i3 = pr.i2; pr.i2 = pr.i1; pr.i1 = pr.i;
+1 -11
View File
@@ -13,16 +13,6 @@ Sources:
https://technicalindicators.net/indicators-technical-analysis/150-t3-moving-average
http://www.binarytribune.com/forex-trading-indicators/t3-moving-average-indicator/
Calculation:
Volume Factor is typically 0.7 (but also 0.618);
Ema1 = Ema (Close);
Ema2 = Ema (Ema1);
Ema3 = Ema (Ema2);
Ema4 = Ema (Ema3);
Ema5 = Ema (Ema4);
Ema6 = Ema (Ema5);
T3 = (a*a*a) * Ema6 + (3*a*a + 3*a*a*a) * Ema5 + (6*a*a 3*a 3*a*a*a) * Ema4 + (1 + 3*a + a*a*a + 3*a*a) * Ema3
</summary> */
public class T3_Series : Single_TSeries_Indicator {
private readonly double _k, _k1m, _c1, _c2, _c3, _c4;
@@ -35,7 +25,7 @@ public class T3_Series : Single_TSeries_Indicator {
private double _lastema1, _lastema2, _lastema3, _lastema4, _lastema5, _lastema6;
private double _llastema1, _llastema2, _llastema3, _llastema4, _llastema5, _llastema6;
private bool _useSMA;
private readonly bool _useSMA;
public T3_Series(TSeries source, int period, double vfactor = 0.7, bool useNaN = false, bool useSMA = true) : base(source, period, useNaN) {
double _a = vfactor; //0.7; //0.618
+1 -8
View File
@@ -9,13 +9,6 @@ TRIX: Triple Exponential Average
has become a popular technical analysis tool to aid chartists in spotting diversions
and directional cues in stock trading patterns.
Calculation:
Ema1 = Ema (Close);
Ema2 = Ema (Ema1);
Ema3 = Ema (Ema2);
TRIX = (Ema3-Ema3[1]) / Ema3[1]
Sources:
https://www.investopedia.com/terms/t/trix.asp
@@ -29,7 +22,7 @@ public class TRIX_Series : Single_TSeries_Indicator
private double _lastema1, _lastema2, _lastema3;
private double _llastema1, _llastema2, _llastema3;
private bool _useSMA;
private readonly bool _useSMA;
public TRIX_Series(TSeries source, int period, bool useNaN = false, bool useSMA = true) : base(source, period, useNaN)
{
+1 -33
View File
@@ -6,7 +6,7 @@ ADO: Chaikin Accumulation/Distribution Oscillator
ADO measures the momentum of ADL using the difference between slow (10-day) EMA(ADL)
and fast (3-day) EMA(ADL):
Chaikin A/D Oscillator = (3-day EMA of ADL) - (10-day EMA of ADL)
Chaikin A/D Oscillator is defined as 3-day EMA of ADL minus 10-day EMA of ADL
Sources:
https://school.stockcharts.com/doku.php?id=technical_indicators:chaikin_oscillator
@@ -53,35 +53,3 @@ public class ADOSC_Series : Single_TBars_Indicator
}
}
/*
public class ADOSC_Series : Single_TBars_Indicator
{
private readonly ADL_Series _TSadl;
private readonly EMA_Series _TSslow;
private readonly EMA_Series _TSfast;
private readonly SUB_Series _TSado;
public ADOSC_Series(TBars source, bool useNaN = false) : base(source, period: 0, useNaN)
{
_TSadl = new(source: source, useNaN: false);
_TSslow = new(source: _TSadl, period: 10, useNaN: false);
_TSfast = new(source: _TSadl, period: 3, useNaN: false);
_TSado = new(_TSfast, _TSslow);
if (source.Count > 0)
{ base.Add(_TSado); }
Console.WriteLine(base.Count);
}
public override void Add((DateTime t, double o, double h, double l, double c, double v) TBar, bool update)
{
if (update)
{ _TSadl.Add(TBar, true); }
double _ado = this._TSado[(this.Count < this._TSado.Count) ? this.Count : this._TSado.Count - 1].v;
var result = (TBar.t, _ado);
base.Add(result, update);
}
}
*/