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 אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?

כתב ויתור