OPEN-SOURCE SCRIPT

Range Detection [No Repaint]

DETECTS RANGE EARLY

Using Confirmed Data:

All calculations now use [1] to reference the previous completed candle
Signals are only generated based on completed candles
Range state is stored and confirmed before displaying


Key Changes to Prevent Repainting:

ATR calculations use previous candle data
Bollinger Bands calculate from previous closes
Price range checks use previous highs and lows
Range state is confirmed before displaying


How to Verify No Repainting:

Signals will only appear after a candle closes
Historical signals will remain unchanged
Alerts will only trigger on confirmed changes



This means:

The indicator will be slightly delayed (one candle)
But signals will be more reliable
Historical analysis will be accurate
Backtesting results will match real-time performance

Usage Tips with No-Repaint Version:

Wait for candle close before acting on signals
Use the confirmed range state for decision making
Consider the one-candle delay in your strategy timing
Alerts will only trigger on confirmed condition changes

Would you like me to:

Add a parameter to choose between real-time and no-repaint modes?
Add visual indicators for pending vs confirmed signals?
Modify the sensitivity of the range detection?
forecasting

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité