mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-19 11:08:05 +00:00
ABOVE_Series
This commit is contained in:
@@ -10,7 +10,8 @@ Remarks:
|
||||
</summary> */
|
||||
|
||||
public class OVER_Series : Pair_TSeries_Indicator {
|
||||
public TSeries Cross = new();
|
||||
public TSeries Cross { get; set; } = new();
|
||||
|
||||
private double _previous = double.NaN;
|
||||
public OVER_Series(TSeries d1, TSeries d2) : base(d1, d2) {
|
||||
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); } }
|
||||
@@ -23,13 +24,18 @@ public class OVER_Series : Pair_TSeries_Indicator {
|
||||
}
|
||||
|
||||
public override void Add((System.DateTime t, double v) TValue1, (System.DateTime t, double v) TValue2, bool update) {
|
||||
(System.DateTime t, double v) over = ((TValue1.t > TValue2.t) ? TValue1.t : TValue2.t, TValue1.v > TValue2.v ? 1 : TValue1.v < TValue2.v ? -1 : 0);
|
||||
|
||||
double val = TValue1.v > TValue2.v ? 1 : -1;
|
||||
val = TValue1.v == TValue2.v ? 0 : val;
|
||||
(System.DateTime t, double v) over = ((TValue1.t > TValue2.t) ? TValue1.t : TValue2.t, TValue1.v > TValue2.v ? 1 : val);
|
||||
if (update) { this.Cross[^1] = over; }
|
||||
else { this.Cross.Add(over); }
|
||||
|
||||
val = (this._previous < over.v) ? 1 : -1;
|
||||
(System.DateTime t, double v) result = ((TValue1.t > TValue2.t) ? TValue1.t : TValue2.t,
|
||||
((_previous == over.v) || (_previous != 0) || Double.IsNaN(_previous)) ? 0 : (_previous < over.v) ? 1 : -1);
|
||||
_previous = over.v;
|
||||
((this._previous == over.v) || Double.IsNaN(this._previous) || (this._previous == 0)) ? 0 : val);
|
||||
|
||||
this._previous = over.v;
|
||||
|
||||
if (update) { base[^1] = result; }
|
||||
else { base.Add(result); }
|
||||
@@ -37,3 +43,4 @@ public class OVER_Series : Pair_TSeries_Indicator {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Title>QuanTAlib</Title>
|
||||
<Version>0.1.30</Version>
|
||||
<Version>0.1.31</Version>
|
||||
<Product>Library of TA Calculations, Charts and Strategies for Quantower</Product>
|
||||
<Description>Quantitative Technical Analysis Library in C# for Quantower</Description>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
|
||||
@@ -10,7 +10,7 @@ Alphavantage - Free API to collect 100 recent daily quotes. It requires a (free)
|
||||
APIkey: unique Alphavantage API key
|
||||
|
||||
</summary>
|
||||
|
||||
*/
|
||||
public class Alphavantage_Feed : TBars
|
||||
{
|
||||
public enum Interval { Month, Week, Day, Hour, Min30, Min15, Min5, Min1}
|
||||
@@ -52,5 +52,4 @@ public class Alphavantage_Feed : TBars
|
||||
}
|
||||
return (date, o, h, l, c, v);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -11,7 +11,7 @@ Yahoo Finance - Free API feed to collect daily market quotes
|
||||
Yahoo_Feed ticker = new("MSFT", 20)
|
||||
|
||||
</summary>
|
||||
|
||||
*/
|
||||
public class Yahoo_Feed : TBars
|
||||
{
|
||||
public Yahoo_Feed(string Symbol = "IBM", int Period = 252) {
|
||||
@@ -46,4 +46,3 @@ public class Yahoo_Feed : TBars
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user