From f582b75fe0524e441a551d7eed0322505353848c Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Mon, 4 Nov 2024 02:16:52 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit 5d086a1 --- lib/oscillators/Uo.cs | 2 +- lib/volatility/Rsv.cs | 2 +- lib/volatility/Sv.cs | 2 +- lib/volatility/Yzv.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/oscillators/Uo.cs b/lib/oscillators/Uo.cs index 547d83d2..ec247ebd 100644 --- a/lib/oscillators/Uo.cs +++ b/lib/oscillators/Uo.cs @@ -174,6 +174,6 @@ public sealed class Uo : AbstractBase // Calculate weighted sum double weightSum = _weight1 + _weight2 + _weight3; - return ScalingFactor * ((_weight1 * avg1 + _weight2 * avg2 + _weight3 * avg3) / weightSum); + return ScalingFactor * (((_weight1 * avg1) + (_weight2 * avg2) + (_weight3 * avg3)) / weightSum); } } diff --git a/lib/volatility/Rsv.cs b/lib/volatility/Rsv.cs index 5f12700b..af0a1b2b 100644 --- a/lib/volatility/Rsv.cs +++ b/lib/volatility/Rsv.cs @@ -84,7 +84,7 @@ public sealed class Rsv : AbstractBase double lnLO = Math.Log(BarInput.Low / BarInput.Open); // Calculate Rogers-Satchell term - double rs = lnHC * lnHO + lnLC * lnLO; + double rs = (lnHC * lnHO) + (lnLC * lnLO); // Apply moving average and take square root _prevValue = Math.Sqrt(_ma.Calc(rs, true)); diff --git a/lib/volatility/Sv.cs b/lib/volatility/Sv.cs index de0e95fc..28ddd7df 100644 --- a/lib/volatility/Sv.cs +++ b/lib/volatility/Sv.cs @@ -96,7 +96,7 @@ public sealed class Sv : AbstractBase double squaredReturn = logReturn * logReturn; // Update variance estimate - _prevVariance = _lambda * _prevVariance + (1.0 - _lambda) * squaredReturn; + _prevVariance = (_lambda * _prevVariance) + ((1.0 - _lambda) * squaredReturn); // Apply smoothing and take square root _prevValue = Math.Sqrt(_ma.Calc(_prevVariance, true)); diff --git a/lib/volatility/Yzv.cs b/lib/volatility/Yzv.cs index 6341ee52..4331f982 100644 --- a/lib/volatility/Yzv.cs +++ b/lib/volatility/Yzv.cs @@ -103,11 +103,11 @@ public sealed class Yzv : AbstractBase double lnHO = Math.Log(BarInput.High / BarInput.Open); double lnLC = Math.Log(BarInput.Low / BarInput.Close); double lnLO = Math.Log(BarInput.Low / BarInput.Open); - double rs = lnHC * lnHO + lnLC * lnLO; + double rs = (lnHC * lnHO) + (lnLC * lnLO); double vrs = _maRs.Calc(rs, true); // Combine components with optimal weights - _prevValue = Math.Sqrt(vo + K * vc + (1.0 - K) * vrs); + _prevValue = Math.Sqrt(vo + (K * vc) + ((1.0 - K) * vrs)); return _prevValue; } }