mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-20 19:48:05 +00:00
Merge branch 'dev'
This commit is contained in:
+16
-4
@@ -8,7 +8,11 @@ namespace QuanTAlib;
|
||||
/// of the true range. The true range is the greatest of: current high - current low,
|
||||
/// absolute value of current high - previous close, or absolute value of current low - previous close.
|
||||
/// </remarks>
|
||||
<<<<<<< HEAD
|
||||
public class Atr : AbstractBarBase
|
||||
=======
|
||||
public class Atr : AbstractBase
|
||||
>>>>>>> dev
|
||||
{
|
||||
private readonly Ema _ma;
|
||||
private double _prevClose, _p_prevClose;
|
||||
@@ -82,23 +86,31 @@ public class Atr : AbstractBarBase
|
||||
/// </remarks>
|
||||
protected override double Calculation()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
ManageState(Input.IsNew);
|
||||
=======
|
||||
ManageState(BarInput.IsNew);
|
||||
>>>>>>> dev
|
||||
|
||||
double trueRange = Math.Max(
|
||||
Math.Max(
|
||||
Input.High - Input.Low,
|
||||
Math.Abs(Input.High - _prevClose)
|
||||
BarInput.High - BarInput.Low,
|
||||
Math.Abs(BarInput.High - _prevClose)
|
||||
),
|
||||
Math.Abs(Input.Low - _prevClose)
|
||||
Math.Abs(BarInput.Low - _prevClose)
|
||||
);
|
||||
if (_index < 2)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
trueRange = Input.High - Input.Low;
|
||||
=======
|
||||
trueRange = BarInput.High - BarInput.Low;
|
||||
>>>>>>> dev
|
||||
}
|
||||
|
||||
TValue emaTrueRange = _ma.Calc(new TValue(Input.Time, trueRange, Input.IsNew));
|
||||
IsHot = _ma.IsHot;
|
||||
_prevClose = Input.Close;
|
||||
_prevClose = BarInput.Close;
|
||||
|
||||
return emaTrueRange.Value;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,11 @@ public class Historical : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 2.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Historical(int period, bool isAnnualized = true) : base()
|
||||
=======
|
||||
public Historical(int period, bool isAnnualized = true)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 2)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,11 @@ public class Realized : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 2.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Realized(int period, bool isAnnualized = true) : base()
|
||||
=======
|
||||
public Realized(int period, bool isAnnualized = true)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 2)
|
||||
{
|
||||
|
||||
+10
-2
@@ -16,8 +16,8 @@ namespace QuanTAlib;
|
||||
public class Rvi : AbstractBase
|
||||
{
|
||||
private readonly int Period;
|
||||
private Stddev _upStdDev, _downStdDev;
|
||||
private Sma _upSma, _downSma;
|
||||
private readonly Stddev _upStdDev, _downStdDev;
|
||||
private readonly Sma _upSma, _downSma;
|
||||
private double _previousClose;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,7 +27,11 @@ public class Rvi : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 2.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Rvi(int period) : base()
|
||||
=======
|
||||
public Rvi(int period)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 2)
|
||||
{
|
||||
@@ -105,6 +109,7 @@ public class Rvi : AbstractBase
|
||||
_downSma.Calc(_downStdDev.Calc(new TValue(Input.Time, downMove, Input.IsNew)));
|
||||
|
||||
double rvi;
|
||||
<<<<<<< HEAD
|
||||
if (_upSma.Value + _downSma.Value != 0)
|
||||
{
|
||||
rvi = 100 * _upSma.Value / (_upSma.Value + _downSma.Value);
|
||||
@@ -113,6 +118,9 @@ public class Rvi : AbstractBase
|
||||
{
|
||||
rvi = 0;
|
||||
}
|
||||
=======
|
||||
rvi = (_upSma.Value + _downSma.Value != 0) ? 100 * _upSma.Value / (_upSma.Value + _downSma.Value) : 0;
|
||||
>>>>>>> dev
|
||||
|
||||
_previousClose = close;
|
||||
IsHot = _index >= WarmupPeriod;
|
||||
|
||||
Reference in New Issue
Block a user