mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-15 17:18:05 +00:00
xml doc rewrite
This commit is contained in:
+33
-1
@@ -1,10 +1,35 @@
|
||||
using System;
|
||||
namespace QuanTAlib;
|
||||
|
||||
/// <summary>
|
||||
/// EPMA: Endpoint Moving Average
|
||||
/// A moving average that uses a specialized convolution kernel to emphasize recent price movements
|
||||
/// while maintaining a connection to historical data. The weights decrease linearly with a focus
|
||||
/// on endpoints.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The EPMA uses a unique weighting scheme where:
|
||||
/// - The most recent price gets the highest weight: (2 * period - 1)
|
||||
/// - Each previous price gets a weight reduced by 3: (2 * period - 1) - 3i
|
||||
/// - Weights are normalized to sum to 1
|
||||
///
|
||||
/// Key characteristics:
|
||||
/// - Emphasizes recent price movements more than traditional moving averages
|
||||
/// - Maintains some influence from historical data
|
||||
/// - Uses convolution for efficient calculation
|
||||
/// - Provides better endpoint preservation than simple moving averages
|
||||
///
|
||||
/// Implementation:
|
||||
/// Original implementation based on convolution principles
|
||||
/// </remarks>
|
||||
|
||||
public class Epma : AbstractBase
|
||||
{
|
||||
private readonly int _period;
|
||||
private readonly Convolution _convolution;
|
||||
|
||||
/// <param name="period">The number of data points used in the EPMA calculation.</param>
|
||||
/// <exception cref="ArgumentException">Thrown when period is less than 1.</exception>
|
||||
public Epma(int period)
|
||||
{
|
||||
if (period < 1)
|
||||
@@ -18,6 +43,8 @@ public class Epma : AbstractBase
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <param name="source">The data source object that publishes updates.</param>
|
||||
/// <param name="period">The number of data points used in the EPMA calculation.</param>
|
||||
public Epma(object source, int period) : this(period)
|
||||
{
|
||||
var pubEvent = source.GetType().GetEvent("Pub");
|
||||
@@ -60,6 +87,11 @@ public class Epma : AbstractBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the convolution kernel for the EPMA calculation.
|
||||
/// </summary>
|
||||
/// <param name="period">The period for which to generate the kernel.</param>
|
||||
/// <returns>An array of normalized weights for the convolution operation.</returns>
|
||||
public static double[] GenerateKernel(int period)
|
||||
{
|
||||
double[] kernel = new double[period];
|
||||
@@ -79,4 +111,4 @@ public class Epma : AbstractBase
|
||||
|
||||
return kernel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user