PROTECTED SOURCE SCRIPT
Telah dikemas kini Ultimate NATR

█ | Overview
This N-ATR (Normalized Average True Range) volatility indicator illustrates the trend of percentage-based candle volatility over a self-defined number of bars (period). The primary objective of the indicator is to highlight periods of high or low volatility, which can be exploited within the cyclical logic of volatility contraction and expansion. If market behavior is inherently cyclical, it naturally follows that candle volatility itself also exhibits cyclical characteristics.
It can therefore be defined as a recurring pattern:
Here is a concrete example of the cyclical phases of volatility, which compresses during Accumulation or Distribution phases, and then explodes with a mark-up or mark-down in price.

█ | Features
🔵 Plots on Overlay false
🔵 Elements, overlapped to the chart
🔵 Customization
█ | N-ATR Calculation
The N-ATR function is built upon the ATR (Average True Range), the quintessential volatility indicator.
Once the ATR_period is defined, the N-ATR is calculated using the following formula:
A moving average of the N-ATR completes the main indicator curve (yellow), making the function smoother and less sensitive to the instantaneous fluctuations of individual candles.
Pine Script®
█ | Settings
█ | Tables
This N-ATR (Normalized Average True Range) volatility indicator illustrates the trend of percentage-based candle volatility over a self-defined number of bars (period). The primary objective of the indicator is to highlight periods of high or low volatility, which can be exploited within the cyclical logic of volatility contraction and expansion. If market behavior is inherently cyclical, it naturally follows that candle volatility itself also exhibits cyclical characteristics.
It can therefore be defined as a recurring pattern:
Low Volatility --> High Volatility --> Low Volatility --> [...]
Here is a concrete example of the cyclical phases of volatility, which compresses during Accumulation or Distribution phases, and then explodes with a mark-up or mark-down in price.
█ | Features
🔵 Plots on Overlay false
- Smoothed NATR Line
- NATR's Fixed Levels
- NATR's Standard Deviation Levels (Dynamic)
🔵 Elements, overlapped to the chart
- Analytical and Statistical Tables
- NATR Information Label
🔵 Customization
- Button to calculate fixed or dynamic (auto-calculated) levels
- Dark / light mode based on the layout background
- Setting of the initial date for the calculation of N-ATR dependent functions
- ATR period
- Moving Average of the N-ATR
- Data sample (number) on which to calculate the standard deviation of the N-ATR
- Adjustment of the multiplicative coefficients of the standard deviation σ
- Setting of static values L1, L2, L3, and L4 of the N-ATR
- Adjustment of the table zoom factor
█ | N-ATR Calculation
The N-ATR function is built upon the ATR (Average True Range), the quintessential volatility indicator.
Once the ATR_period is defined, the N-ATR is calculated using the following formula:
N-ATR = 100 * ATR / close
A moving average of the N-ATR completes the main indicator curve (yellow), making the function smoother and less sensitive to the instantaneous fluctuations of individual candles.
SMA_natr = sum(natr_i) / ATR_period
natr = 100 * ta.atr(periodo_ATR) / close
media_natr = ta.sma(natr, media_len)
█ | Settings
- Show selected calc period: allows you to display or hide a background color that extends from the initial calculation date to the current bar, or from the first available bar if the selected date is earlier.
- Set data range for ST.DEV: this setting defines the number of bars over which the standard deviation is calculated—an essential foundational element for plotting the upper and lower curves relative to the N-ATR, as well as for defining the statistical ranges in the tables overlaid on the price chart.
- Static Levels: these are user-defined input values representing N-ATR value thresholds, used to classify table values within the ranges L1–L2 / L2–L3 / L3–L4 / >L4. To be meaningful, the user is expected to conduct separate statistical analysis using a spreadsheet or external data analysis tools or languages.
- Coefficients x, w, y: these are input values used in the code to calculate statistical ranges and the bands above and below the N-ATR. For example, when expressing the statistical range as μ ± nσ, n can take the value of x, w, or y. By default, the values are x=1, w=2, y=3. However, as explained, they can be customized to represent wider or narrower statistical clusters, depending on the user's analytical preference.
█ | Tables
- Static Levels: when the boolean button "Fixed Levels" is active, the table counts and distributes the data across five ranges, defined by the custom input values L1, L2, L3, and L4. Studying the table immediately answers the question: "Have I set appropriate values for the L_x levels?"
If the majority of data points fall within the lowest range, it indicates that the levels are spaced too far apart; conversely, if most values are in the "> L4" range, the levels are likely too narrow.
From left to right, the table also displays the probability that the current candle might move from its current range to the next one (Update Prob.); the absolute frequency of each range and the relative frequency are shown in the rightmost column. - Dynamic Levels: alternatively, you can deselect "Fixed Levels" to obtain an auto-calculated / self-adjusting representation of the N-ATR and its bands, based on the standard deviation input settings. In this case, the table takes on a more statistical form, useful for analyzing the frequency of outliers beyond a certain standard deviation, as defined by the largest multiplicative coefficient "y".
This visualization may also be preferred when aiming to study the standard deviation of the N-ATR in greater depth for a given asset, timeframe, and configuration more broadly.
█ | Next-to-Price Label
Information in the label next to the live price: if the first settings button in the indicator, "Fixed levels", is enabled (true), a label appears next to the price showing information about the relative position of the N-ATR associated with the current candle.
Specifically, if:- natr ≤ L1, ⇨ "Minimum-"
- natr > L1 and natr ≤ L2, ⇨ "Minimum+"
- natr > L2 and natr ≤ L3, ⇨ "Neutral L3"
- natr > L3 and natr ≤ L4, ⇨ "Topping L4"
- natr > L4, ⇨ "Excess L4: natr > V4"
Additionally, the corresponding N-ATR range is displayed to the right of the evaluated category for the individual candle.
1-Please note: this allows you to avoid constantly checking the N-ATR curve, especially when working in full-screen mode and focusing solely on the price chart for a cleaner view.
2-Please note: unfortunately, the informational label is not available in Dynamic display mode.
█ | Conclusion
• This indicator captures a snapshot of market turbulence. Whether currently unfolding or approaching, the combination of volatility breakout forecasting with price structure analysis—further evaluated based on periods of compression or high turbulence—offers traders a powerful tool for identifying trend-aligned trade opportunities.
• The accompanying analytical tables enhance the indicator by enabling a statistical interpretation of the likelihood that certain excess thresholds will be reached. Based on this data, traders can gain deeper insight into the nature of the asset, identify outlier volatility levels, and strengthen the hedging of their trades. Used as a filter, this indicator significantly improves win rate potential.
Please note: the indicator is shown here on a black background. I suggest you trying it on a white layout as well, so you can decide which visualization best suits your preferences. - natr ≤ L1, ⇨ "Minimum-"
Nota Keluaran
Update #1- Added the label for Dynamic mode (when the "Fixed Levels" button is unchecked)
- Modified the color of the informational label overlaid on the chart in light mode
- Modified the colors of the labels for the upper standard deviation curves + (w, x, y) * σ in Dynamic mode
Nota Keluaran
Update #2- Fixed the display issue of the 3rd column in the table showing statistics on how many N-ATR values fall within the statistical ranges of i * σ, where i = (w, x, y)
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Tg: @Ray_Burst
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Tg: @Ray_Burst
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.