mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-23 21:18:04 +00:00
Update file paths for QuanTAlib packages in main_automation.yml
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user