Common moving averages (MAs) used for volatility forecasting rely on fixed heuristic weights. We propose a Custom Moving Average (CMA) whose weights are learned to forecast the next-day True Range (TR). Using daily OHLC data for 55 futures contracts with a chronological 60/20/20 train/validation/test split, CMA weights are optimized for each look-back period p by projected subgradient descent against Mean Absolute Error (MAE), with validation-based early stopping. We benchmark CMA against nine standard MAs over 62 look-back periods, selecting the period on validation and reporting accuracy on the held-out test set. Learned weights concentrate on an effective horizon of 15–20 observations regardless of p: about 85% of the mass sits in lags 0–14 for both and . EMA is the validation-best method at very short windows; CMA dominates from onwards, winning on 53 of 55 instruments by . Under a single-global-period rule, CMA at attains the lowest test-set geometric-mean MAE, with EMA at the closest competitor (0.87% higher); per-instrument validation selection does not overturn the ranking, with EMA again closest at 0.53%. Higher-order smoothers (T3, TEMA, DEMA) do not improve on CMA under either rule; CMA’s advantage is robust to the choice of selection granularity.
This paper proposes Aya – a Proof-of-Concept C++ library capable of detecting Metamorphic Relations (MR) in an arbitrary function by checking it against user-provided inputs and input transformations. Aya’s capabilities of MR detection are on par with existing Search-Based methods. For example, it is possible to detect implicit metamorphic relations in standard mathematical libraries and basic sequence data structures, such as lists and strings. Moreover, Aya enables MR detection for arbitrary data types since it relies on template metaprogramming. This positions Aya for further experimentation and improvements, as it proposes a more user-friendly approach to metamorphic testing. Aya can detect metamorphic relations at program runtime, capturing the immediate results of each Metamorphic Relation produced, effectively functioning as a stand-alone test. For simple mathematical functions provided by the cmath library, Aya achieved a 100% mutation detection rate. Also, a practical example of JPEG Compression Testing using MR was provided.
Context:Typical software tests use pre-determined test oracles defined by an engineer.This limits the breadth of test coverage because preparing test oracles forcertain test cases can be highly challenging. One solution to the Test Oracleproblem is Metamorphic Testing. Problems arise when the MetamorphicRelations detection algorithm must be generalised to fit any data type.Objective:To propose a strategy to handle custom data types and transformer functionsto generate Metamorphic Relations.Method:In this article, a literature review of 15 peer-reviewed articles was conducted.Then, a new algorithm was proposed for Metamorphic Testing. Later, thealgorithm was validated to prove its applicability.Results:This paper proposes Aya – an exhaustive search algorithm for metamorphicrelation (MR) detection, provided as a proof-of-concept C++ single-headerlibrary. MRs are detected at runtime and immediately verified against aseparate input set, effectively functioning as stand-alone tests. For simplemathematical functions provided by the cmath library, Aya achieved a 100%mutation detection rate using short transform chains (1–2 transformations).Additionally, a practical case study of JPEG compression testing using MR isprovided, demonstrating the applicability of supporting arbitrary data types.Conclusion:The experiments show that Aya can automatically detect metamorphic re-lations for custom data types, though further validation is necessary. Thiswork can be extended by improving the algorithm and porting it to otherlanguages.