mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 01:28:05 +00:00
xml doc rewrite
This commit is contained in:
+29
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user