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

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Отказ от ответственности