OPEN-SOURCE SCRIPT

ATR Percentage

The ATR is a great indicator, but for me, it does not define the volatility of an asset I am looking at well enough. So I've adjusted it to be displayed as the usual ATR and a percentage of the closing prince (which to me tells a better story). I find this useful if I am looking through many assets and have to create a quick picture of volatility.

Indicator Definition: The script starts by defining an indicator named "ATR Percentage" that will be displayed in a separate pane (not overlayed on the price chart).

Input for ATR Period: The user can set the period for calculating the ATR through an input field.
ATR Calculation: The ta.atr function calculates the Average True Range based on the specified period.

ATR Percentage Calculation: The ATR value is converted to a percentage of the current closing price using (atrValue / close) * 100.

Plotting:
The script plots both the ATR value and its percentage on the chart.
A horizontal line at zero is added for reference.

Label Display: An optional label displays the current ATR percentage at every 10th bar to avoid cluttering the chart.

Background Color: A light blue background is added to visually separate the ATR indicator from other indicators.

Volatility

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明