All indicators

STD-Stepped Fast Cosine Transform Moving Average

Aug 11, 2022

Static chart image
SignalsCycleMoving AveragesVolatility

The STD-Stepped Fast Cosine Transform Moving Average indicator provides a specialized moving average that utilizes the Discrete Cosine Transform (DCT) and standard deviation stepping to filter market noise and highlight core trends. It applies frequency-domain processing to price data, weeding out low-volatility movements to produce a smoother, trend-responsive output.

Usage

The Usage section describes how the script can be used to identify trend direction and momentum shifts while minimizing noise.

  • Trend Identification: Users can use the color-coded line and bar coloring to determine market bias. A green output typically indicates an uptrend, while a red output indicates a downtrend.
  • Volatility Filtering: By adjusting the "Filter Deviations" and "Filter Period," the script can ignore minor price fluctuations. When the price or the MA does not move beyond a specific standard deviation threshold, the value remains "stepped" (flat), helping traders avoid entering during choppy, sideways markets.
  • Frequency Control: The "Smoothing Period" setting allows for manual frequency pruning. Unlike traditional moving averages where higher numbers mean more smoothing, in this tool, lower values for the smoothing period result in a smoother, more filtered output by zeroing out higher frequencies.

Details

This script implements a Type-II Discrete Cosine Transform (DCT) to process price data. A DCT expresses a finite sequence of data points as a sum of cosine functions oscillating at different frequencies. In signal processing, this is often used for compression because it concentrates the signal energy into a few coefficients.

The "Fast" component refers to the use of a computational algorithm similar to the Fast Fourier Transform (FFT). To maintain high performance, the window length is restricted to powers of 2 (e.g., 16, 32, 64, etc.). After the initial FCT pass, the script applies a smoothing mechanism that discards high-frequency components based on the user-defined cutoff, effectively removing "jitter" from the price action.

Settings

  • Heikin-Ashi Better Calculation Type: Determines the smoothing method (AMA, T3, or Kaufman) used for "HAB" source types.
  • Source: Selection of the price data to be processed, including expanded options like Heikin-Ashi, Trend Biased, and Average Median Body prices.
  • Window: The calculation period for the FCT, restricted to powers of 2 (16 to 2048) for computational efficiency.
  • Smoothing Period: Controls frequency pruning; lower values produce a smoother line by discarding more high-frequency data.
  • Filter Options: Choose whether to apply standard deviation stepping to the Price, the FCT MA, or both.
  • Filter Deviations: Sets the standard deviation multiplier for the volatility filter; higher values lead to more "steps" and less sensitivity to small moves.
  • Filter Period: The lookback period used for the standard deviation calculation within the volatility filter.
  • Color bars?: Toggles price bar coloring based on the indicator's trend direction.
  • Show signals?: Enables or disables on-chart visual signals for trend changes.
  • Moving Average Inputs: Specific parameters (Fast/Slow ends) for Kaufman’s KAMA or Adaptive Moving Averages used in the source calculation.

FAQ

What is the benefit of using Fast Cosine Transform over a regular SMA? The FCT allows for more precise frequency filtering, enabling the indicator to respond to significant trend changes while ignoring high-frequency noise that often causes false signals in simple moving averages.

Why are the window sizes limited to powers of 2? The script uses a fast algorithm (similar to the Cooley-Tukey FFT) that requires an input matrix of power-of-2 size to maintain optimal calculation speed and performance on charting platforms.

How do I access this indicator? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.