mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-15 00:58:04 +00:00
xml doc rewrite
This commit is contained in:
+33
-4
@@ -1,8 +1,33 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
namespace QuanTAlib;
|
||||
|
||||
// https://efs.kb.esignal.com/hc/en-us/articles/6362791434395-2005-Mar-The-Secret-Behind-The-Filter-MedianAdaptiveFilter-efs
|
||||
|
||||
//TODO Fix initial values
|
||||
/// <summary>
|
||||
/// MAAF: Median Adaptive Average Filter
|
||||
/// A sophisticated moving average that combines median filtering with adaptive smoothing
|
||||
/// to provide robust noise reduction while maintaining signal fidelity. The filter
|
||||
/// automatically adjusts its length based on market conditions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The MAAF calculation process:
|
||||
/// 1. Applies initial smoothing using weighted moving average
|
||||
/// 2. Uses median filtering to remove outliers
|
||||
/// 3. Adaptively adjusts filter length based on price deviation
|
||||
/// 4. Applies final EMA smoothing with adaptive period
|
||||
///
|
||||
/// Key characteristics:
|
||||
/// - Combines median and exponential filtering
|
||||
/// - Adaptive period adjustment
|
||||
/// - Robust noise reduction
|
||||
/// - Preserves significant price movements
|
||||
/// - Reduces impact of outliers
|
||||
///
|
||||
/// Sources:
|
||||
/// John F. Ehlers - "The Secret Behind The Filter"
|
||||
/// https://efs.kb.esignal.com/hc/en-us/articles/6362791434395-2005-Mar-The-Secret-Behind-The-Filter-MedianAdaptiveFilter-efs
|
||||
///
|
||||
/// Note: Initial values handling is currently under development.
|
||||
/// </remarks>
|
||||
|
||||
public class Maaf : AbstractBase
|
||||
{
|
||||
@@ -14,6 +39,8 @@ public class Maaf : AbstractBase
|
||||
|
||||
private readonly int _period;
|
||||
|
||||
/// <param name="period">The initial period for the filter (default 39).</param>
|
||||
/// <param name="threshold">The threshold for adaptive adjustment (default 0.002).</param>
|
||||
public Maaf(int period = 39, double threshold = 0.002)
|
||||
{
|
||||
_period = period;
|
||||
@@ -25,6 +52,9 @@ public class Maaf : AbstractBase
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <param name="source">The data source object that publishes updates.</param>
|
||||
/// <param name="period">The initial period for the filter (default 39).</param>
|
||||
/// <param name="threshold">The threshold for adaptive adjustment (default 0.002).</param>
|
||||
public Maaf(object source, int period = 39, double threshold = 0.002) : this(period, threshold)
|
||||
{
|
||||
var pubEvent = source.GetType().GetEvent("Pub");
|
||||
@@ -70,7 +100,6 @@ public class Maaf : AbstractBase
|
||||
double smooth = (_priceBuffer[^1] + (2 * _priceBuffer[^2]) + (2 * _priceBuffer[^3]) + _priceBuffer[^4]) / 6;
|
||||
_smoothBuffer.Add(smooth, Input.IsNew);
|
||||
|
||||
|
||||
if (_smoothBuffer.Count < _period)
|
||||
{
|
||||
return smooth;
|
||||
|
||||
Reference in New Issue
Block a user