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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.