how is the atr calculated
Average value. Average true range for a given number of periods can be calculated after calculating the true range values for all those periods. The popular number of periods for ATR is 7 (proposed by the indicator's author in his book New Concepts in Technical Trading Systems) and 14 (used, for example, in MetaTrader default settings).