xml doc rewrite

This commit is contained in:
Miha
2024-10-27 09:38:53 -07:00
parent c21b96152c
commit b2fcdda785
71 changed files with 2607 additions and 1102 deletions
+29 -3
View File
@@ -1,13 +1,38 @@
using System;
namespace QuanTAlib;
/// <summary>
/// SMMA: Smoothed Moving Average
/// A modified moving average that gives more weight to recent prices while maintaining
/// a smooth output. It uses the previous SMMA value in its calculation, creating
/// a smoother line than traditional moving averages.
/// </summary>
/// <remarks>
/// The SMMA calculation process:
/// 1. Uses SMA for initial value (first period points)
/// 2. For subsequent points, calculates: (prevSMMA * (period-1) + price) / period
/// 3. This creates a smoothed effect with reduced volatility
///
/// Key characteristics:
/// - Smoother than traditional moving averages
/// - Reduced volatility in output
/// - Takes into account all previous prices
/// - Good for identifying overall trends
/// - Less lag than SMA but more than EMA
///
/// Implementation:
/// Based on smoothed moving average principles with
/// initial SMA seeding for stability
/// </remarks>
public class Smma : AbstractBase
{
private readonly int _period;
private CircularBuffer? _buffer;
private double _lastSmma, _p_lastSmma;
/// <param name="period">The number of data points used in the SMMA calculation.</param>
/// <exception cref="ArgumentException">Thrown when period is less than 1.</exception>
public Smma(int period)
{
if (period < 1)
@@ -20,6 +45,8 @@ public class Smma : AbstractBase
Init();
}
/// <param name="source">The data source object that publishes updates.</param>
/// <param name="period">The number of data points used in the SMMA calculation.</param>
public Smma(object source, int period) : this(period)
{
var pubEvent = source.GetType().GetEvent("Pub");
@@ -47,7 +74,6 @@ public class Smma : AbstractBase
}
}
protected override double Calculation()
{
ManageState(Input.IsNew);
@@ -75,4 +101,4 @@ public class Smma : AbstractBase
return smma;
}
}
}