When you have to get the ATR value of a grammatically created chart in the background then you need to write the ATR function by yourself, you use iATR when you want to apply the function on the existing chart