mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 01:58:06 +00:00
feat: Add new CodeQL extension for C# and SonarLint configuration
- Introduced a new CodeQL extension for C# in `.github/codeql/extensions/quantalib-csharp/codeql-pack.yml`. - Added SonarLint configuration in `.sonarlint/CSharp/SonarLint.xml` and `.sonarlint/csharp.ruleset` to suppress specific rules for high-performance indicators. - Removed outdated `.vscode/launch.json` configurations. - Updated `.vscode/tasks.json` to streamline build and test tasks, including renaming and consolidating tasks. - Modified `Directory.Build.props` to enhance SARIF output directory handling and integrate SonarLint rules. - Refactored various indicator classes to improve code clarity and maintainability, including updates to method parameters for consistency. - Added XML documentation comments to several classes and methods for better code understanding. - Improved numerical stability in calculations by replacing direct comparisons with `double.Epsilon` checks in multiple classes.
This commit is contained in:
@@ -289,7 +289,7 @@ public sealed class Maenv : ITValuePublisher
|
||||
private double CalculateEMA(double value, bool isNew)
|
||||
{
|
||||
// Use EmaWeight==0 to detect first value for correct isNew=false behavior
|
||||
if (_state.EmaWeight == 0)
|
||||
if (Math.Abs(_state.EmaWeight) < double.Epsilon)
|
||||
{
|
||||
// First value - persist only for isNew=true
|
||||
if (isNew)
|
||||
|
||||
@@ -75,6 +75,9 @@ public sealed class Sdchannel : ITValuePublisher
|
||||
|
||||
public event TValuePublishedHandler? Pub;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new Standard Deviation Channel indicator with specified period and multiplier.
|
||||
/// </summary>
|
||||
/// <param name="period">Lookback period for regression (default 20, must be > 1)</param>
|
||||
/// <param name="multiplier">Standard deviation multiplier for bands (default 2.0, must be > 0)</param>
|
||||
public Sdchannel(int period = 20, double multiplier = 2.0)
|
||||
|
||||
Reference in New Issue
Block a user