ATR without paranormal bars

aks_v Обновлено   
What Is the Average True Range (ATR)?

The average true range (ATR) is a technical analysis indicator, introduced by market technician J. Welles Wilder Jr. in his book New Concepts in Technical Trading Systems, that measures market volatility by decomposing the entire range of an asset price for that period.

Problems of the classic ATR indicator

The indicator does not show the true volatility of the instrument, at the moments of its strong acceleration or deceleration.
For example, after a strong increase in the volatility of an instrument, with smoothing enabled, the indicator value lags a lot and shows high values, while in fact the volatility has returned to its previous values.

A statistically sharp acceleration or deceleration in volatility ends as quickly as it began.

Due to the problem of data lag, the value of the ATP indicator value information is greatly reduced. The more we increase the smoothing period, the more the indicator value will lag.

The solution to the problem with a sharp temporary change in volatility is to exclude from the calculation the values ​​of the sizes of bars whose size deviates strongly from the average value, such bars are called paranormal.

Examples of paranormal bars

Paranormal bars occur when there is a sharp acceleration or deceleration of the instrument's volatility.

This is characterized by the size of the bars, which are much smaller or larger than their average value in the next period of time.

Comparison of the ATR indicator and ATR_WPB

Comparison of the classic ATP indicator (top) and the ATP indicator calculated without taking into account paranormal bars (bottom).
The example shows that where sharp changes in the instrument's volatility are temporary, they do not affect the value of the ATR_WPB indicator.

Work example

  • Red - ATR_WPB indicator
  • Gray - True range
  • Blue - Momentum (MTM) is a simple leading momentum indicator

How is it calculated
  • Gray - True range
    True Range (TR), which is defined as the greatest of the following:
    * Current High less the current Low
    * Current High less the previous Close (absolute value)
    * Current Low less the previous Close (absolute value)
    TrueRange = max {High-Low ; High - Close_previous ; Close_previous-Low}
  • Blue - Momentum (MTM) is a simple leading momentum indicator
    Momentum (MTM) is simply calculated by subtracting the previous price close from the latest price close using the formula:
    Momentum = Latest close - Specified close
    where the specified period is any previous price close specified by the trader. The result is plotted as an unbound oscillator that oscillates above and below a center line, namely the zero line.
  • Red - ATR_WPB indicator
    Mean value for N bars from a sample that excludes paranormal bars.

How to use
The value of the ATR_WPB indicator can be used to calculate the parameters of a trade, for example, to calculate the amount of risk (stop) per trade, taking 10%-15% of ATR_WPB as the amount of risk.

If we take the ATR_WPB value on the daily chart, we can assume how far the instrument can travel in a day, because the TrueRange value will always tend to the ATR_WPB value.

If the value of Momentum is significantly less than ATR_WPB, then we can conclude that the instrument has sufficient margin of movement, since the value of Momentum will tend to catch up with the value of ATR_WPB.

If the Momentum value is greater than ATR_WPB, then it is worth recognizing that the instrument has already exhausted the energy of its movement, since statistically the Momentum value rarely exceeds the ATR_WPB value.

Информация о релизе:
The code has been optimized. Bugs fixed. The true range is displayed in a bar chart where dark gray bars belong to paranormally large bars, light gray bars belong to paranormally small bars, and gray for the rest of the bars. Removed plotting for Momentum.
Информация о релизе:
The ATR calculation function has been moved to the library.
Скрипт с защищённым кодом
Этот скрипт опубликован с закрытым исходным кодом, вы можете свободно им пользоваться. Можно добавить его в избранное и использовать на графике. Вы не можете просматривать или менять его исходный код.
Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?