OPEN-SOURCE SCRIPT
Güncellendi Adaptive Gaussian AFR

# Adaptive Gaussian AFR (Average Filtering Range)
The **Adaptive Gaussian AFR** is a sophisticated trend-following overlay designed to provide a "cleaner" perspective on market structure. It synthesizes advanced signal processing with volatility-adjusted trailing logic to create a perpetual trend indicator that filters noise while maintaining extreme responsiveness during momentum breakouts.
## How It Works
This indicator combines three distinct mathematical principles to analyze and visualize price action:
### 1. 4-Pole Gaussian Smoothing
Standard moving averages often suffer from a trade-off between smoothness and lag. By employing a **4-pole Gaussian filter**, the indicator applies a bell-curve weighting to price data. This results in a curve that is mathematically smoother than an EMA but reacts more sharply to significant price shocks.
### 2. Adaptive Volatility Scaling
Unlike static indicators, this script utilizes a **Volatility Ratio** (comparing short-term ATR to long-term ATR).
- **Expansion:** When volatility spikes, the Gaussian filter automatically shortens its lookback to "catch" the breakout.
- **Contraction:** When the market consolidates, it lengthens the lookback to prevent "whipsaws" and false signals.
### 3. AFR (Average Filtering Range) Logic
The "step-ladder" behavior is driven by the AFR logic. It calculates volatility-based boundaries (using an ATR factor). The trend line only moves higher if the price exceeds the current floor, and only moves lower if the price breaks the ceiling, creating a "perpetual" support and resistance level.
## Visual Interface & Branding
The script features a high-visibility sentiment map using a custom brand color scheme:
- **Bullish State (Blue - rgb(45, 162, 252)):** Triggered when price is trading above the Adaptive Gaussian mean and the AFR floor.
- **Bearish State (Purple - rgb(113, 59, 249)):** Triggered when price breaks below the mean and the AFR ceiling.
- **Brand Candles:** Price bars are automatically colored to match the trend state for immediate visual confirmation.
## Why This is Unique
Most trend followers are "fixed"—they perform well in trending markets but fail in sideways chop. The uniqueness of the **Adaptive Gaussian AFR** lies in its ability to "breathe." Because the Gaussian engine is adaptive, it attempts to solve the "lag vs. noise" problem by becoming more rigid when the market is indecisive and more fluid when a trend is confirmed.
## Great inventions require great Care
**This is not a standalone trading system.** While the Adaptive Gaussian AFR provides a highly refined view of the trend, it should be used in conjunction with other analysis tools.
- **Lag:** Like all indicators based on historical data, the filter is inherently lagging and cannot predict future price movements.
- **No Standalone Use:** Do not use this as your sole reason for entering or exiting a trade. It is best used as a **Trend Filter** or a **Volatility-Adjusted Entry/Exit Strategy in confluence with other tools**.
- **Context Matters:** It does not account for fundamental news, higher-timeframe resistance, or volume profiles.
Enjoy!
The **Adaptive Gaussian AFR** is a sophisticated trend-following overlay designed to provide a "cleaner" perspective on market structure. It synthesizes advanced signal processing with volatility-adjusted trailing logic to create a perpetual trend indicator that filters noise while maintaining extreme responsiveness during momentum breakouts.
## How It Works
This indicator combines three distinct mathematical principles to analyze and visualize price action:
### 1. 4-Pole Gaussian Smoothing
Standard moving averages often suffer from a trade-off between smoothness and lag. By employing a **4-pole Gaussian filter**, the indicator applies a bell-curve weighting to price data. This results in a curve that is mathematically smoother than an EMA but reacts more sharply to significant price shocks.
### 2. Adaptive Volatility Scaling
Unlike static indicators, this script utilizes a **Volatility Ratio** (comparing short-term ATR to long-term ATR).
- **Expansion:** When volatility spikes, the Gaussian filter automatically shortens its lookback to "catch" the breakout.
- **Contraction:** When the market consolidates, it lengthens the lookback to prevent "whipsaws" and false signals.
### 3. AFR (Average Filtering Range) Logic
The "step-ladder" behavior is driven by the AFR logic. It calculates volatility-based boundaries (using an ATR factor). The trend line only moves higher if the price exceeds the current floor, and only moves lower if the price breaks the ceiling, creating a "perpetual" support and resistance level.
## Visual Interface & Branding
The script features a high-visibility sentiment map using a custom brand color scheme:
- **Bullish State (Blue - rgb(45, 162, 252)):** Triggered when price is trading above the Adaptive Gaussian mean and the AFR floor.
- **Bearish State (Purple - rgb(113, 59, 249)):** Triggered when price breaks below the mean and the AFR ceiling.
- **Brand Candles:** Price bars are automatically colored to match the trend state for immediate visual confirmation.
## Why This is Unique
Most trend followers are "fixed"—they perform well in trending markets but fail in sideways chop. The uniqueness of the **Adaptive Gaussian AFR** lies in its ability to "breathe." Because the Gaussian engine is adaptive, it attempts to solve the "lag vs. noise" problem by becoming more rigid when the market is indecisive and more fluid when a trend is confirmed.
## Great inventions require great Care
**This is not a standalone trading system.** While the Adaptive Gaussian AFR provides a highly refined view of the trend, it should be used in conjunction with other analysis tools.
- **Lag:** Like all indicators based on historical data, the filter is inherently lagging and cannot predict future price movements.
- **No Standalone Use:** Do not use this as your sole reason for entering or exiting a trade. It is best used as a **Trend Filter** or a **Volatility-Adjusted Entry/Exit Strategy in confluence with other tools**.
- **Context Matters:** It does not account for fundamental news, higher-timeframe resistance, or volume profiles.
Enjoy!
Sürüm Notları
# Adaptive Gaussian AFR (Average Filtering Range)The **Adaptive Gaussian AFR** is a sophisticated trend-following overlay designed to provide a "cleaner" perspective on market structure. It synthesizes advanced signal processing with volatility-adjusted trailing logic to create a perpetual trend indicator that filters noise while maintaining extreme responsiveness during momentum breakouts.
## How It Works
This indicator combines three distinct mathematical principles to analyze and visualize price action:
### 1. 4-Pole Gaussian Smoothing
Standard moving averages often suffer from a trade-off between smoothness and lag. By employing a **4-pole Gaussian filter**, the indicator applies a bell-curve weighting to price data. This results in a curve that is mathematically smoother than an EMA but reacts more sharply to significant price shocks.
### 2. Adaptive Volatility Scaling
Unlike static indicators, this script utilizes a **Volatility Ratio** (comparing short-term ATR to long-term ATR).
- **Expansion:** When volatility spikes, the Gaussian filter automatically shortens its lookback to "catch" the breakout.
- **Contraction:** When the market consolidates, it lengthens the lookback to prevent "whipsaws" and false signals.
### 3. AFR (Average Filtering Range) Logic
The "step-ladder" behavior is driven by the AFR logic. It calculates volatility-based boundaries (using an ATR factor). The trend line only moves higher if the price exceeds the current floor, and only moves lower if the price breaks the ceiling, creating a "perpetual" support and resistance level.
## Visual Interface & Branding
The script features a high-visibility sentiment map using a custom brand color scheme:
- **Bullish State (Blue - rgb(45, 162, 252)):** Triggered when price is trading above the Adaptive Gaussian mean and the AFR floor.
- **Bearish State (Purple - rgb(113, 59, 249)):** Triggered when price breaks below the mean and the AFR ceiling.
- **Brand Candles:** Price bars are automatically colored to match the trend state for immediate visual confirmation.
## Why This is Unique
Most trend followers are "fixed"—they perform well in trending markets but fail in sideways chop. The uniqueness of the **Adaptive Gaussian AFR** lies in its ability to "breathe." Because the Gaussian engine is adaptive, it attempts to solve the "lag vs. noise" problem by becoming more rigid when the market is indecisive and more fluid when a trend is confirmed.
## Great inventions require great Care
**This is not a standalone trading system.** While the Adaptive Gaussian AFR provides a highly refined view of the trend, it should be used in conjunction with other analysis tools.
- **Lag:** Like all indicators based on historical data, the filter is inherently lagging and cannot predict future price movements.
- **No Standalone Use:** Do not use this as your sole reason for entering or exiting a trade. It is best used as a **Trend Filter** or a **Volatility-Adjusted Entry/Exit Strategy in confluence with other tools**.
- **Context Matters:** It does not account for fundamental news, higher-timeframe resistance, or volume profiles.
Enjoy!!
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.