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
+34 -1
View File
@@ -1,9 +1,35 @@
using System;
namespace QuanTAlib;
/// <summary>
/// FWMA: Fibonacci Weighted Moving Average
/// A moving average that uses Fibonacci numbers as weights in its calculation. The weights
/// are arranged in reverse order so that recent prices receive higher weights corresponding
/// to larger Fibonacci numbers.
/// </summary>
/// <remarks>
/// The FWMA calculation process:
/// 1. Generates a Fibonacci sequence up to the specified period
/// 2. Reverses the sequence to give higher weights to recent prices
/// 3. Normalizes the weights to sum to 1
/// 4. Applies the weights through convolution
///
/// Key characteristics:
/// - Uses Fibonacci sequence for weight distribution
/// - Recent prices receive higher weights
/// - Natural progression of weights based on the golden ratio
/// - Implemented using efficient convolution operations
///
/// Implementation:
/// Original implementation based on Fibonacci sequence principles
/// </remarks>
public class Fwma : AbstractBase
{
private readonly Convolution _convolution;
/// <param name="period">The number of data points used in the FWMA calculation.</param>
/// <exception cref="ArgumentException">Thrown when period is less than 1.</exception>
public Fwma(int period)
{
if (period < 1)
@@ -16,12 +42,19 @@ public class Fwma : AbstractBase
Init();
}
/// <param name="source">The data source object that publishes updates.</param>
/// <param name="period">The number of data points used in the FWMA calculation.</param>
public Fwma(object source, int period) : this(period)
{
var pubEvent = source.GetType().GetEvent("Pub");
pubEvent?.AddEventHandler(source, new ValueSignal(Sub));
}
/// <summary>
/// Generates the Fibonacci-based convolution kernel for the FWMA calculation.
/// </summary>
/// <param name="period">The period for which to generate the kernel.</param>
/// <returns>An array of normalized Fibonacci-based weights for the convolution operation.</returns>
public static double[] GenerateKernel(int period)
{
double[] kernel = new double[period];
@@ -78,4 +111,4 @@ public class Fwma : AbstractBase
return result;
}
}
}