OPEN-SOURCE SCRIPT
Proximal Range Filter [LuxAlgo]

The Proximal Range Filter indicator provides a robust range/noise-filtering solution that utilizes an L1 soft-thresholding approach to determine market trends while minimizing lag and erratic price movements.
🔶 USAGE
The indicator is primarily used to identify the current trend direction and significant price shifts while ignoring minor market noise. It appears as a colored line on the price chart, transitioning between bullish and bearish states.
🔹 Trend Identification
Users can determine the current market sentiment by looking at the color of the filter line and the associated gradient fill:
🔹 Trend Switches
The indicator plots "Trend Switch Dots" at the specific point where a trend reversal is confirmed. These dots appear at the previous filter level to highlight the origin of the new trend direction. This visual cue helps traders identify the exact moment the filter "stepped" in a new direction.
🔹 Responsiveness and Volatility
By adjusting the inputs, traders can tailor the filter to different trading styles:
🔶 DETAILS
The core of this indicator is the L1 Proximal Filter logic. Unlike standard moving averages that react to every price tick, this filter uses a "Soft-Thresholding" mechanism to isolate meaningful price action from random volatility.
🔹 Calculation Logic
The filter operates through a specific prediction-adaptation cycle:
This mathematical approach ensures that only price movements strong enough to overcome the statistical noise (the ATR threshold) result in a change to the filter's value.
🔹 Trend Switch Dots
The Trend Switch Dots are plotted with a -1 offset. This is because a trend change is only confirmed once the current bar's filter value moves relative to the previous bar. The dot marks the price level where the "breakout" from the previous noise range occurred.
🔶 SETTINGS
🔶 USAGE
The indicator is primarily used to identify the current trend direction and significant price shifts while ignoring minor market noise. It appears as a colored line on the price chart, transitioning between bullish and bearish states.
🔹 Trend Identification
Users can determine the current market sentiment by looking at the color of the filter line and the associated gradient fill:
- A green line and fill indicate a bullish trend, suggesting that price is consistently overcoming the upper noise threshold.
- A red line and fill indicate a bearish trend, suggesting that price is consistently breaking below the lower noise threshold.
🔹 Trend Switches
The indicator plots "Trend Switch Dots" at the specific point where a trend reversal is confirmed. These dots appear at the previous filter level to highlight the origin of the new trend direction. This visual cue helps traders identify the exact moment the filter "stepped" in a new direction.
🔹 Responsiveness and Volatility
By adjusting the inputs, traders can tailor the filter to different trading styles:
- For high-volatility assets (like Crypto), increasing the ATR Multiplier can help filter out "fakeouts" that occur during consolidation.
- In trending markets, a higher Adaptation Rate (μ) allows the filter to track price changes more aggressively once the noise threshold is exceeded, reducing lag.
- A lower ATR Multiplier combined with a lower Adaptation Rate creates a more "stepped" filter, useful for identifying major support/resistance levels created by the filter's flat periods.
🔶 DETAILS
The core of this indicator is the L1 Proximal Filter logic. Unlike standard moving averages that react to every price tick, this filter uses a "Soft-Thresholding" mechanism to isolate meaningful price action from random volatility.
🔹 Calculation Logic
The filter operates through a specific prediction-adaptation cycle:
- Noise Threshold: The script calculates a dynamic threshold using a 200-period ATR multiplied by the user-defined setting. This ensures the filter's sensitivity scales automatically with the asset's current volatility.
- State Prediction: The algorithm predicts the next state based on the previous filtered value and the current velocity (the rate of change).
- Adaptive Blending: The prediction is blended with the new incoming source data using the Adaptation Rate (μ). This creates a temporary "candidate" value for the filter.
- Soft-Thresholding: The difference between the candidate value and the previous filter state is evaluated. If the absolute difference is less than the threshold, the velocity is set to zero (the filter remains flat). If it exceeds the threshold, the threshold value is subtracted from the absolute difference to calculate the "meaningful" signal.
This mathematical approach ensures that only price movements strong enough to overcome the statistical noise (the ATR threshold) result in a change to the filter's value.
🔹 Trend Switch Dots
The Trend Switch Dots are plotted with a -1 offset. This is because a trend change is only confirmed once the current bar's filter value moves relative to the previous bar. The dot marks the price level where the "breakout" from the previous noise range occurred.
🔶 SETTINGS
- Source: The price data used for calculation (typically the Close price).
- ATR Multiplier: Defines the noise threshold. Higher values require larger price movements to change the filter's value, resulting in a smoother output that ignores more "whipsaws."
- Adaptation Rate (μ): Controls how fast the internal prediction adapts to price changes. A value of 1.0 reacts most aggressively to new data, while lower values provide more smoothing during the adaptation phase.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Build your own edge with AI: luxalgo.com
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Build your own edge with AI: luxalgo.com
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.