OPEN-SOURCE SCRIPT
ATR Adaptive (auto timeframe)

This indicator automatically adjusts the Average True Range (ATR) period based on the current chart timeframe, helping traders define dynamic Stop Loss (SL) and Take Profit (TP) levels that adapt to market volatility.
The ATR measures the average range of price movement over a defined number of bars. By using adaptive periods, the indicator ensures that volatility is interpreted consistently across different timeframes — from 1-minute charts to daily or weekly charts.
It plots two main levels on the chart:
🔴 Low – ATR × Multiplier → Suggested Stop Loss (below the candle’s low)
🟢 High + ATR × Multiplier → Suggested Take Profit or trailing level (above the candle’s high)
Optional additional lines show ATR-based TP levels calculated from the current close.
💡 How to use
Select your desired ATR multiplier (e.g., 1.3× for SL, 1.0× for TP).
The script automatically detects the chart timeframe and uses an appropriate ATR length (e.g., ATR(30) on M5, ATR(21) on H1, ATR(14) on Daily).
Use the plotted levels to:
Set Stop Loss just below the red ATR band (for long trades).
Set Take Profit near or slightly below the green ATR band (for short trades, reverse logic).
⚙️ Why it helps
Maintains consistent volatility-based risk across multiple timeframes.
Avoids arbitrary fixed SL/TP values.
Makes the trading strategy more responsive in high-volatility markets and more conservative when volatility contracts.
Particularly useful for intraday and swing trading, where volatility varies significantly between sessions.
The ATR measures the average range of price movement over a defined number of bars. By using adaptive periods, the indicator ensures that volatility is interpreted consistently across different timeframes — from 1-minute charts to daily or weekly charts.
It plots two main levels on the chart:
🔴 Low – ATR × Multiplier → Suggested Stop Loss (below the candle’s low)
🟢 High + ATR × Multiplier → Suggested Take Profit or trailing level (above the candle’s high)
Optional additional lines show ATR-based TP levels calculated from the current close.
💡 How to use
Select your desired ATR multiplier (e.g., 1.3× for SL, 1.0× for TP).
The script automatically detects the chart timeframe and uses an appropriate ATR length (e.g., ATR(30) on M5, ATR(21) on H1, ATR(14) on Daily).
Use the plotted levels to:
Set Stop Loss just below the red ATR band (for long trades).
Set Take Profit near or slightly below the green ATR band (for short trades, reverse logic).
⚙️ Why it helps
Maintains consistent volatility-based risk across multiple timeframes.
Avoids arbitrary fixed SL/TP values.
Makes the trading strategy more responsive in high-volatility markets and more conservative when volatility contracts.
Particularly useful for intraday and swing trading, where volatility varies significantly between sessions.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.