PROTECTED SOURCE SCRIPT
已更新 Fourier Weighted Moving Average-(FWMA)

Fourier Weighted Moving Average (FWMA)
About Fourier and His Theory
Joseph Fourier (1768–1830) was a French mathematician and physicist best known for his work on heat transfer and periodic functions. His most significant contribution to science is what we now call Fourier Analysis.
What Is Fourier's Theory?
Fourier’s theory states that:
Any repeating (periodic) signal or pattern can be broken down into a sum of simple sine and cosine waves.
This idea became the foundation of signal processing, modern physics, and data smoothing techniques — including those used in financial markets.
Key Concepts of Fourier’s Theory
1. Decomposition of Signals Complex waveforms can be expressed as combinations of basic sine waves with different frequencies and amplitudes.
2. Frequency Domain View Instead of viewing data in time (or price), you can analyze its frequency — how often certain movements repeat.
3. Smoothing and Filtering By focusing only on certain frequencies (e.g., slower or longer cycles), Fourier methods allow you to filter out short-term noise and focus on the trend.
4. Applications in Finance In trading, Fourier principles help design indicators that:
* Remove short-term market noise
* Emphasize dominant cycles
* Provide cleaner trend direction
Why It Matters for This Indicator
The Fourier Weighted Moving Average (FWMA) used in this indicator applies a custom weight derived from a sin² function, inspired by Fourier’s work on wave behavior. This gives more influence to the mid-section of the price data, making the average line smoother and more stable than traditional methods like SMA or EMA.
Unlike basic moving averages, the FWMA reacts to price changes more fluidly while reducing whipsaws, which is especially useful for trend-following strategies.
Input Settings and Controls
This section outlines all configurable fields and buttons available in the indicator, grouped for clarity:
Main Settings
* Source Defines the price source used in the FWMA calculation. Options typically include close, open, hl2, etc.
* FWMA – 1 (Length) Sets the period for the first Fourier Weighted Moving Average. Shorter lengths produce faster, more sensitive lines.
* FWMA – 2 (Length) Sets the period for the second FWMA, typically used as a slower or long-term trend filter.
* Weight Epsilon A small constant added to the weight formula to prevent division by zero and improve numeric stability in the FWMA formula.
Slope Sensitivity
* Slope Sensitivity (Bars) This field defines the number of bars used to calculate the slope of each FWMA. The slope determines whether the line is rising or falling and is used to change the line color accordingly.
* Enable Slope Coloring (Toggle) When enabled, both FWMA lines change color based on their slope:
* Positive slope = trend up color
* Negative slope = trend down color If disabled, lines are shown in a neutral (gray) color.
Ribbon Settings (Group: Ribbon)
* Enable Ribbon for FWMA-2 (Toggle) Turns the ribbon feature on or off. When enabled, the script plots two additional lines slightly above and below FWMA-2.
* Ribbon Thickness Controls the line width of the ribbon above and below FWMA-2. Values from 1 to 100 are allowed, giving full control over ribbon visual prominence.
About Fourier and His Theory
Joseph Fourier (1768–1830) was a French mathematician and physicist best known for his work on heat transfer and periodic functions. His most significant contribution to science is what we now call Fourier Analysis.
What Is Fourier's Theory?
Fourier’s theory states that:
Any repeating (periodic) signal or pattern can be broken down into a sum of simple sine and cosine waves.
This idea became the foundation of signal processing, modern physics, and data smoothing techniques — including those used in financial markets.
Key Concepts of Fourier’s Theory
1. Decomposition of Signals Complex waveforms can be expressed as combinations of basic sine waves with different frequencies and amplitudes.
2. Frequency Domain View Instead of viewing data in time (or price), you can analyze its frequency — how often certain movements repeat.
3. Smoothing and Filtering By focusing only on certain frequencies (e.g., slower or longer cycles), Fourier methods allow you to filter out short-term noise and focus on the trend.
4. Applications in Finance In trading, Fourier principles help design indicators that:
* Remove short-term market noise
* Emphasize dominant cycles
* Provide cleaner trend direction
Why It Matters for This Indicator
The Fourier Weighted Moving Average (FWMA) used in this indicator applies a custom weight derived from a sin² function, inspired by Fourier’s work on wave behavior. This gives more influence to the mid-section of the price data, making the average line smoother and more stable than traditional methods like SMA or EMA.
Unlike basic moving averages, the FWMA reacts to price changes more fluidly while reducing whipsaws, which is especially useful for trend-following strategies.
Input Settings and Controls
This section outlines all configurable fields and buttons available in the indicator, grouped for clarity:
Main Settings
* Source Defines the price source used in the FWMA calculation. Options typically include close, open, hl2, etc.
* FWMA – 1 (Length) Sets the period for the first Fourier Weighted Moving Average. Shorter lengths produce faster, more sensitive lines.
* FWMA – 2 (Length) Sets the period for the second FWMA, typically used as a slower or long-term trend filter.
* Weight Epsilon A small constant added to the weight formula to prevent division by zero and improve numeric stability in the FWMA formula.
Slope Sensitivity
* Slope Sensitivity (Bars) This field defines the number of bars used to calculate the slope of each FWMA. The slope determines whether the line is rising or falling and is used to change the line color accordingly.
* Enable Slope Coloring (Toggle) When enabled, both FWMA lines change color based on their slope:
* Positive slope = trend up color
* Negative slope = trend down color If disabled, lines are shown in a neutral (gray) color.
Ribbon Settings (Group: Ribbon)
* Enable Ribbon for FWMA-2 (Toggle) Turns the ribbon feature on or off. When enabled, the script plots two additional lines slightly above and below FWMA-2.
* Ribbon Thickness Controls the line width of the ribbon above and below FWMA-2. Values from 1 to 100 are allowed, giving full control over ribbon visual prominence.
發行說明
Fourier Weighted Moving Average (FWMA)
About Fourier and His Theory
Joseph Fourier (1768–1830) was a French mathematician and physicist best known for his work on heat transfer and periodic functions. His most significant contribution to science is what we now call Fourier Analysis.
What Is Fourier's Theory?
Fourier’s theory states that:
Any repeating (periodic) signal or pattern can be broken down into a sum of simple sine and cosine waves.
This idea became the foundation of signal processing, modern physics, and data smoothing techniques — including those used in financial markets.
Key Concepts of Fourier’s Theory
1. Decomposition of Signals Complex waveforms can be expressed as combinations of basic sine waves with different frequencies and amplitudes.
2. Frequency Domain View Instead of viewing data in time (or price), you can analyze its frequency — how often certain movements repeat.
3. Smoothing and Filtering By focusing only on certain frequencies (e.g., slower or longer cycles), Fourier methods allow you to filter out short-term noise and focus on the trend.
4. Applications in Finance In trading, Fourier principles help design indicators that:
* Remove short-term market noise
* Emphasize dominant cycles
* Provide cleaner trend direction
Why It Matters for This Indicator
The Fourier Weighted Moving Average (FWMA) used in this indicator applies a custom weight derived from a sin² function, inspired by Fourier’s work on wave behavior. This gives more influence to the mid-section of the price data, making the average line smoother and more stable than traditional methods like SMA or EMA.
Unlike basic moving averages, the FWMA reacts to price changes more fluidly while reducing whipsaws, which is especially useful for trend-following strategies.
Input Settings and Controls
This section outlines all configurable fields and buttons available in the indicator, grouped for clarity:
Main Settings
* Source Defines the price source used in the FWMA calculation. Options typically include close, open, hl2, etc.
* FWMA – 1 (Length) Sets the period for the first Fourier Weighted Moving Average. Shorter lengths produce faster, more sensitive lines.
* FWMA – 2 (Length) Sets the period for the second FWMA, typically used as a slower or long-term trend filter.
* Weight Epsilon A small constant added to the weight formula to prevent division by zero and improve numeric stability in the FWMA formula.
Slope Sensitivity
* Slope Sensitivity (Bars) This field defines the number of bars used to calculate the slope of each FWMA. The slope determines whether the line is rising or falling and is used to change the line color accordingly.
* Enable Slope Coloring (Toggle) When enabled, both FWMA lines change color based on their slope:
* Positive slope = trend up color
* Negative slope = trend down color If disabled, lines are shown in a neutral (gray) color.
Ribbon Settings (Group: Ribbon)
* Enable Ribbon for FWMA-2 (Toggle) Turns the ribbon feature on or off. When enabled, the script plots two additional lines slightly above and below FWMA-2.
* Ribbon Thickness Controls the line width of the ribbon above and below FWMA-2. Values from 1 to 100 are allowed, giving full control over ribbon visual prominence.
Visual and Style Notes
* Ribbon Offset (Fixed Internally) The vertical spacing between FWMA-2 and the top/bottom ribbon lines is fixed at 0.001 units. This ensures a small but visible ribbon area for visual emphasis.
* Color Customization All line and ribbon colors are dynamically styled based on slope direction but can be overridden via the Style tab in the indicator settings. The ribbon is rendered with 50% opacity to keep the chart clean and readable.
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。