OPEN-SOURCE SCRIPT
[CT] ATR Ratio MTF

This indicator is an enhanced, multi-timeframe version of the original “ATR ratio” by RafaelZioni. Huge thanks to RafaelZioni for the core concept and base logic. The script still combines an ATR-based ratio (Z-score style reading of where price sits within its recent ATR envelope) with an ATR Supertrend, but expands it into a more flexible trade-decision and visual context tool.
The ATR ratio is normalized so you can quickly see when price is pressing into extended bullish or bearish territory, while the Supertrend defines directional bias and a dynamic support-resistance trail. You can choose any higher timeframe in the settings, allowing you to run the ATR ratio and Supertrend from a larger anchor timeframe while trading on a lower chart.
Upgrades include a full Pine Script v6 rewrite, multi-timeframe support for both the ATR ratio and Supertrend, user-controlled colors for the Supertrend in bull and bear modes, and optional bar coloring so price bars automatically reflect Supertrend direction. Entry, pyramiding and take-profit logic from the original script are preserved, giving you a familiar framework with more control over timeframe, visuals and trend bias.
This indicator is designed to give you a clean directional framework that blends volatility, trend, and timing into one view. The ATR ratio side of the script shows you where price sits inside a recent ATR-based envelope. When the ATR ratio pushes up and sustains above the bullish threshold, it signals that price is trading in an extended, momentum-driven zone relative to recent volatility. When it drops and holds below the bearish threshold, it shows the opposite: sellers have pushed price down into an extended bearish zone. The optional background coloring simply makes these bullish and bearish environments easier to see at a glance.
On top of that, the Supertrend and bar colors tell you what side of the market to favor. The Supertrend is calculated from ATR on whatever timeframe you choose in the settings. If you set the MTF input to a higher timeframe, the Supertrend and ATR ratio become your higher time frame bias while you trade on a lower chart. When price is above the MTF Supertrend, the line uses your bullish color and, if bar coloring is enabled, candles adopt your bullish bar color. That is your “long only” environment: you generally look for buys when price is above the Supertrend and the ATR ratio is either turning up from neutral or already in a bullish zone. When price is below the MTF Supertrend, the line uses your bearish color and candles can shift to your bearish bar color; that is where you focus on shorts, especially when the ATR ratio is rolling over or holding in the bearish zone.
The built-in long and short conditions are meant as signal prompts, not rigid rules. Long signals fire when the ATR ratio crosses up through a positive level while the Supertrend is bullish. Short signals fire when the ATR ratio crosses down through a negative level while the Supertrend is bearish. The script tracks how many longs or shorts have been taken in sequence (pyramiding) and will only allow a new signal up to the limit you set, so you can control how aggressively you stack positions in a trend. The take-profit logic then watches the percentage move from your last entry and flags “TP” when that move has reached your take-profit percent, helping you standardize exits instead of eyeballing them bar by bar.
In practice you typically start by choosing your anchor timeframe for the MTF setting, for example a 1-hour or 4-hour Supertrend and ATR ratio while watching a 5-minute or 15-minute chart. You then use the Supertrend direction and bar colors as your bias filter, only taking signals in the direction of the trend, and you use the ATR ratio behavior to judge whether you are entering into strength, fading an extreme, or trading inside a neutral consolidation. Over time this gives you a consistent way to answer three questions on every chart: which side am I allowed to trade, how extended is price within its recent volatility, and where are my structured entries and exits based on that framework.
The ATR ratio is normalized so you can quickly see when price is pressing into extended bullish or bearish territory, while the Supertrend defines directional bias and a dynamic support-resistance trail. You can choose any higher timeframe in the settings, allowing you to run the ATR ratio and Supertrend from a larger anchor timeframe while trading on a lower chart.
Upgrades include a full Pine Script v6 rewrite, multi-timeframe support for both the ATR ratio and Supertrend, user-controlled colors for the Supertrend in bull and bear modes, and optional bar coloring so price bars automatically reflect Supertrend direction. Entry, pyramiding and take-profit logic from the original script are preserved, giving you a familiar framework with more control over timeframe, visuals and trend bias.
This indicator is designed to give you a clean directional framework that blends volatility, trend, and timing into one view. The ATR ratio side of the script shows you where price sits inside a recent ATR-based envelope. When the ATR ratio pushes up and sustains above the bullish threshold, it signals that price is trading in an extended, momentum-driven zone relative to recent volatility. When it drops and holds below the bearish threshold, it shows the opposite: sellers have pushed price down into an extended bearish zone. The optional background coloring simply makes these bullish and bearish environments easier to see at a glance.
On top of that, the Supertrend and bar colors tell you what side of the market to favor. The Supertrend is calculated from ATR on whatever timeframe you choose in the settings. If you set the MTF input to a higher timeframe, the Supertrend and ATR ratio become your higher time frame bias while you trade on a lower chart. When price is above the MTF Supertrend, the line uses your bullish color and, if bar coloring is enabled, candles adopt your bullish bar color. That is your “long only” environment: you generally look for buys when price is above the Supertrend and the ATR ratio is either turning up from neutral or already in a bullish zone. When price is below the MTF Supertrend, the line uses your bearish color and candles can shift to your bearish bar color; that is where you focus on shorts, especially when the ATR ratio is rolling over or holding in the bearish zone.
The built-in long and short conditions are meant as signal prompts, not rigid rules. Long signals fire when the ATR ratio crosses up through a positive level while the Supertrend is bullish. Short signals fire when the ATR ratio crosses down through a negative level while the Supertrend is bearish. The script tracks how many longs or shorts have been taken in sequence (pyramiding) and will only allow a new signal up to the limit you set, so you can control how aggressively you stack positions in a trend. The take-profit logic then watches the percentage move from your last entry and flags “TP” when that move has reached your take-profit percent, helping you standardize exits instead of eyeballing them bar by bar.
In practice you typically start by choosing your anchor timeframe for the MTF setting, for example a 1-hour or 4-hour Supertrend and ATR ratio while watching a 5-minute or 15-minute chart. You then use the Supertrend direction and bar colors as your bias filter, only taking signals in the direction of the trend, and you use the ATR ratio behavior to judge whether you are entering into strength, fading an extreme, or trading inside a neutral consolidation. Over time this gives you a consistent way to answer three questions on every chart: which side am I allowed to trade, how extended is price within its recent volatility, and where are my structured entries and exits based on that framework.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.