mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-13 16:18:05 +00:00
[CodeFactor] Apply fixes to commit 9697fac
This commit is contained in:
@@ -293,7 +293,6 @@ public sealed class Alligator : ITValuePublisher
|
||||
return new TSeries(tList, vList);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the indicator state using the provided bar series history.
|
||||
/// </summary>
|
||||
@@ -337,7 +336,6 @@ public sealed class Alligator : ITValuePublisher
|
||||
return (results, indicator);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Jaw period value.
|
||||
/// </summary>
|
||||
|
||||
@@ -642,5 +642,4 @@ public sealed class Amat : ITValuePublisher, IDisposable
|
||||
TSeries results = amat.Update(source);
|
||||
return (results, amat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -240,7 +240,6 @@ public sealed class Chop : ITValuePublisher
|
||||
return Math.Clamp(chop, 0.0, 100.0);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the indicator state using the provided bar series history.
|
||||
/// </summary>
|
||||
@@ -282,5 +281,4 @@ public sealed class Chop : ITValuePublisher
|
||||
TSeries results = indicator.Update(source);
|
||||
return (results, indicator);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public sealed class HtTrendmodeIndicator : Indicator, IWatchlistIndicator
|
||||
SourceType.HL2 => (GetPrice(PriceType.High) + GetPrice(PriceType.Low)) / 2,
|
||||
SourceType.HLC3 => (GetPrice(PriceType.High) + GetPrice(PriceType.Low) + GetPrice(PriceType.Close)) / 3,
|
||||
SourceType.OHLC4 => (GetPrice(PriceType.Open) + GetPrice(PriceType.High) + GetPrice(PriceType.Low) + GetPrice(PriceType.Close)) / 4,
|
||||
SourceType.HLCC4 => (GetPrice(PriceType.High) + GetPrice(PriceType.Low) + 2 * GetPrice(PriceType.Close)) / 4,
|
||||
SourceType.HLCC4 => (GetPrice(PriceType.High) + GetPrice(PriceType.Low) + (2 * GetPrice(PriceType.Close))) / 4,
|
||||
_ => GetPrice(PriceType.Close)
|
||||
};
|
||||
|
||||
|
||||
@@ -186,8 +186,8 @@ public sealed class HtTrendmode : AbstractBase
|
||||
double input1 = buffer[KEY_Q1];
|
||||
DoHilbertTransform(buffer, KEY_JQ, input1, true, hilbertIdx, adjustedPrevPeriod);
|
||||
|
||||
q2 = 0.2 * (buffer[KEY_Q1] + buffer[KEY_JI]) + 0.8 * prevQ2;
|
||||
i2 = 0.2 * (i1ForOddPrev3 - buffer[KEY_JQ]) + 0.8 * prevI2;
|
||||
q2 = (0.2 * (buffer[KEY_Q1] + buffer[KEY_JI])) + (0.8 * prevQ2);
|
||||
i2 = (0.2 * (i1ForOddPrev3 - buffer[KEY_JQ])) + (0.8 * prevI2);
|
||||
|
||||
i1ForEvenPrev3 = i1ForEvenPrev2;
|
||||
i1ForEvenPrev2 = buffer[KEY_DETRENDER];
|
||||
@@ -211,8 +211,8 @@ public sealed class HtTrendmode : AbstractBase
|
||||
hilbertIdx = 0;
|
||||
}
|
||||
|
||||
q2 = 0.2 * (buffer[KEY_Q1] + buffer[KEY_JI]) + 0.8 * prevQ2;
|
||||
i2 = 0.2 * (i1ForEvenPrev3 - buffer[KEY_JQ]) + 0.8 * prevI2;
|
||||
q2 = (0.2 * (buffer[KEY_Q1] + buffer[KEY_JI])) + (0.8 * prevQ2);
|
||||
i2 = (0.2 * (i1ForEvenPrev3 - buffer[KEY_JQ])) + (0.8 * prevI2);
|
||||
|
||||
i1ForOddPrev3 = i1ForOddPrev2;
|
||||
i1ForOddPrev2 = buffer[KEY_DETRENDER];
|
||||
@@ -304,7 +304,7 @@ public sealed class HtTrendmode : AbstractBase
|
||||
}
|
||||
|
||||
// Calculate smoothed price using WMA
|
||||
double adjustedPrevPeriod = 0.075 * s.Period + 0.54;
|
||||
double adjustedPrevPeriod = (0.075 * s.Period) + 0.54;
|
||||
|
||||
s.PeriodWMASub += price;
|
||||
s.PeriodWMASub -= s.TrailingWMAValue;
|
||||
@@ -488,7 +488,7 @@ public sealed class HtTrendmode : AbstractBase
|
||||
double smaValue = (dcPeriodInt > 0) ? sumPrice / (double)dcPeriodInt : price;
|
||||
|
||||
// WMA smoothing of SMA: (4*current + 3*prev1 + 2*prev2 + prev3) / 10
|
||||
double trendline = (4.0 * smaValue + 3.0 * s.ITrend1 + 2.0 * s.ITrend2 + s.ITrend3) / 10.0;
|
||||
double trendline = ((4.0 * smaValue) + (3.0 * s.ITrend1) + (2.0 * s.ITrend2) + s.ITrend3) / 10.0;
|
||||
s.ITrend3 = s.ITrend2;
|
||||
s.ITrend2 = s.ITrend1;
|
||||
s.ITrend1 = smaValue;
|
||||
|
||||
@@ -234,7 +234,7 @@ public sealed class Pfe : AbstractBase
|
||||
_s = default;
|
||||
_ps = default;
|
||||
|
||||
int warmupLength = Math.Min(source.Length, WarmupPeriod + _smoothPeriod * 3);
|
||||
int warmupLength = Math.Min(source.Length, WarmupPeriod + (_smoothPeriod * 3));
|
||||
int startIndex = source.Length - warmupLength;
|
||||
|
||||
// Seed LastValidValue
|
||||
|
||||
@@ -265,7 +265,6 @@ public sealed class Super : ITValuePublisher
|
||||
return new TSeries(t, v);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the indicator state using the provided bar series history.
|
||||
/// </summary>
|
||||
|
||||
@@ -392,7 +392,6 @@ public sealed class Vhf : AbstractBase
|
||||
prevClose = val;
|
||||
hasPrevClose = true;
|
||||
|
||||
|
||||
// Calculate VHF
|
||||
if (closeFilled >= closeBufSize && diffFilled >= period)
|
||||
{
|
||||
|
||||
@@ -339,5 +339,4 @@ public sealed class Vortex : ITValuePublisher
|
||||
TSeries results = indicator.Update(source);
|
||||
return (results, indicator);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user